Skip to content
Open
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b9e664b
update
xnuohz Oct 30, 2025
4cfa0a3
update
xnuohz Oct 30, 2025
3080221
add changelog
xnuohz Oct 31, 2025
fef36f4
Merge branch 'master' into cov/llm/vit
xnuohz Nov 1, 2025
ec9c462
update
xnuohz Nov 1, 2025
beafdc4
update
xnuohz Nov 1, 2025
eca7f10
update
xnuohz Nov 1, 2025
8881879
update
xnuohz Nov 1, 2025
57c9b55
update
xnuohz Nov 1, 2025
7c9efbe
update
xnuohz Nov 1, 2025
2c97909
improve models/llm.py
xnuohz Nov 3, 2025
a1a39d7
Merge branch 'master' into cov/llm/vit
xnuohz Nov 3, 2025
93d0693
improve models/llm_judge.py
xnuohz Nov 3, 2025
94ae196
update changelog
xnuohz Nov 3, 2025
3bb82b2
improve models/molecule_gpt.py
xnuohz Nov 3, 2025
7dd529a
improve models/glem.py
xnuohz Nov 3, 2025
5680e00
update
xnuohz Nov 3, 2025
17c2210
improve models/txt2kg.py
xnuohz Nov 3, 2025
2a6ab6f
update
xnuohz Nov 4, 2025
117fe75
update
xnuohz Nov 4, 2025
9be3f11
improve utils/backend_utils.py
xnuohz Nov 4, 2025
c204e58
update
xnuohz Nov 4, 2025
b6576c5
update
xnuohz Nov 4, 2025
b2ecd18
upload cov in testing_rag.yaml
xnuohz Nov 4, 2025
7bc110c
update
xnuohz Nov 4, 2025
25b27b1
update
xnuohz Nov 5, 2025
3c19b2e
update
xnuohz Nov 5, 2025
502207e
update
xnuohz Nov 5, 2025
ebc1429
update
xnuohz Nov 5, 2025
48c984e
upload cov in testing_rag (v1)
xnuohz Nov 5, 2025
e9b2286
update
xnuohz Nov 7, 2025
c121caa
add flag when upload coverage
xnuohz Nov 7, 2025
64c960c
add flag in coverage not useful
xnuohz Nov 7, 2025
c0cef4a
fix molecule_gpt_dataset test
xnuohz Nov 8, 2025
3cb3efc
Merge branch 'master' into cov/llm/vit
xnuohz Nov 8, 2025
52b9d87
remove onlyrag in llm/utils
xnuohz Nov 8, 2025
554bc38
ignore llm test in minimal/nightly/prev test
xnuohz Nov 8, 2025
d5caa53
remove onlyrag in llm/models
xnuohz Nov 8, 2025
99aff66
update timeout minutes
xnuohz Nov 8, 2025
4e5ac17
remove onlyrag in txt2kg
xnuohz Nov 8, 2025
c978391
set onlyLinux in txt2kg test
xnuohz Nov 8, 2025
8ae6f28
cleanup
xnuohz Nov 8, 2025
58d0484
fuse rag and latest test
xnuohz Nov 8, 2025
1f9a56e
update
xnuohz Nov 11, 2025
f382f38
update
xnuohz Nov 11, 2025
a1809fc
remove onlyRAG
xnuohz Nov 11, 2025
33e9ebb
remove onlyRAG
xnuohz Nov 11, 2025
17cd41c
update
xnuohz Nov 16, 2025
42ffa92
fix ci
xnuohz Nov 16, 2025
44b780b
fix ci
xnuohz Nov 16, 2025
7b31783
fix ci
xnuohz Nov 16, 2025
00ca6b9
update
xnuohz Nov 16, 2025
ac0796c
Merge branch 'master' into cov/llm/vit
xnuohz Nov 17, 2025
da82264
Merge branch 'master' into cov/llm/vit
xnuohz Nov 22, 2025
b143673
trigger ci
xnuohz Nov 26, 2025
ffec466
Merge branch 'master' into cov/llm/vit
xnuohz Dec 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/testing_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
- name: Install main package (Windows)
if: ${{ steps.changed-files-specific.outputs.only_changed != 'true' && runner.os == 'Windows' }}
run: |
uv pip install -e ".[test]"
uv pip install -e ".[test,rag]"

- name: Install main package
if: ${{ steps.changed-files-specific.outputs.only_changed != 'true' && runner.os != 'Windows' }}
run: |
uv pip install -e ".[full,test]"
uv pip install -e ".[full,test,rag]"

- name: Check installation
if: steps.changed-files-specific.outputs.only_changed != 'true'
Expand All @@ -69,7 +69,7 @@ jobs:

- name: Run tests
if: steps.changed-files-specific.outputs.only_changed != 'true'
timeout-minutes: 15
timeout-minutes: 30
run: |
uv run --no-project pytest --cov --cov-report=xml --durations 10

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing_minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ jobs:
if: steps.changed-files-specific.outputs.only_changed != 'true'
timeout-minutes: 15
run: |
uv run --no-project pytest --durations 10
uv run --no-project pytest --ignore=test/llm --durations 10
2 changes: 1 addition & 1 deletion .github/workflows/testing_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ jobs:
if: steps.changed-files-specific.outputs.only_changed != 'true'
timeout-minutes: 15
run: |
uv run --no-project pytest --durations 10
uv run --no-project pytest --ignore=test/llm --durations 10
2 changes: 1 addition & 1 deletion .github/workflows/testing_prev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ jobs:
if: steps.changed-files-specific.outputs.only_changed != 'true'
timeout-minutes: 15
run: |
uv run --no-project pytest --durations 10
uv run --no-project pytest --ignore=test/llm --durations 10
52 changes: 0 additions & 52 deletions .github/workflows/testing_rag.yml

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Changed

