Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TXT2KG w/ hotpot_qa.pyGraph Retrieval Example and tech_qa.py HybridRAG e2e workflow example #9992

Open
wants to merge 427 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
427 commits
Select commit Hold shift + click to select a range
a00cc1b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2025
d7a78db
debug
puririshi98 Jan 14, 2025
fe7e3e5
debug
puririshi98 Jan 14, 2025
9d873f4
debug
puririshi98 Jan 14, 2025
571b0e7
debug
puririshi98 Jan 14, 2025
e28c88f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2025
76db078
debug
puririshi98 Jan 14, 2025
f1815ee
debug
puririshi98 Jan 14, 2025
8359d78
debug
puririshi98 Jan 14, 2025
ba911b8
debug
puririshi98 Jan 14, 2025
dcf2cc0
debug
puririshi98 Jan 14, 2025
767526e
debug
puririshi98 Jan 14, 2025
1418cdc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2025
a5bd9d7
debug
puririshi98 Jan 14, 2025
bb7d0f9
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 14, 2025
bb26487
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2025
04519b0
debug
puririshi98 Jan 14, 2025
ae84691
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 14, 2025
a760b5a
debug
puririshi98 Jan 14, 2025
f9e73bf
debug
puririshi98 Jan 14, 2025
e1f369a
debug
puririshi98 Jan 14, 2025
ef925a8
debug
puririshi98 Jan 14, 2025
6350622
debug
puririshi98 Jan 14, 2025
2020bd0
debug
puririshi98 Jan 14, 2025
675e744
system works pretty well now, adding approx recall
puririshi98 Jan 14, 2025
497e65b
debug
puririshi98 Jan 14, 2025
8371afb
debug
puririshi98 Jan 14, 2025
0a0a090
debug
puririshi98 Jan 14, 2025
2d00ed2
debug
puririshi98 Jan 14, 2025
cdc86cb
debug
puririshi98 Jan 14, 2025
57b61c7
debug
puririshi98 Jan 14, 2025
f0f8ae9
debug
puririshi98 Jan 14, 2025
9f16ec4
debug
puririshi98 Jan 14, 2025
fbc8243
final fix
puririshi98 Jan 14, 2025
c96e9d3
removed prints, done debugging. will tune hyperparams for retriever p…
puririshi98 Jan 14, 2025
c76686e
removed prints, done debugging. will tune hyperparams for retriever p…
puririshi98 Jan 14, 2025
fa445a5
Merge branch 'master' into rebase-txt2kg
puririshi98 Jan 15, 2025
3ecccda
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 15, 2025
63ea8b2
removing unneeded comments
puririshi98 Jan 15, 2025
2c8ec46
cleaning
puririshi98 Jan 15, 2025
7954786
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 15, 2025
5ab3299
Update graph_store.py
puririshi98 Jan 16, 2025
f9c0e9c
clean
puririshi98 Jan 16, 2025
423891d
improving defaults for hotpotQA retrieval, will continue to tune afte…
puririshi98 Jan 16, 2025
bb18b77
updating txt2kg system prompt, last sentence caused wierd behavior
puririshi98 Jan 16, 2025
5addd93
Update hotpot_qa.py
puririshi98 Jan 16, 2025
a5faf9b
Update hotpot_qa.py
puririshi98 Jan 16, 2025
a7e044b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 16, 2025
8f984d1
Update txt2kg.py
puririshi98 Jan 17, 2025
d44f280
fixing typo
puririshi98 Jan 20, 2025
6e3aefc
Update backend_utils.py
puririshi98 Jan 21, 2025
9e8d5cb
fix for bellow issue
puririshi98 Jan 21, 2025
4eb0ed8
Update backend_utils.py
puririshi98 Jan 21, 2025
fa5c659
Update txt2kg.py
puririshi98 Jan 21, 2025
0969d67
commenting and usability
puririshi98 Jan 22, 2025
d5e49a6
commenting and usability
puririshi98 Jan 22, 2025
0cc3ef5
commenting and usability
puririshi98 Jan 22, 2025
0f19922
skip pcst for bad graphs
puririshi98 Jan 22, 2025
4f28162
Merge branch 'master' into rebase-txt2kg
puririshi98 Jan 22, 2025
e7529a6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
ec702db
commenting and usability
puririshi98 Jan 22, 2025
3a7cc3f
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 22, 2025
29523fe
commenting and usability
puririshi98 Jan 22, 2025
3904f51
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
1ed1c18
commenting and usability
puririshi98 Jan 22, 2025
718d82f
commenting and usability
puririshi98 Jan 22, 2025
ff9c3fa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
5521aea
commenting and usability
puririshi98 Jan 22, 2025
6de0788
commenting and usability
puririshi98 Jan 22, 2025
7309bc6
commenting and usability
puririshi98 Jan 22, 2025
3c93c41
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
88a7986
drafting techqa
puririshi98 Jan 22, 2025
8f7a7dd
drafting techqa
puririshi98 Jan 22, 2025
6c9a0db
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
c1aad3f
drafting techqa
puririshi98 Jan 22, 2025
dd026fb
drafting techqa
puririshi98 Jan 22, 2025
1deb4f0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
e1581e1
drafting techqa
puririshi98 Jan 22, 2025
400eea0
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 22, 2025
0cbd525
drafting techqa
puririshi98 Jan 22, 2025
2484d2d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
afb0ac5
drafting techqa
puririshi98 Jan 22, 2025
741bf2e
drafting techqa
puririshi98 Jan 22, 2025
f8c0ee1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
c7b5462
drafting techqa
puririshi98 Jan 22, 2025
b491aae
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 22, 2025
75157bd
drafting techqa
puririshi98 Jan 22, 2025
04c80a0
drafting techqa
puririshi98 Jan 22, 2025
2826852
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
0b081fe
drafting techqa
puririshi98 Jan 22, 2025
3bba220
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
f0aec29
drafting techqa
puririshi98 Jan 22, 2025
db6cee7
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 22, 2025
6bbb6ae
drafting techqa
puririshi98 Jan 22, 2025
9cf3a89
drafting techqa
puririshi98 Jan 22, 2025
451ae4d
add techqa to Readme
puririshi98 Jan 22, 2025
2111b02
ai cleanup (#9970)
puririshi98 Jan 23, 2025
2ff6a85
ai cleanup for utils (#9971)
puririshi98 Jan 23, 2025
afe44d6
Merge branch 'master' into rebase-txt2kg
puririshi98 Jan 23, 2025
c7a5e4d
fix for "Note:"
puririshi98 Jan 24, 2025
024cabe
Merge branch 'master' into rebase-txt2kg
puririshi98 Jan 24, 2025
cdc492f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 24, 2025
4693e53
Update txt2kg.py
puririshi98 Jan 27, 2025
cadaa9d
Add eval (#9976)
puririshi98 Jan 27, 2025
e92c0e7
Merge branch 'master' into rebase-txt2kg
puririshi98 Jan 27, 2025
8249ba1
Update examples/llm/hotpot_qa.py
puririshi98 Jan 27, 2025
f134106
address reviews
puririshi98 Jan 27, 2025
b9a55cf
Update hotpot_qa.py
puririshi98 Jan 27, 2025
3dbcf8f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
2519e67
drafting
puririshi98 Jan 27, 2025
45214cd
drafting
puririshi98 Jan 27, 2025
8b77eaa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
7747b12
drafting
puririshi98 Jan 27, 2025
5addc14
drafting
puririshi98 Jan 27, 2025
a38d489
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
45133b7
drafting
puririshi98 Jan 27, 2025
cae97e7
drafting
puririshi98 Jan 27, 2025
e109dc5
drafting
puririshi98 Jan 27, 2025
29109a4
drafting
puririshi98 Jan 27, 2025
3b92cf1
drafting
puririshi98 Jan 27, 2025
8712e8b
drafting
puririshi98 Jan 27, 2025
a1c0cc4
drafting
puririshi98 Jan 27, 2025
0f744a7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
98240cd
drafting
puririshi98 Jan 27, 2025
fb9e378
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 27, 2025
15fe2bd
drafting
puririshi98 Jan 27, 2025
941b745
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
473577d
drafting
puririshi98 Jan 27, 2025
0c664f1
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 27, 2025
055527b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
77d5951
drafting
puririshi98 Jan 27, 2025
db4a24a
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 27, 2025
d99a23c
drafting
puririshi98 Jan 27, 2025
c4400f1
drafting
puririshi98 Jan 28, 2025
10da58b
drafting
puririshi98 Jan 28, 2025
b977e9a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 28, 2025
5240ca0
cleaning
puririshi98 Jan 28, 2025
4a2e86b
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 28, 2025
c3654c8
cleaning
puririshi98 Jan 28, 2025
8b8f00f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 28, 2025
7bc4bcb
cleaning
puririshi98 Jan 28, 2025
f6c81f1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 28, 2025
906e82c
cleaning
puririshi98 Jan 28, 2025
cf6162c
Merge branch 'rebase-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 28, 2025
a2ea3cd
cleaning
puririshi98 Jan 28, 2025
8883238
cleaning
puririshi98 Jan 28, 2025
11194ee
cleaning
puririshi98 Jan 28, 2025
ea15dc9
cleaning
puririshi98 Jan 28, 2025
87d7b70
cleaning
puririshi98 Jan 28, 2025
3d799a4
using similar prompt to vectorRAG team
puririshi98 Jan 29, 2025
131dabc
Merge branch 'master' into latest-txt2kg
puririshi98 Jan 29, 2025
f52f81a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 29, 2025
9a68f7c
improving
puririshi98 Jan 29, 2025
ddd3828
improving
puririshi98 Jan 29, 2025
95db95b
improving
puririshi98 Jan 30, 2025
49848f9
improving
puririshi98 Jan 30, 2025
8383e96
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2025
87650fe
improving
puririshi98 Jan 30, 2025
ea3b4c4
Merge branch 'latest-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 30, 2025
9ec3ddc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2025
f95a137
improving
puririshi98 Jan 30, 2025
f91c3e0
Merge branch 'latest-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 30, 2025
f377418
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2025
140c75e
improving
puririshi98 Jan 30, 2025
189ebf1
improving
puririshi98 Jan 30, 2025
1ef9fbc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2025
f16a0ad
improving
puririshi98 Jan 30, 2025
78319f2
improving
puririshi98 Jan 30, 2025
c71a778
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2025
30c4766
improving
puririshi98 Jan 30, 2025
40c36fc
improving
puririshi98 Jan 30, 2025
f1e8d30
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2025
d5325c3
improving
puririshi98 Jan 30, 2025
07bacb9
improving
puririshi98 Jan 30, 2025
2aa99dd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2025
1ad6562
improving
puririshi98 Jan 30, 2025
419539e
Merge branch 'latest-txt2kg' of https://github.com/pyg-team/pytorch_g…
puririshi98 Jan 30, 2025
4aed74d
improving
puririshi98 Jan 30, 2025
7d80449
improving
puririshi98 Jan 30, 2025
ca43505
improving
puririshi98 Jan 30, 2025
7d6557d
improving
puririshi98 Jan 30, 2025
4d054b7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2025
c93fae5
Hybrid rag (#9995)
puririshi98 Jan 31, 2025
377dfaf
Merge branch 'master' into latest-txt2kg
puririshi98 Jan 31, 2025
b9dc0fc
cleanup
puririshi98 Feb 1, 2025
335f20e
fixing retry script
puririshi98 Feb 3, 2025
fb959cb
fix
puririshi98 Feb 5, 2025
7ed58bd
fix
puririshi98 Feb 5, 2025
8f5e3af
Merge branch 'master' into latest-txt2kg
puririshi98 Feb 5, 2025
b984886
Update hotpot_qa.py
puririshi98 Feb 5, 2025
4925f5c
Update hotpot_qa.py
puririshi98 Feb 5, 2025
7d064dc
save command (#10005)
puririshi98 Feb 5, 2025
ba0acd2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 5, 2025
5146f5a
cleaning
puririshi98 Feb 6, 2025
0749bb3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 6, 2025
ba79f26
Merge branch 'master' into latest-txt2kg
puririshi98 Feb 11, 2025
5f736ff
Merge branch 'master' into latest-txt2kg
puririshi98 Feb 12, 2025
edd2c04
Update tech_qa.py
puririshi98 Feb 12, 2025
61aeb79
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 12, 2025
4dfe2dc
Update tech_qa.py w preproc instructions
puririshi98 Feb 19, 2025
8438ed6
Merge branch 'master' into latest-txt2kg
puririshi98 Feb 19, 2025
8150e00
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 19, 2025
10493a9
Update tech_qa.py
puririshi98 Feb 19, 2025
a95663c
Update g_retriever.py
puririshi98 Feb 28, 2025
d6e7ada
Merge branch 'master' into latest-txt2kg
puririshi98 Mar 4, 2025
2ff65bb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 4, 2025
5f9388b
Update txt2kg.py
puririshi98 Mar 4, 2025
70d6cb2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 4, 2025
bb3992d
Update txt2kg.py
puririshi98 Mar 5, 2025
03fc8a5
NIMs can be unreliable, more retries
puririshi98 Mar 6, 2025
e70d88e
more retries for llmjudge
puririshi98 Mar 6, 2025
03be3de
update data set up (#10104)
puririshi98 Mar 8, 2025
959d5f1
Merge branch 'master' into latest-txt2kg
puririshi98 Mar 9, 2025
2ffd715
Update txt2kg.py
puririshi98 Mar 12, 2025
914aeea
fix syntax
puririshi98 Mar 12, 2025
04b4faf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2025
068eb1e
Merge branch 'master' into latest-txt2kg
puririshi98 Mar 12, 2025
a128a85
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2025
cb2e153
Update txt2kg.py
puririshi98 Mar 12, 2025
ca03b7b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2025
3da5920
Update llm_judge.py
puririshi98 Mar 12, 2025
12e4ad0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2025
db6b66d
Update tech_qa.py
puririshi98 Mar 12, 2025
24c81d0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2025
73b3c05
Update tech_qa.py
puririshi98 Mar 12, 2025
3718bbf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2025
5eccd9c
Update txt2kg.py
puririshi98 Mar 12, 2025
184de47
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2025
fde14ef
Update txt2kg.py
puririshi98 Mar 12, 2025
fd8a2e6
Update tech_qa.py
puririshi98 Mar 12, 2025
5b86184
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2025
982e665
Update tech_qa.py
puririshi98 Mar 12, 2025
04959c2
endpoint for llm judge too
puririshi98 Mar 12, 2025
3b5ff6e
Update sentence_transformer.py
puririshi98 Mar 13, 2025
d2624e3
Update sentence_transformer.py
puririshi98 Mar 13, 2025
07922f4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 13, 2025
ae31e7b
Update sentence_transformer.py
puririshi98 Mar 13, 2025
dcccbdd
Update llm.py
puririshi98 Mar 13, 2025
429b91c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 13, 2025
9f50ba5
Update sentence_transformer.py
puririshi98 Mar 13, 2025
d02f173
Update llm.py
puririshi98 Mar 13, 2025
1cf2e95
Update llm.py
puririshi98 Mar 13, 2025
9411a9d
Update tech_qa.py
puririshi98 Mar 13, 2025
b761dbc
Update backend_utils.py
puririshi98 Mar 19, 2025
70d88e2
Merge branch 'master' into latest-txt2kg
puririshi98 Mar 25, 2025
5616d99
Large Graph Indexer WebQSP Refactor (#9806)
zaristei Apr 2, 2025
f3c66aa
Merge branch 'master' into latest-txt2kg
puririshi98 Apr 3, 2025
518cbc5
Adds checkpointing for KG creation to `tech_qa.py` (#10135)
rlratzel Apr 3, 2025
aefdbd8
Update tech_qa.py
puririshi98 Apr 4, 2025
17218ac
Add max_seq_length in SentenceTransformer (#10166)
Kh4L Apr 4, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Added

- Adds TXT2KG class with example on HotPotQA ([#9846](https://github.com/pyg-team/pytorch_geometric/pull/9846))
- Improving documentation for [cuGraph](https://github.com/rapidsai/cugraph) ([#10083](https://github.com/pyg-team/pytorch_geometric/pull/10083))
- Added `HashTensor` ([#10072](https://github.com/pyg-team/pytorch_geometric/pull/10072))
- Added `SGFormer` model and example ([#9904](https://github.com/pyg-team/pytorch_geometric/pull/9904))
Expand Down
19 changes: 10 additions & 9 deletions examples/llm/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Examples for Co-training LLMs and GNNs

| Example | Description |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`g_retriever.py`](./g_retriever.py) | Example for Retrieval-Augmented Generation (RAG) w/ GNN+LLM by co-training `LLAMA3` with `GAT` for answering questions based on knowledge graph information. We also have an [example repo](https://github.com/neo4j-product-examples/neo4j-gnn-llm-example) for integration with [Neo4j Graph DBs][neo4j.com] |
| [`g_retriever_utils/`](./g_retriever_utils/) | Contains multiple scripts for benchmarking GRetriever's architecture and evaluating different retrieval methods. |
| [`multihop_rag/`](./multihop_rag/) | Contains starter code and an example run for building a Multi-hop dataset using WikiHop5M and 2WikiMultiHopQA |
| [`nvtx_examples/`](./nvtx_examples/) | Contains examples of how to wrap functions using the NVTX profiler for CUDA runtime analysis. |
| [`molecule_gpt.py`](./molecule_gpt.py) | Example for MoleculeGPT: Instruction Following Large Language Models for Molecular Property Prediction. Supports MoleculeGPT and InstructMol dataset |
| [`glem.py`](./glem.py) | Example for [GLEM](https://arxiv.org/abs/2210.14709), a GNN+LLM co-training model via variational Expectation-Maximization (EM) framework on node classification tasks to achieve SOTA results |
| [`git_mol.py`](./git_mol.py) | Example for GIT-Mol: A Multi-modal Large Language Model for Molecular Science with Graph, Image, and Text |
| Example | Description |
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`g_retriever.py`](./g_retriever.py) | Example for Retrieval-Augmented Generation (RAG) w/ GNN+LLM by co-training `LLAMA3` with `GAT` for answering questions based on knowledge graph information. We also have an [example repo](https://github.com/neo4j-product-examples/neo4j-gnn-llm-example) for integration with [Neo4j Graph DBs][neo4j.com] |
| [`g_retriever_utils/`](./g_retriever_utils/) | Contains multiple scripts for benchmarking GRetriever's architecture and evaluating different retrieval methods. |
| [`nvtx_examples/`](./nvtx_examples/) | Contains examples of how to wrap functions using the NVTX profiler for CUDA runtime analysis. |
| [`molecule_gpt.py`](./molecule_gpt.py) | Example for MoleculeGPT: Instruction Following Large Language Models for Molecular Property Prediction. Supports MoleculeGPT and InstructMol dataset |
| [`glem.py`](./glem.py) | Example for [GLEM](https://arxiv.org/abs/2210.14709), a GNN+LLM co-training model via variational Expectation-Maximization (EM) framework on node classification tasks to achieve SOTA results |
| [`git_mol.py`](./git_mol.py) | Example for GIT-Mol: A Multi-modal Large Language Model for Molecular Science with Graph, Image, and Text |
| [`hotpot_qa.py`](./hotpot_qa.py) | Example for converting adapting the retrieval step of conventional Retrieval-Augmented Generation (RAG) for use with G-retriever, and how to approximate the precision/recall of a subgraph retrieval method. Uses the HotPotQA dataset from [Hugging Face](https://huggingface.co/datasets/hotpotqa/hotpot_qa). This is it is multihop in nature. |
| [`tech_qa.py`](./tech_qa.py) | Full end 2 end HybridRAG pipeline combining txt2kg and retrieval from `hotpot_qa.py` and training/testing from g_retriever.py with VectorRAG. Uses the techQA dataset from [Hugging Face](https://huggingface.co/datasets/rojagtap/tech-qa) |
74 changes: 35 additions & 39 deletions examples/llm/g_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def load_params_dict(model, save_path):
return model


def get_loss(model, batch, model_save_name: str) -> Tensor:
def get_loss(model, batch, model_save_name="gnn+llm") -> Tensor:
"""Compute the loss for a given model and batch of data.

Args:
Expand All @@ -148,17 +148,17 @@ def get_loss(model, batch, model_save_name: str) -> Tensor:
return model(batch.question, batch.label, batch.desc)
else: # (GNN+LLM)
return model(
batch.question,
batch.x, # node features
batch.edge_index, # edge indices
batch.batch, # batch indices
batch.label, # answers (labels)
batch.question, # ["list", "of", "questions", "here"]
batch.x, # [num_nodes, num_features]
batch.edge_index, # [2, num_edges]
batch.batch, # which node belongs to which batch index
batch.label, # list answers (labels)
batch.edge_attr, # edge attributes
batch.desc # description
batch.desc # list of text graph descriptions
)


def inference_step(model, batch, model_save_name):
def inference_step(model, batch, model_save_name="gnn+llm"):
"""Performs inference on a given batch of data using the provided model.

Args:
Expand All @@ -174,14 +174,31 @@ def inference_step(model, batch, model_save_name):
# Perform inference on the question and textual graph description
return model.inference(batch.question, batch.desc)
else: # (GNN+LLM)
return model.inference(
batch.question,
batch.x, # node features
batch.edge_index, # edge indices
batch.batch, # batch indices
batch.edge_attr, # edge attributes
batch.desc # description
)
return model.inference(batch.question, batch.x, batch.edge_index,
batch.batch, batch.edge_attr, batch.desc)


def adjust_learning_rate(param_group, LR, epoch, num_epochs):
"""Decay learning rate with half-cycle cosine after warmup.

Args:
param_group (dict): Parameter group.
LR (float): Learning rate.
num_epochs (int): Current epoch.

Returns:
float: Adjusted learning rate.
"""
min_lr = 5e-6
warmup_epochs = 1
if epoch < warmup_epochs:
lr = LR
else:
lr = min_lr + (LR - min_lr) * 0.5 * (
1.0 + math.cos(math.pi * (epoch - warmup_epochs) /
(num_epochs - warmup_epochs)))
param_group['lr'] = lr
return lr


def train(
Expand Down Expand Up @@ -216,28 +233,6 @@ def train(
Returns:
None
"""
def adjust_learning_rate(param_group, LR, epoch):
"""Decay learning rate with half-cycle cosine after warmup.

Args:
param_group (dict): Parameter group.
LR (float): Learning rate.
epoch (int): Current epoch.

Returns:
float: Adjusted learning rate.
"""
min_lr = 5e-6
warmup_epochs = 1
if epoch < warmup_epochs:
lr = LR
else:
lr = min_lr + (LR - min_lr) * 0.5 * (
1.0 + math.cos(math.pi * (epoch - warmup_epochs) /
(num_epochs - warmup_epochs)))
param_group['lr'] = lr
return lr

# Start training time
start_time = time.time()

Expand Down Expand Up @@ -322,7 +317,8 @@ def adjust_learning_rate(param_group, LR, epoch):

if (step + 1) % 2 == 0:
adjust_learning_rate(optimizer.param_groups[0], lr,
step / len(train_loader) + epoch)
step / len(train_loader) + epoch,
num_epochs)

optimizer.step()
epoch_loss = epoch_loss + float(loss)
Expand Down
11 changes: 4 additions & 7 deletions examples/llm/g_retriever_utils/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Examples for LLM and GNN co-training

| Example | Description |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`rag_feature_store.py`](./rag_feature_store.py) | A Proof of Concept Implementation of a RAG enabled FeatureStore that can serve as a starting point for implementing a custom RAG Remote Backend |
| [`rag_graph_store.py`](./rag_graph_store.py) | A Proof of Concept Implementation of a RAG enabled GraphStore that can serve as a starting point for implementing a custom RAG Remote Backend |
| [`rag_backend_utils.py`](./rag_backend_utils.py) | Utility functions used for loading a series of Knowledge Graph Triplets into the Remote Backend defined by a FeatureStore and GraphStore |
| [`rag_generate.py`](./rag_generate.py) | Script for generating a unique set of subgraphs from the WebQSP dataset using a custom defined retrieval algorithm (defaults to the FeatureStore and GraphStore provided) |
| [`benchmark_model_archs_rag.py`](./benchmark_model_archs_rag.py) | Script for running a GNN/LLM benchmark on GRetriever while grid searching relevent architecture parameters and datasets. |
| Example | Description |
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [`benchmark_model_archs_rag.py`](./benchmark_model_archs_rag.py) | Script for running a GNN/LLM benchmark on GRetriever while grid searching relevent architecture parameters and datasets. |
| [`minimal_demo.py`](./minimal_demo.py) | Minimal demo for WebQSP dataset comparing GNN+LLM vs LLM |

NOTE: Evaluating performance on GRetriever with smaller sample sizes may result in subpar performance. It is not unusual for the fine-tuned model/LLM to perform worse than an untrained LLM on very small sample sizes.
139 changes: 0 additions & 139 deletions examples/llm/g_retriever_utils/rag_generate.py

This file was deleted.

Loading