Update README.md
Browse files
README.md
CHANGED
|
@@ -10,6 +10,12 @@ tags:
|
|
| 10 |
license: apache-2.0
|
| 11 |
language:
|
| 12 |
- en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
# Hierarchy-Transformers/HiT-MPNet-WordNetNoun
|
|
@@ -20,15 +26,23 @@ A **Hi**erarchy **T**ransformer Encoder (HiT) model that explicitly encodes enti
|
|
| 20 |
|
| 21 |
<!-- Provide a longer summary of what this model is. -->
|
| 22 |
|
| 23 |
-
HiT-MPNet-WordNetNoun is a HiT model trained on WordNet's
|
| 24 |
|
| 25 |
- **Developed by:** [Yuan He](https://www.yuanhe.wiki/), Zhangdie Yuan, Jiaoyan Chen, and Ian Horrocks
|
| 26 |
- **Model type:** Hierarchy Transformer Encoder (HiT)
|
| 27 |
- **License:** Apache license 2.0
|
| 28 |
-
- **Hierarchy**: WordNet (
|
| 29 |
-
- **Training Dataset**: Download `wordnet.zip` from [Datasets for HiTs on Zenodo](https://zenodo.org/doi/10.5281/zenodo.10511042)
|
| 30 |
- **Pre-trained model:** [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2)
|
| 31 |
-
- **Training Objectives**: Jointly optimised on *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
### Model Sources
|
| 34 |
|
|
@@ -58,7 +72,12 @@ gpu_id = 0
|
|
| 58 |
device = get_torch_device(gpu_id)
|
| 59 |
|
| 60 |
# load the model
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
# entity names to be encoded.
|
| 64 |
entity_names = ["computer", "personal computer", "fruit", "berry"]
|
|
@@ -86,7 +105,8 @@ parent_norms = model.manifold.dist0(parent_entity_embeddings)
|
|
| 86 |
subsumption_scores = - (dists + centri_score_weight * (parent_norms - child_norms))
|
| 87 |
```
|
| 88 |
|
| 89 |
-
Training and evaluation scripts are available at [GitHub](https://github.com/KRR-Oxford/HierarchyTransformers).
|
|
|
|
| 90 |
Technical details are presented in the [paper](https://arxiv.org/abs/2401.11374).
|
| 91 |
|
| 92 |
|
|
@@ -105,7 +125,7 @@ HierarchyTransformer(
|
|
| 105 |
|
| 106 |
Preprint on arxiv: https://arxiv.org/abs/2401.11374.
|
| 107 |
|
| 108 |
-
*Yuan He, Zhangdie Yuan, Jiaoyan Chen, Ian Horrocks.* **Language Models as Hierarchy Encoders.**
|
| 109 |
|
| 110 |
```
|
| 111 |
@article{he2024language,
|
|
@@ -119,4 +139,4 @@ Preprint on arxiv: https://arxiv.org/abs/2401.11374.
|
|
| 119 |
|
| 120 |
## Model Card Contact
|
| 121 |
|
| 122 |
-
For any queries or feedback, please contact Yuan He (yuan.he
|
|
|
|
| 10 |
license: apache-2.0
|
| 11 |
language:
|
| 12 |
- en
|
| 13 |
+
metrics:
|
| 14 |
+
- precision
|
| 15 |
+
- recall
|
| 16 |
+
- f1
|
| 17 |
+
base_model:
|
| 18 |
+
- sentence-transformers/all-mpnet-base-v2
|
| 19 |
---
|
| 20 |
|
| 21 |
# Hierarchy-Transformers/HiT-MPNet-WordNetNoun
|
|
|
|
| 26 |
|
| 27 |
<!-- Provide a longer summary of what this model is. -->
|
| 28 |
|
| 29 |
+
HiT-MPNet-WordNetNoun is a HiT model trained on WordNet's subsumption (hypernym) hierarchy of noun entities.
|
| 30 |
|
| 31 |
- **Developed by:** [Yuan He](https://www.yuanhe.wiki/), Zhangdie Yuan, Jiaoyan Chen, and Ian Horrocks
|
| 32 |
- **Model type:** Hierarchy Transformer Encoder (HiT)
|
| 33 |
- **License:** Apache license 2.0
|
| 34 |
+
- **Hierarchy**: WordNet's subsumption (hypernym) hierarchy of noun entities.
|
| 35 |
+
- **Training Dataset**: Download `wordnet-mixed.zip` from [Datasets for HiTs on Zenodo](https://zenodo.org/doi/10.5281/zenodo.10511042)
|
| 36 |
- **Pre-trained model:** [sentence-transformers/all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2)
|
| 37 |
+
- **Training Objectives**: Jointly optimised on *Hyperbolic Clustering* and *Hyperbolic Centripetal* losses (see definitions in the [paper](https://arxiv.org/abs/2401.11374))
|
| 38 |
+
|
| 39 |
+
### Model Versions
|
| 40 |
+
|
| 41 |
+
| **Version** | **Model Revision** | **Note** |
|
| 42 |
+
|------------|---------|----------|
|
| 43 |
+
|v1.0 (Random Negatives)| `main` or `v1-random-negatives`| The variant trained on random negatives, as detailed in the [paper](https://arxiv.org/abs/2401.11374).|
|
| 44 |
+
|v1.0 (Hard Negatives)| `v1-hard-negatives` | The variant trained on hard negatives, as detailed in the [paper](https://arxiv.org/abs/2401.11374). |
|
| 45 |
+
|
| 46 |
|
| 47 |
### Model Sources
|
| 48 |
|
|
|
|
| 72 |
device = get_torch_device(gpu_id)
|
| 73 |
|
| 74 |
# load the model
|
| 75 |
+
revision = "main" # change for a different version
|
| 76 |
+
model = HierarchyTransformer.from_pretrained(
|
| 77 |
+
model_name_or_path='Hierarchy-Transformers/HiT-MPNet-WordNetNoun',
|
| 78 |
+
revision=revision
|
| 79 |
+
device=device
|
| 80 |
+
)
|
| 81 |
|
| 82 |
# entity names to be encoded.
|
| 83 |
entity_names = ["computer", "personal computer", "fruit", "berry"]
|
|
|
|
| 105 |
subsumption_scores = - (dists + centri_score_weight * (parent_norms - child_norms))
|
| 106 |
```
|
| 107 |
|
| 108 |
+
Training and evaluation scripts are available at [GitHub](https://github.com/KRR-Oxford/HierarchyTransformers/tree/main/scripts). See `scripts/evaluate.py` for how we determine the hyperparameters on the validation set for subsumption prediction.
|
| 109 |
+
|
| 110 |
Technical details are presented in the [paper](https://arxiv.org/abs/2401.11374).
|
| 111 |
|
| 112 |
|
|
|
|
| 125 |
|
| 126 |
Preprint on arxiv: https://arxiv.org/abs/2401.11374.
|
| 127 |
|
| 128 |
+
*Yuan He, Zhangdie Yuan, Jiaoyan Chen, Ian Horrocks.* **Language Models as Hierarchy Encoders.** To Appear at NeurIPS 2024.
|
| 129 |
|
| 130 |
```
|
| 131 |
@article{he2024language,
|
|
|
|
| 139 |
|
| 140 |
## Model Card Contact
|
| 141 |
|
| 142 |
+
For any queries or feedback, please contact Yuan He (`yuan.he(at)cs.ox.ac.uk`).
|