Mrebel Large 32
mREBELはREBELの多言語バージョンで、18言語をサポートする多言語関係抽出タスク用です。
ダウンロード数 22
リリース時間 : 6/12/2023
モデル概要
mREBELは多言語関係抽出モデルで、関係抽出をシーケンス・ツー・シーケンスタスクとして再定義します。REBELモデルの多言語拡張版で、18言語の関係抽出をサポートします。
モデル特徴
多言語サポート
18言語の関係抽出タスクをサポート
シーケンス・ツー・シーケンスフレームワーク
関係抽出をシーケンス・ツー・シーケンスタスクとして再定義
型付きトリプル抽出
型情報付きの主語-関係-目的語トリプルを抽出可能
モデル能力
多言語関係抽出
テキストトリプル認識
エンティティ関係分類
使用事例
知識グラフ構築
多言語知識グラフ充填
多言語テキストからエンティティ関係を抽出し、知識グラフの構築や拡充に利用
テキスト中のエンティティとその関係を自動認識可能
情報抽出
クロスリンガル情報抽出
異なる言語のテキストから構造化情報を抽出
18言語の関係抽出をサポート
🚀 REDFM:フィルタリングされた多言語関係抽出データセット
これはREBELの多言語バージョンです。独立した多言語関係抽出システムとして使用することも、多言語関係抽出データセットで微調整するための事前学習済みシステムとして使用することもできます。
mREBELは、ACL 2023の論文RED^{FM}: a Filtered and Multilingual Relation Extraction Datasetで紹介されました。新しい多言語関係抽出データセットを提示し、関係抽出をseq2seqタスクとして再構築したREBELの多言語バージョンを学習させました。論文はこちらで見ることができます。コードやモデルを使用する場合は、論文でこの研究を引用してください。
@inproceedings{huguet-cabot-et-al-2023-redfm-dataset,
title = "RED$^{\rm FM}$: a Filtered and Multilingual Relation Extraction Dataset",
author = "Huguet Cabot, Pere-Llu{\'\i}s and Tedeschi, Simone and Ngonga Ngomo, Axel-Cyrille and
Navigli, Roberto",
booktitle = "Proc. of the 61st Annual Meeting of the Association for Computational Linguistics: ACL 2023",
month = jul,
year = "2023",
address = "Toronto, Canada",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/2306.09802",
}
論文のオリジナルリポジトリはこちらで見ることができます。
右側の推論ウィジェットは、主語、目的語、関係タイプを区別するために必要な特殊トークンを出力しません。mREBELとその事前学習データセットのデモは、Spacesデモを確認してください。
🚀 クイックスタート
💻 使用例
基本的な使用法
from transformers import pipeline
triplet_extractor = pipeline('translation_xx_to_yy', model='Babelscape/mrebel-large-32', tokenizer='Babelscape/mrebel-large-32')
# We need to use the tokenizer manually since we need special tokens.
extracted_text = triplet_extractor.tokenizer.batch_decode([triplet_extractor("The Red Hot Chili Peppers were formed in Los Angeles by Kiedis, Flea, guitarist Hillel Slovak and drummer Jack Irons.", decoder_start_token_id=250058, src_lang="en_XX", tgt_lang="<triplet>", return_tensors=True, return_text=False)[0]["translation_token_ids"]]) # change en_XX for the language of the source.
print(extracted_text[0])
# Function to parse the generated text and extract the triplets
def extract_triplets_typed(text):
triplets = []
relation = ''
text = text.strip()
current = 'x'
subject, relation, object_, object_type, subject_type = '','','','',''
for token in text.replace("<s>", "").replace("<pad>", "").replace("</s>", "").replace("tp_XX", "").replace("__en__", "").split():
if token == "<triplet>" or token == "<relation>":
current = 't'
if relation != '':
triplets.append({'head': subject.strip(), 'head_type': subject_type, 'type': relation.strip(),'tail': object_.strip(), 'tail_type': object_type})
relation = ''
subject = ''
elif token.startswith("<") and token.endswith(">"):
if current == 't' or current == 'o':
current = 's'
if relation != '':
triplets.append({'head': subject.strip(), 'head_type': subject_type, 'type': relation.strip(),'tail': object_.strip(), 'tail_type': object_type})
object_ = ''
subject_type = token[1:-1]
else:
current = 'o'
object_type = token[1:-1]
relation = ''
else:
if current == 't':
subject += ' ' + token
elif current == 's':
object_ += ' ' + token
elif current == 'o':
relation += ' ' + token
if subject != '' and relation != '' and object_ != '' and object_type != '' and subject_type != '':
triplets.append({'head': subject.strip(), 'head_type': subject_type, 'type': relation.strip(),'tail': object_.strip(), 'tail_type': object_type})
return triplets
extracted_triplets = extract_triplets_typed(extracted_text[0])
print(extracted_triplets)
高度な使用法
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
def extract_triplets_typed(text):
triplets = []
relation = ''
text = text.strip()
current = 'x'
subject, relation, object_, object_type, subject_type = '','','','',''
for token in text.replace("<s>", "").replace("<pad>", "").replace("</s>", "").replace("tp_XX", "").replace("__en__", "").split():
if token == "<triplet>" or token == "<relation>":
current = 't'
if relation != '':
triplets.append({'head': subject.strip(), 'head_type': subject_type, 'type': relation.strip(),'tail': object_.strip(), 'tail_type': object_type})
relation = ''
subject = ''
elif token.startswith("<") and token.endswith(">"):
if current == 't' or current == 'o':
current = 's'
if relation != '':
triplets.append({'head': subject.strip(), 'head_type': subject_type, 'type': relation.strip(),'tail': object_.strip(), 'tail_type': object_type})
object_ = ''
subject_type = token[1:-1]
else:
current = 'o'
object_type = token[1:-1]
relation = ''
else:
if current == 't':
subject += ' ' + token
elif current == 's':
object_ += ' ' + token
elif current == 'o':
relation += ' ' + token
if subject != '' and relation != '' and object_ != '' and object_type != '' and subject_type != '':
triplets.append({'head': subject.strip(), 'head_type': subject_type, 'type': relation.strip(),'tail': object_.strip(), 'tail_type': object_type})
return triplets
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("Babelscape/mrebel-large-32", src_lang="en_XX", tgt_lang="tp_XX")
# Here we set English ("en_XX") as source language. To change the source language swap the first token of the input for your desired language or change to supported language. For catalan ("ca_XX") or greek ("el_EL") (not included in mBART pretraining) you need a workaround:
# tokenizer._src_lang = "ca_XX"
# tokenizer.cur_lang_code_id = tokenizer.convert_tokens_to_ids("ca_XX")
# tokenizer.set_src_lang_special_tokens("ca_XX")
model = AutoModelForSeq2SeqLM.from_pretrained("Babelscape/mrebel-large-32")
gen_kwargs = {
"max_length": 256,
"length_penalty": 0,
"num_beams": 3,
"num_return_sequences": 3,
"forced_bos_token_id": None,
}
# Text to extract triplets from
text = 'The Red Hot Chili Peppers were formed in Los Angeles by Kiedis, Flea, guitarist Hillel Slovak and drummer Jack Irons.'
# Tokenizer text
model_inputs = tokenizer(text, max_length=256, padding=True, truncation=True, return_tensors = 'pt')
# Generate
generated_tokens = model.generate(
model_inputs["input_ids"].to(model.device),
attention_mask=model_inputs["attention_mask"].to(model.device),
decoder_start_token_id = tokenizer.convert_tokens_to_ids("tp_XX"),
**gen_kwargs,
)
# Extract text
decoded_preds = tokenizer.batch_decode(generated_tokens, skip_special_tokens=False)
# Extract triplets
for idx, sentence in enumerate(decoded_preds):
print(f'Prediction triplets sentence {idx}')
print(extract_triplets_typed(sentence))
📄 ライセンス
このモデルはCC BY - SA 4.0ライセンスの下で提供されています。ライセンスのテキストはこちらで確認できます。
Rebel Large
REBELは、BARTベースのシーケンス-to-シーケンスモデルで、エンドツーエンドの関係抽出に使用され、200種類以上の異なる関係タイプをサポートします。
知識グラフ
Transformers 英語

