updated readme
Browse files
README.md
CHANGED
@@ -30,11 +30,11 @@ Here on HuggingFace, we provide 3 pre-trained ULTRA checkpoints (all ~169k param
|
|
30 |
|
31 |
## ⚡️ Your Superpowers
|
32 |
|
33 |
-
ULTRA performs **link prediction** (KG completion): given a query `(head, relation, ?)`, it ranks all nodes in the graph as potential `tails`.
|
34 |
|
35 |
|
36 |
1. Install the dependencies as listed in the Installation instructions on the [GitHub repo](https://github.com/DeepGraphLearning/ULTRA#installation).
|
37 |
-
2. Clone this model repo to find the `
|
38 |
|
39 |
* Run **zero-shot inference** on any graph:
|
40 |
|
@@ -50,6 +50,20 @@ test(model, mode="test", dataset=dataset, gpus=None)
|
|
50 |
# hits@10: 0.685
|
51 |
```
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
* You can also **fine-tune** ULTRA on each graph, please refer to the [github repo](https://github.com/DeepGraphLearning/ULTRA#run-inference-and-fine-tuning) for more details on training / fine-tuning
|
54 |
* The model code contains 57 different KGs, please refer to the [github repo](https://github.com/DeepGraphLearning/ULTRA#datasets) for more details on what's available.
|
55 |
|
|
|
30 |
|
31 |
## ⚡️ Your Superpowers
|
32 |
|
33 |
+
ULTRA performs **link prediction** (KG completion aka reasoning): given a query `(head, relation, ?)`, it ranks all nodes in the graph as potential `tails`.
|
34 |
|
35 |
|
36 |
1. Install the dependencies as listed in the Installation instructions on the [GitHub repo](https://github.com/DeepGraphLearning/ULTRA#installation).
|
37 |
+
2. Clone this model repo to find the `UltraForKnowledgeGraphReasoning` class in `modeling.py` and load the checkpoint (all the necessary model code is in this model repo as well).
|
38 |
|
39 |
* Run **zero-shot inference** on any graph:
|
40 |
|
|
|
50 |
# hits@10: 0.685
|
51 |
```
|
52 |
|
53 |
+
Or with `AutoModel`:
|
54 |
+
|
55 |
+
```python
|
56 |
+
from transformers import AutoModel
|
57 |
+
from ultra.datasets import CoDExSmall
|
58 |
+
from ultra.eval import test
|
59 |
+
model = AutoModel.from_pretrained("mgalkin/ultra_50g", trust_remote_code=True)
|
60 |
+
dataset = CoDExSmall(root="./datasets/")
|
61 |
+
test(model, mode="test", dataset=dataset, gpus=None)
|
62 |
+
# Expected results for ULTRA 50g
|
63 |
+
# mrr: 0.498
|
64 |
+
# hits@10: 0.685
|
65 |
+
```
|
66 |
+
|
67 |
* You can also **fine-tune** ULTRA on each graph, please refer to the [github repo](https://github.com/DeepGraphLearning/ULTRA#run-inference-and-fine-tuning) for more details on training / fine-tuning
|
68 |
* The model code contains 57 different KGs, please refer to the [github repo](https://github.com/DeepGraphLearning/ULTRA#datasets) for more details on what's available.
|
69 |
|