-
Notifications
You must be signed in to change notification settings - Fork 60
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
Implemented evaluator for link-prediction in retrieval setting #667
Open
wangz10
wants to merge
11
commits into
awslabs:main
Choose a base branch
from
wangz10:lp_retrieval
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
77bc16c
Implemented inductive splits for link prediction
wangz10 70b0b2f
[TEMP] commit
wangz10 93ef9f3
[TEMP] commit 2
wangz10 f381bfb
[DRAFT] implemented by loading embeds to DistTensor
wangz10 f91f0fc
Added e2e test
wangz10 4ea6691
clean-ups
wangz10 28f1fb1
Added seed; fixed problems for inductive setting
wangz10 a5a9db4
[TEMP]
wangz10 4a79017
clean-ups
wangz10 f8c88e2
Merge branch 'main' into lp_retrieval
wangz10 3028996
lint
wangz10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
DGL_HOME=/root/dgl | ||
GS_HOME=$(pwd) | ||
NUM_TRAINERS=4 | ||
NUM_INFO_TRAINERS=2 | ||
export PYTHONPATH=$GS_HOME/python/ | ||
cd $GS_HOME/training_scripts/gsgnn_lp | ||
echo "127.0.0.1" > ip_list.txt | ||
cd $GS_HOME/inference_scripts/lp_infer | ||
echo "127.0.0.1" > ip_list.txt | ||
|
||
# train a model, save model and embeddings | ||
python3 -m graphstorm.run.gs_link_prediction --workspace $GS_HOME/training_scripts/gsgnn_lp --num-trainers $NUM_TRAINERS --num-servers 1 --num-samplers 0 --part-config /data/movielen_100k_lp_train_val_1p_4t/movie-lens-100k.json --ip-config ip_list.txt --ssh-port 2222 --cf ml_lp.yaml --fanout '10,15' --num-layers 2 --use-mini-batch-infer false --eval-batch-size 1024 --exclude-training-targets True --reverse-edge-types-map user,rating,rating-rev,movie --save-model-path /data/gsgnn_lp_ml_dot/ --topk-model-to-save 1 --save-model-frequency 1000 --save-embed-path /data/gsgnn_lp_ml_dot/emb/ --logging-file /tmp/train_log.txt --logging-level debug --preserve-input True | ||
|
||
|
||
best_epoch_dot=$(grep "successfully save the model to" /tmp/train_log.txt | tail -1 | tr -d '\n' | tail -c 1) | ||
echo "The best model is saved in epoch $best_epoch_dot" | ||
|
||
echo "**************dataset: Movielens, do inference on saved model, decoder: dot" | ||
python3 -m graphstorm.run.gs_link_prediction --inference --workspace $GS_HOME/inference_scripts/lp_infer --num-trainers $NUM_INFO_TRAINERS --num-servers 1 --num-samplers 0 --part-config /data/movielen_100k_lp_train_val_1p_4t/movie-lens-100k.json --ip-config ip_list.txt --ssh-port 2222 --cf ml_lp_infer.yaml --fanout '10,15' --num-layers 2 --use-mini-batch-infer false --eval-batch-size 1024 --save-embed-path /data/gsgnn_lp_ml_dot/infer-emb/ --restore-model-path /data/gsgnn_lp_ml_dot/epoch-$best_epoch_dot/ --preserve-input True | ||
|
||
# inference for retrieval setting | ||
echo "**************dataset: Movielens, do inference on saved model, decoder: dot, retrieval setting:" | ||
python3 -m graphstorm.run.gs_link_prediction --inference --workspace $GS_HOME/inference_scripts/lp_infer --num-trainers $NUM_INFO_TRAINERS --num-servers 1 --num-samplers 0 --part-config /data/movielen_100k_lp_train_val_1p_4t/movie-lens-100k.json --ip-config ip_list.txt --ssh-port 2222 --cf ml_lp_infer.yaml --fanout '10,15' --num-layers 2 --use-mini-batch-infer false --eval-batch-size 1024 --restore-embed-path /data/gsgnn_lp_ml_dot/infer-emb/ --restore-model-path /data/gsgnn_lp_ml_dot/epoch-$best_epoch_dot/ --preserve-input True --eval-negative-sampler full --save-embed-path none | ||
|
||
# inferece for retrieval setting: ppi | ||
WORKSPACE=/industry-gml-benchmarks/primekg | ||
cd $WORKSPACE | ||
# 1. generate GNN embeddings | ||
python3 -m graphstorm.run.gs_link_prediction --inference --num-trainers 8 --num-servers 4 \ | ||
--num-samplers 0 \ | ||
--ssh-port 2222 \ | ||
--part-config $WORKSPACE/4p/primekg_graph_tasks/1_ppi/primekg.json \ | ||
--ip-config /data/ip_list_p4_zw.txt \ | ||
--cf 1_ppi/frozen_lm_rgcn_lp.yaml \ | ||
--batch-size 1024 \ | ||
--hidden-size 256 \ | ||
--restore-model-path /industry-gml-benchmarks/primekg/4p/primekg_graph_tasks/1_ppi/frozen_lm_rgcn_lp_model-sm/epoch-6 \ | ||
--save-embed-path /industry-gml-benchmarks/primekg/4p/primekg_graph_tasks/1_ppi/frozen_lm_rgcn_lp_model-sm/epoch-6/embs | ||
|
||
# 2. calculate MRR in retrieval setting: | ||
python3 -m graphstorm.run.gs_link_prediction --inference --num-trainers 8 --num-servers 4 \ | ||
--num-samplers 0 \ | ||
--ssh-port 2222 \ | ||
--part-config $WORKSPACE/4p/primekg_graph_tasks/1_ppi/primekg.json \ | ||
--ip-config /data/ip_list_p4_zw.txt \ | ||
--cf 1_ppi/frozen_lm_rgcn_lp.yaml \ | ||
--batch-size 1024 \ | ||
--hidden-size 256 \ | ||
--restore-model-path /industry-gml-benchmarks/primekg/4p/primekg_graph_tasks/1_ppi/frozen_lm_rgcn_lp_model-sm/epoch-6 \ | ||
--restore-embed-path /industry-gml-benchmarks/primekg/4p/primekg_graph_tasks/1_ppi/frozen_lm_rgcn_lp_model-sm/epoch-6/embs \ | ||
--eval-negative-sampler full --save-embed-path none | ||
|
||
# 1. generate GNN embeddings | ||
python3 -m graphstorm.run.gs_link_prediction --inference --num-trainers 8 --num-servers 4 \ | ||
--num-samplers 0 \ | ||
--ssh-port 2222 \ | ||
--part-config $WORKSPACE/4p/primekg_graph_tasks/2_protein_function_prediction/primekg.json \ | ||
--ip-config /data/ip_list_p4_zw.txt \ | ||
--cf 2_protein_function_prediction/frozen_lm_rgcn_lp.yaml \ | ||
--batch-size 256 \ | ||
--hidden-size 256 \ | ||
--restore-model-path /industry-gml-benchmarks/primekg/4p/primekg_graph_tasks/2_protein_function_prediction/frozen_lm_rgcn_lp_model-sm/epoch-49 \ | ||
--save-embed-path /industry-gml-benchmarks/primekg/4p/primekg_graph_tasks/2_protein_function_prediction/frozen_lm_rgcn_lp_model-sm/epoch-49/embs | ||
|
||
# 2. calculate MRR in retrieval setting: | ||
python3 -m graphstorm.run.gs_link_prediction --inference --num-trainers 8 --num-servers 4 \ | ||
--num-samplers 0 \ | ||
--ssh-port 2222 \ | ||
--part-config $WORKSPACE/4p/primekg_graph_tasks/2_protein_function_prediction/primekg.json \ | ||
--ip-config /data/ip_list_p4_zw.txt \ | ||
--cf 2_protein_function_prediction/frozen_lm_rgcn_lp.yaml \ | ||
--batch-size 256 \ | ||
--hidden-size 256 \ | ||
--restore-model-path /industry-gml-benchmarks/primekg/4p/primekg_graph_tasks/2_protein_function_prediction/frozen_lm_rgcn_lp_model-sm/epoch-49 \ | ||
--restore-embed-path /industry-gml-benchmarks/primekg/4p/primekg_graph_tasks/2_protein_function_prediction/frozen_lm_rgcn_lp_model-sm/epoch-49/embs \ | ||
--eval-negative-sampler full --save-embed-path none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we didn't have a function to load GNN embeddings saved by GraphStorm? @classicsong