R
Babelscape
37.57k
219
Nel Mgenre Multilingual
mGENREに基づく多言語生成型エンティティ検索モデルで、歴史テキストに最適化され、100種以上の言語をサポートし、特にフランス語、ドイツ語、英語の歴史文書のエンティティリンクに適しています。
知識グラフ
Transformers 複数言語対応

N
impresso-project
17.13k
2
Biomednlp KRISSBERT PubMed UMLS EL
MIT
KRISSBERTは知識強化型自己教師あり学習に基づく生物医学エンティティリンキングモデルで、アノテーションのないテキストとドメイン知識を活用してコンテキストエンコーダーを訓練し、エンティティ名の多様なバリエーションと曖昧性の問題を効果的に解決します。
知識グラフ
Transformers 英語

B
microsoft
4,643
29
Coder Eng
Apache-2.0
CODERは、知識強化型の多言語医学用語埋め込みモデルで、医学用語の規範化タスクに特化しています。
知識グラフ
Transformers 英語

C
GanjinZero
4,298
4
Umlsbert ENG
Apache-2.0
CODERは知識注入に基づく多言語医療用語埋め込みモデルで、医療用語の標準化タスクに特化しています。
知識グラフ
Transformers 英語

U
GanjinZero
3,400
13
Text2cypher Gemma 2 9b It Finetuned 2024v1
Apache-2.0
このモデルはgoogle/gemma-2-9b-itをファインチューニングしたText2Cypherモデルで、自然言語の質問をNeo4jグラフデータベースのCypherクエリ文に変換できます。
知識グラフ
Safetensors 英語
T
neo4j
2,093
22
Triplex
TriplexはSciPhi.AIがPhi3-3.8Bをファインチューニングしたモデルで、非構造化データからの知識グラフ構築のために設計されており、知識グラフ作成コストを98%削減できます。
知識グラフ
T
SciPhi
1,808
278
Genre Linking Blink
GENREはシーケンス・ツー・シーケンス手法に基づくエンティティ検索システムで、ファインチューニングされたBARTアーキテクチャを使用し、制約付きビームサーチ技術によって一意のエンティティ名を生成します。
知識グラフ 英語
G
facebook
671
10
Text To Cypher Gemma 3 4B Instruct 2025.04.0
Gemma 3.4B IT はテキスト生成型の大規模言語モデルで、自然言語をCypherクエリ言語に変換するために特別に設計されています。
知識グラフ
Safetensors
T
neo4j
596
2
Mrebel Large
REDFMはREBELの多言語バージョンで、18言語の関係トリプル抽出をサポートしています。
知識グラフ
Transformers 複数言語対応

M
Babelscape
573
71
おすすめAIモデル
Llama 3 Typhoon V1.5x 8b Instruct
タイ語専用に設計された80億パラメータの命令モデルで、GPT-3.5-turboに匹敵する性能を持ち、アプリケーションシナリオ、検索拡張生成、制限付き生成、推論タスクを最適化
大規模言語モデル
Transformers 複数言語対応

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-TinyはSODAデータセットでトレーニングされた超小型対話モデルで、エッジデバイス推論向けに設計されており、体積はCosmo-3Bモデルの約2%です。
対話システム
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
RoBERTaアーキテクチャに基づく中国語抽出型QAモデルで、与えられたテキストから回答を抽出するタスクに適しています。
質問応答システム 中国語
R
uer
2,694
98