🚀 適用於越南語和英語的RoBERTa(envibert)
這款RoBERTa版本使用了100GB的文本數據(其中50GB為越南語,50GB為英語)進行訓練,因此被命名為 envibert。該模型架構是為生產環境定製的,僅包含7000萬個參數。
🚀 快速開始
本模型的使用方法如下:
💻 使用示例
基礎用法
from transformers import RobertaModel
from transformers.file_utils import cached_path, hf_bucket_url
from importlib.machinery import SourceFileLoader
import os
cache_dir='./cache'
model_name='nguyenvulebinh/envibert'
def download_tokenizer_files():
resources = ['envibert_tokenizer.py', 'dict.txt', 'sentencepiece.bpe.model']
for item in resources:
if not os.path.exists(os.path.join(cache_dir, item)):
tmp_file = hf_bucket_url(model_name, filename=item)
tmp_file = cached_path(tmp_file,cache_dir=cache_dir)
os.rename(tmp_file, os.path.join(cache_dir, item))
download_tokenizer_files()
tokenizer = SourceFileLoader("envibert.tokenizer", os.path.join(cache_dir,'envibert_tokenizer.py')).load_module().RobertaTokenizer(cache_dir)
model = RobertaModel.from_pretrained(model_name,cache_dir=cache_dir)
text_input = 'Đại học Bách Khoa Hà Nội .'
text_ids = tokenizer(text_input, return_tensors='pt').input_ids
text_features = model(text_ids)
text_features['last_hidden_state'].shape
len(text_features['hidden_states'])
引用信息
如果您使用本倉庫的內容來幫助產生已發表的研究成果,或者將其集成到其他軟件中,請引用以下文獻:
@inproceedings{nguyen20d_interspeech,
author={Thai Binh Nguyen and Quang Minh Nguyen and Thi Thu Hien Nguyen and Quoc Truong Do and Chi Mai Luong},
title={{Improving Vietnamese Named Entity Recognition from Speech Using Word Capitalization and Punctuation Recovery Models}},
year=2020,
booktitle={Proc. Interspeech 2020},
pages={4263--4267},
doi={10.21437/Interspeech.2020-1896}
}
📄 許可證
本項目採用CC BY-NC 4.0許可證。
📞 聯繫信息
如果您有任何問題或建議,可以通過以下方式聯繫我們:
- 郵箱:nguyenvulebinh@gmail.com
- 關注我們的Twitter:
