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 |
|
@@ -52,6 +52,22 @@ test(model, mode="test", dataset=dataset, gpus=None)
|
|
52 |
# hits@10: 0.668
|
53 |
```
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
* 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
|
56 |
* 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.
|
57 |
|
|
|
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 |
|
|
|
52 |
# hits@10: 0.668
|
53 |
```
|
54 |
|
55 |
+
Or with `AutoModel`:
|
56 |
+
|
57 |
+
```python
|
58 |
+
|
59 |
+
from transformers import AutoModel
|
60 |
+
from ultra.datasets import CoDExSmall
|
61 |
+
from ultra.eval import test
|
62 |
+
|
63 |
+
model = AutoModel.from_pretrained("mgalkin/ultra_3g", trust_remote_code=True)
|
64 |
+
dataset = CoDExSmall(root="./datasets/")
|
65 |
+
test(model, mode="test", dataset=dataset, gpus=None)
|
66 |
+
# Expected results for ULTRA 3g
|
67 |
+
# mrr: 0.472
|
68 |
+
# hits@10: 0.668
|
69 |
+
```
|
70 |
+
|
71 |
* 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
|
72 |
* 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.
|
73 |
|