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.666
|
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.666
|
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_4g", trust_remote_code=True)
|
60 |
+
dataset = CoDExSmall(root="./datasets/")
|
61 |
+
test(model, mode="test", dataset=dataset, gpus=None)
|
62 |
+
# Expected results for ULTRA 4g
|
63 |
+
# mrr: 0.464
|
64 |
+
# hits@10: 0.666
|
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 |
|