-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support multi-task inference. (#861)
*Issue #, if available:* #789 *Description of changes:* This PR adds inference support for multi-task learning. Users can use `python3 -m graphstorm.run.gs_multi_task_learning --inference ` to launch a inference task. This PR also changes remap_result.py to support remapping prediction results from multi-task learning inference. (The prediction results of each task are stored separately on different folders with the name of the corresponding task id.) By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- Co-authored-by: Xiang Song <[email protected]>
- Loading branch information
1 parent
5199149
commit 973d228
Showing
23 changed files
with
2,182 additions
and
218 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Inference only example configs for multi-task learning |
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,79 @@ | ||
--- | ||
version: 1.0 | ||
gsf: | ||
basic: | ||
backend: gloo | ||
verbose: false | ||
save_perf_results_path: null | ||
batch_size: 32 | ||
node_feat_name: | ||
- user:feat | ||
- movie:title | ||
gnn: | ||
model_encoder_type: rgcn | ||
num_layers: 1 | ||
hidden_size: 32 | ||
use_mini_batch_infer: true | ||
input: | ||
restore_model_path: null | ||
output: | ||
save_model_path: null | ||
save_embed_path: null | ||
hyperparam: | ||
dropout: 0. | ||
lr: 0.001 | ||
no_validation: true | ||
rgcn: | ||
num_bases: -1 | ||
use_self_loop: true | ||
use_node_embeddings: false | ||
multi_task_learning: | ||
- node_classification: | ||
target_ntype: "movie" | ||
label_field: "label" | ||
multilabel: false | ||
num_classes: 19 | ||
batch_size: 16 # will overwrite the global batch_size | ||
eval_metric: | ||
- "accuracy" | ||
- node_classification: | ||
target_ntype: "movie" | ||
label_field: "label2" | ||
multilabel: false | ||
num_classes: 19 | ||
batch_size: 16 # will overwrite the global batch_size | ||
eval_metric: | ||
- "accuracy" | ||
- edge_classification: | ||
target_etype: | ||
- "user,rating,movie" | ||
label_field: "rate_class" | ||
multilabel: false | ||
num_classes: 6 | ||
num_decoder_basis: 2 | ||
remove_target_edge_type: false | ||
batch_size: 64 # will overwrite the global batch_size | ||
- edge_regression: | ||
target_etype: | ||
- "user,rating,movie" | ||
label_field: "rate" | ||
num_decoder_basis: 32 | ||
remove_target_edge_type: false | ||
- link_prediction: | ||
num_negative_edges: 4 | ||
num_negative_edges_eval: 100 | ||
train_negative_sampler: joint | ||
eval_etype: | ||
- "user,rating,movie" | ||
train_etype: | ||
- "user,rating,movie" | ||
exclude_training_targets: true | ||
reverse_edge_types_map: | ||
- user,rating,rating-rev,movie | ||
batch_size: 128 # will overwrite the global batch_size | ||
- reconstruct_node_feat: | ||
reconstruct_nfeat_name: "title" | ||
target_ntype: "movie" | ||
batch_size: 128 | ||
eval_metric: | ||
- "mse" |
103 changes: 103 additions & 0 deletions
103
inference_scripts/mt_infer/ml_nc_ec_er_lp_with_mask_infer.yaml
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,103 @@ | ||
--- | ||
version: 1.0 | ||
gsf: | ||
basic: | ||
backend: gloo | ||
verbose: false | ||
save_perf_results_path: null | ||
batch_size: 32 | ||
node_feat_name: | ||
- user:feat | ||
- movie:title | ||
gnn: | ||
model_encoder_type: rgcn | ||
num_layers: 1 | ||
hidden_size: 32 | ||
use_mini_batch_infer: true | ||
input: | ||
restore_model_path: null | ||
output: | ||
save_model_path: null | ||
save_embed_path: null | ||
hyperparam: | ||
dropout: 0. | ||
lr: 0.001 | ||
no_validation: false | ||
rgcn: | ||
num_bases: -1 | ||
use_self_loop: true | ||
use_node_embeddings: false | ||
multi_task_learning: | ||
- node_classification: | ||
target_ntype: "movie" | ||
label_field: "label" | ||
multilabel: false | ||
num_classes: 19 | ||
batch_size: 16 # will overwrite the global batch_size | ||
mask_fields: | ||
- "train_mask_c0" # node classification mask 0 | ||
- "val_mask_c0" | ||
- "test_mask_c0" | ||
eval_metric: | ||
- "accuracy" | ||
- node_classification: | ||
target_ntype: "movie" | ||
label_field: "label2" | ||
multilabel: false | ||
num_classes: 19 | ||
batch_size: 16 # will overwrite the global batch_size | ||
mask_fields: | ||
- "train_mask_c1" # node classification mask 1 | ||
- "val_mask_c1" | ||
- "test_mask_c1" | ||
eval_metric: | ||
- "accuracy" | ||
- edge_classification: | ||
target_etype: | ||
- "user,rating,movie" | ||
label_field: "rate_class" | ||
multilabel: false | ||
num_classes: 6 | ||
num_decoder_basis: 2 | ||
remove_target_edge_type: false | ||
batch_size: 64 # will overwrite the global batch_size | ||
mask_fields: | ||
- "train_mask_field_c" # edge classification mask | ||
- "val_mask_field_c" | ||
- "test_mask_field_c" | ||
- edge_regression: | ||
target_etype: | ||
- "user,rating,movie" | ||
label_field: "rate" | ||
num_decoder_basis: 32 | ||
remove_target_edge_type: false | ||
mask_fields: | ||
- "train_mask_field_r" # edge regression mask | ||
- "val_mask_field_r" | ||
- "test_mask_field_r" | ||
- link_prediction: | ||
num_negative_edges: 4 | ||
num_negative_edges_eval: 100 | ||
train_negative_sampler: joint | ||
eval_etype: | ||
- "user,rating,movie" | ||
train_etype: | ||
- "user,rating,movie" | ||
exclude_training_targets: true | ||
reverse_edge_types_map: | ||
- user,rating,rating-rev,movie | ||
batch_size: 128 # will overwrite the global batch_size | ||
mask_fields: | ||
- "train_mask_field_lp" | ||
- null # empty means there is no validation mask | ||
- "test_mask_field_lp" | ||
- reconstruct_node_feat: | ||
reconstruct_nfeat_name: "title" | ||
target_ntype: "movie" | ||
batch_size: 128 | ||
mask_fields: | ||
- "train_mask_c0" # use the same mask as node classification c0 | ||
- "val_mask_c0" | ||
- "test_mask_c0" | ||
eval_metric: | ||
- "mse" |
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
Oops, something went wrong.