Skip to content

Commit 68433c1

Browse files
committed
initial commit
0 parents  commit 68433c1

27 files changed

+4743
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 MilaGraph
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 350 additions & 0 deletions
Large diffs are not rendered by default.

asset/ultra_logo.png

604 KB
Loading

ckpts/ultra_3g.pth

2.03 MB
Binary file not shown.

ckpts/ultra_4g.pth

2.03 MB
Binary file not shown.

config/inductive/inference.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
output_dir: ~/git/ultra_pyg_dev/output
2+
3+
dataset:
4+
class: {{ dataset }}
5+
root: ~/git/ultra_pyg_dev/kg-datasets/
6+
version: {{ version }}
7+
8+
model:
9+
class: Ultra
10+
relation_model:
11+
class: NBFNet
12+
input_dim: 64
13+
hidden_dims: [64, 64, 64, 64, 64, 64]
14+
message_func: distmult
15+
aggregate_func: sum
16+
short_cut: yes
17+
layer_norm: yes
18+
entity_model:
19+
class: IndNBFNet
20+
input_dim: 64
21+
hidden_dims: [64, 64, 64, 64, 64, 64]
22+
message_func: distmult
23+
aggregate_func: sum
24+
short_cut: yes
25+
layer_norm: yes
26+
27+
task:
28+
name: InductiveInference
29+
num_negative: 256
30+
strict_negative: yes
31+
adversarial_temperature: 1
32+
metric: [mr, mrr, hits@1, hits@3, hits@10, hits@10_50]
33+
34+
optimizer:
35+
class: AdamW
36+
lr: 5.0e-4
37+
38+
train:
39+
gpus: {{ gpus }}
40+
batch_size: 16
41+
num_epoch: {{ epochs }}
42+
log_interval: 100
43+
batch_per_epoch: {{ bpe }}
44+
#logger: wandb
45+
46+
checkpoint: {{ ckpt }}

config/transductive/inference.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
output_dir: ~/git/ultra_pyg_dev/output
2+
3+
dataset:
4+
class: {{ dataset }}
5+
root: ~/git/ultra_pyg_dev/kg-datasets/
6+
7+
model:
8+
class: Ultra
9+
relation_model:
10+
class: NBFNet
11+
input_dim: 64
12+
hidden_dims: [64, 64, 64, 64, 64, 64]
13+
message_func: distmult
14+
aggregate_func: sum
15+
short_cut: yes
16+
layer_norm: yes
17+
entity_model:
18+
class: IndNBFNet
19+
input_dim: 64
20+
hidden_dims: [64, 64, 64, 64, 64, 64]
21+
message_func: distmult
22+
aggregate_func: sum
23+
short_cut: yes
24+
layer_norm: yes
25+
26+
task:
27+
name: TransductiveInference
28+
num_negative: 256
29+
strict_negative: yes
30+
adversarial_temperature: 1
31+
metric: [mr, mrr, hits@1, hits@3, hits@10]
32+
33+
optimizer:
34+
class: AdamW
35+
lr: 5.0e-4
36+
37+
train:
38+
gpus: {{ gpus }}
39+
batch_size: 8
40+
num_epoch: {{ epochs }}
41+
log_interval: 100
42+
batch_per_epoch: {{ bpe }}
43+
44+
checkpoint: {{ ckpt }}

config/transductive/pretrain_3g.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
output_dir: ~/nosnap/ultra_outputs/
2+
3+
dataset:
4+
class: JointDataset
5+
graphs: [FB15k237, WN18RR, CoDExMedium]
6+
root: ~/nosnap/ultra_datasets/
7+
8+
model:
9+
class: Ultra
10+
relation_model:
11+
class: NBFNet
12+
input_dim: 64
13+
hidden_dims: [64, 64, 64, 64, 64, 64]
14+
message_func: distmult
15+
aggregate_func: sum
16+
short_cut: yes
17+
layer_norm: yes
18+
entity_model:
19+
class: IndNBFNet
20+
input_dim: 64
21+
hidden_dims: [64, 64, 64, 64, 64, 64]
22+
message_func: distmult
23+
aggregate_func: sum
24+
short_cut: yes
25+
layer_norm: yes
26+
27+
task:
28+
name: MultiGraphPretraining
29+
num_negative: 512
30+
strict_negative: yes
31+
adversarial_temperature: 1
32+
metric: [mr, mrr, hits@1, hits@3, hits@10]
33+
34+
optimizer:
35+
class: AdamW
36+
lr: 5.0e-4
37+
38+
train:
39+
gpus: {{ gpus }}
40+
batch_size: 64
41+
num_epoch: 10
42+
log_interval: 800
43+
batch_per_epoch: 80000
44+
fast_test: 500
45+
#logger: wandb

config/transductive/pretrain_4g.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
output_dir: ~/nosnap/ultra_outputs/
2+
3+
dataset:
4+
class: JointDataset
5+
graphs: [FB15k237, WN18RR, CoDExMedium, NELL995]
6+
root: ~/nosnap/ultra_datasets/
7+
8+
model:
9+
class: Ultra
10+
relation_model:
11+
class: NBFNet
12+
input_dim: 64
13+
hidden_dims: [64, 64, 64, 64, 64, 64]
14+
message_func: distmult
15+
aggregate_func: sum
16+
short_cut: yes
17+
layer_norm: yes
18+
entity_model:
19+
class: IndNBFNet
20+
input_dim: 64
21+
hidden_dims: [64, 64, 64, 64, 64, 64]
22+
message_func: distmult
23+
aggregate_func: sum
24+
short_cut: yes
25+
layer_norm: yes
26+
27+
task:
28+
name: MultiGraphPretraining
29+
num_negative: 512
30+
strict_negative: yes
31+
adversarial_temperature: 1
32+
metric: [mr, mrr, hits@1, hits@3, hits@10]
33+
34+
optimizer:
35+
class: AdamW
36+
lr: 5.0e-4
37+
38+
train:
39+
gpus: {{ gpus }}
40+
batch_size: 64
41+
num_epoch: 10
42+
log_interval: 400
43+
batch_per_epoch: 40000
44+
fast_test: 500
45+
#logger: wandb

requirements.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
torch>=2.1.0
2+
torch-scatter>=2.1.2
3+
#torch-sparse>=0.6.18
4+
torch-geometric>=2.4.0
5+
ninja
6+
easydict
7+
pyyaml

0 commit comments

Comments
 (0)