renamed the interface to UltraForKnowledgeGraphReasoning
Browse files- README.md +1 -1
- modeling.py +3 -3
README.md
CHANGED
@@ -44,7 +44,7 @@ from modeling import UltraLinkPrediction
|
|
44 |
from ultra.datasets import CoDExSmall
|
45 |
from ultra.eval import test
|
46 |
|
47 |
-
model =
|
48 |
dataset = CoDExSmall(root="./datasets/")
|
49 |
test(model, mode="test", dataset=dataset, gpus=None)
|
50 |
# Expected results for ULTRA 3g
|
|
|
44 |
from ultra.datasets import CoDExSmall
|
45 |
from ultra.eval import test
|
46 |
|
47 |
+
model = UltraForKnowledgeGraphReasoning.from_pretrained("mgalkin/ultra_3g")
|
48 |
dataset = CoDExSmall(root="./datasets/")
|
49 |
test(model, mode="test", dataset=dataset, gpus=None)
|
50 |
# Expected results for ULTRA 3g
|
modeling.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os
|
2 |
import sys
|
3 |
from transformers import PretrainedConfig, PreTrainedModel
|
4 |
-
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
5 |
from ultra.models import Ultra
|
6 |
from ultra.datasets import WN18RR, CoDExSmall, FB15k237, FB15k237Inductive
|
7 |
from ultra.eval import test
|
@@ -39,7 +39,7 @@ class UltraConfig(PretrainedConfig):
|
|
39 |
|
40 |
super().__init__(**kwargs)
|
41 |
|
42 |
-
class
|
43 |
|
44 |
config_class = UltraConfig
|
45 |
|
@@ -59,7 +59,7 @@ class UltraLinkPrediction(PreTrainedModel):
|
|
59 |
|
60 |
if __name__ == "__main__":
|
61 |
|
62 |
-
model =
|
63 |
dataset = CoDExSmall(root="./datasets/")
|
64 |
test(model, mode="test", dataset=dataset, gpus=None)
|
65 |
# mrr: 0.472035
|
|
|
1 |
import os
|
2 |
import sys
|
3 |
from transformers import PretrainedConfig, PreTrainedModel
|
4 |
+
#sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
5 |
from ultra.models import Ultra
|
6 |
from ultra.datasets import WN18RR, CoDExSmall, FB15k237, FB15k237Inductive
|
7 |
from ultra.eval import test
|
|
|
39 |
|
40 |
super().__init__(**kwargs)
|
41 |
|
42 |
+
class UltraForKnowledgeGraphReasoning(PreTrainedModel):
|
43 |
|
44 |
config_class = UltraConfig
|
45 |
|
|
|
59 |
|
60 |
if __name__ == "__main__":
|
61 |
|
62 |
+
model = UltraForKnowledgeGraphReasoning.from_pretrained("mgalkin/ultra_3g")
|
63 |
dataset = CoDExSmall(root="./datasets/")
|
64 |
test(model, mode="test", dataset=dataset, gpus=None)
|
65 |
# mrr: 0.472035
|