- Improved `.llm` code coverage ([#10516](https://github.com/pyg-team/pytorch_geometric/pull/10516))

### Deprecated

### Removed
Expand Down
3 changes: 2 additions & 1 deletion examples/llm/molecule_gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ def get_clippable_params(params):
# Create model ===============================================
llm = LLM(
# model_name='lmsys/vicuna-7b-v1.5',
model_name='TinyLlama/TinyLlama-1.1B-Chat-v0.1',
model_name='Qwen/Qwen3-0.6B',
num_params=1,
dtype=torch.bfloat16,
sys_prompt='You are an agent, answer my questions.',
)

graph_encoder = GINEConv(
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ rag=[
"sentencepiece",
"accelerate",
"torchmetrics",
"peft",
]
test=[
"onnx",
Expand Down
3 changes: 2 additions & 1 deletion test/datasets/test_protein_mpnn_dataset.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from torch_geometric.datasets import ProteinMPNNDataset
from torch_geometric.testing import onlyOnline, withPackage
from torch_geometric.testing import onlyLinux, onlyOnline, withPackage


@onlyLinux
@onlyOnline
@withPackage('pandas')
def test_protein_mpnn_dataset():
Expand Down
8 changes: 1 addition & 7 deletions test/datasets/test_web_qsp_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@

from torch_geometric.datasets import WebQSPDataset
from torch_geometric.datasets.web_qsp_dataset import KGQABaseDataset
from torch_geometric.testing import (
onlyFullTest,
onlyOnline,
onlyRAG,
withPackage,
)
from torch_geometric.testing import onlyFullTest, onlyOnline, withPackage


@pytest.mark.skip(reason="Times out")
Expand Down Expand Up @@ -144,7 +139,6 @@ def mock_load_dataset(path: str):
return mock_load_dataset, ds


@onlyRAG
@withPackage("datasets", "pandas")
def test_kgqa_base_dataset(tmp_path, monkeypatch):

Expand Down
14 changes: 8 additions & 6 deletions test/llm/models/test_g_retriever.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import gc

import pytest
import torch

from torch_geometric.llm.models import LLM, GRetriever
from torch_geometric.nn import GAT
from torch_geometric.testing import onlyRAG, withPackage
from torch_geometric.testing import withPackage


@onlyRAG
@withPackage('transformers', 'sentencepiece', 'accelerate')
def test_g_retriever() -> None:
@withPackage('transformers', 'sentencepiece', 'accelerate', 'peft')
@pytest.mark.parametrize('use_lora', [True, False])
def test_g_retriever(use_lora: bool) -> None:
llm = LLM(model_name='Qwen/Qwen3-0.6B', dtype=torch.float32,
sys_prompt="You're an agent, answer my questions.")

Expand All @@ -25,6 +26,7 @@ def test_g_retriever() -> None:
model = GRetriever(
llm=llm,
gnn=gnn,
use_lora=use_lora,
)
assert str(model) == ('GRetriever(\n'
' llm=LLM(Qwen/Qwen3-0.6B),\n'
Expand Down Expand Up @@ -54,8 +56,7 @@ def test_g_retriever() -> None:
torch.cuda.empty_cache()


@onlyRAG
@withPackage('transformers', 'sentencepiece', 'accelerate')
@withPackage('transformers', 'sentencepiece', 'accelerate', 'peft')
def test_g_retriever_many_tokens() -> None:
llm = LLM(model_name='Qwen/Qwen3-0.6B', dtype=torch.float32,
sys_prompt="You're an agent, answer my questions.")
Expand All @@ -73,6 +74,7 @@ def test_g_retriever_many_tokens() -> None:
llm=llm,
gnn=gnn,
mlp_out_tokens=2,
use_lora=True,
)
assert str(model) == ('GRetriever(\n'
' llm=LLM(Qwen/Qwen3-0.6B),\n'
Expand Down
15 changes: 14 additions & 1 deletion test/llm/models/test_git_mol.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,24 @@ def test_git_mol():
[1, 2, 3, 4, 0, 6, 7, 8, 9, 5],
])
edge_attr = torch.zeros(edge_index.size(1), 16, dtype=torch.long)
# batch size = 1
batch = torch.tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
smiles = ['CC(C)([C@H]1CC2=C(O1)C=CC3=C2OC(=O)C=C3)O']
captions = ['The molecule is the (R)-(-)-enantiomer of columbianetin.']
images = torch.randn(1, 3, 224, 224)
loss = model(x, edge_index, batch, edge_attr, smiles, images, captions)
assert loss >= 0

# Test train:
# batch size > 1
batch = torch.tensor([0, 0, 0, 0, 0, 1, 1, 1, 1, 1])
smiles = [
'CC(C)([C@H]1CC2=C(O1)C=CC3=C2OC(=O)C=C3)O',
'CCOc1ccccc1',
]
captions = [
'The molecule is the (R)-(-)-enantiomer of columbianetin.',
'Ethoxybenzene is an aromatic ether.'
]
images = torch.randn(2, 3, 224, 224)
loss = model(x, edge_index, batch, edge_attr, smiles, images, captions)
assert loss >= 0
Loading
Loading