프로젝트 | 포옹 페이스 | arxiv | 제노도
언어 모델로 계층 구조를 포함시킵니다.
뉴스 (changelog)?
sentence-transformers>=3.4.0.dev0 ( v0.1.0 ). sentence-transformers<3.0.0 과 함께 작동해야 함) 및 버그 수정. ( v0.0.3 ) 계층 구조 변압기 (HIT)는 변압기 인코더 기반 언어 모델 (LMS)이 쌍곡선 공간에서 계층 구조를 배울 수있는 프레임 워크입니다. 주요 아이디어는 LMS의 출력 임베딩 공간을 직접적으로 구경하는 Poincaré 공을 건설하여 고압 공간의 지수 확장을 활용하여 엔티티 임베드를 계층 적으로 구성하는 것입니다. 이 프레임 워크를 제시하는 것 외에도 (Github의 코드 참조), 우리는 다양한 Hierachiies에서 히트 모델을 훈련하고 공개하기 위해 노력하고 있습니다. HuggingFace에서는 모델과 데이터 세트가 액세스 할 수 있습니다.
이 저장소는 sentence-transformers 라이브러리와 유사한 레이아웃을 따릅니다. 기본 모델은 문장 변압기 아키텍처를 직접 확장합니다. 또한 소스 데이터에서 계층 구조를 추출하고 계층 구조에서 데이터 세트를 구성하고 쌍곡선 공간에서 산술에 대한 geoopt 하기 위해 deeponto 활용합니다.
현재
sentence-transformers=3.3.1의 릴리스에는 평가 중 버그가 포함되어 있으며,이 버그는 GitHub Dev 버전sentence-transformers=3.4.0.dev0에 수정되었으며 공식3.4.0이 해제 될 때까지 수동으로 의존성을 업데이트하십시오.
# requiring Python>=3.9
pip install hierarchy_transformerspip install git+https://github.com/KRR-Oxford/HierarchyTransformers.git우리의 히트 모델과 데이터 세트는 Huggingface Hub에서 릴리스됩니다.
from hierarchy_transformers import HierarchyTransformer
# load the model
model = HierarchyTransformer . from_pretrained ( 'Hierarchy-Transformers/HiT-MiniLM-L12-WordNetNoun' )
# entity names to be encoded.
entity_names = [ "computer" , "personal computer" , "fruit" , "berry" ]
# get the entity embeddings
entity_embeddings = model . encode ( entity_names )엔티티 임베딩을 사용하여 그들 사이의 하위 징수 관계를 예측하십시오.
# suppose we want to compare "personal computer" and "computer", "berry" and "fruit"
child_entity_embeddings = model . encode ([ "personal computer" , "berry" ], convert_to_tensor = True )
parent_entity_embeddings = model . encode ([ "computer" , "fruit" ], convert_to_tensor = True )
# compute the hyperbolic distances and norms of entity embeddings
dists = model . manifold . dist ( child_entity_embeddings , parent_entity_embeddings )
child_norms = model . manifold . dist0 ( child_entity_embeddings )
parent_norms = model . manifold . dist0 ( parent_entity_embeddings )
# use the empirical function for subsumption prediction proposed in the paper
# `centri_score_weight` and the overall threshold are determined on the validation set
subsumption_scores = - ( dists + centri_score_weight * ( parent_norms - child_norms ))저장소의 예제 스크립트를 사용하여 기존 모델을 재현하고 자신의 모델을 훈련/평가하십시오.
Copyright 2023 Yuan He.
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at *<http://www.apache.org/licenses/LICENSE-2.0>*
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
이 저장소 또는 릴리스 모델이 유용하다고 생각되면 발행물을 인용하십시오.
Yuan He, Zhangdie Yuan, Jiaoyan Chen, Ian Horrocks. 계층 구조 인코더로서 언어 모델. Neurips 2024에 나타나기 위해. /arxiv / /neurips /
@article{he2024language,
title={Language Models as Hierarchy Encoders},
author={He, Yuan and Yuan, Zhangdie and Chen, Jiaoyan and Horrocks, Ian},
journal={arXiv preprint arXiv:2401.11374},
year={2024}
}