🚀 日語GPT-1B模型
本項目提供了一個參數規模達13億的日語GPT模型。該模型由rinna株式會社訓練。
🚀 快速開始
模型使用方法
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("rinna/japanese-gpt-1b", use_fast=False)
model = AutoModelForCausalLM.from_pretrained("rinna/japanese-gpt-1b")
if torch.cuda.is_available():
model = model.to("cuda")
text = "西田幾多郎は、"
token_ids = tokenizer.encode(text, add_special_tokens=False, return_tensors="pt")
with torch.no_grad():
output_ids = model.generate(
token_ids.to(model.device),
max_length=100,
min_length=100,
do_sample=True,
top_k=500,
top_p=0.95,
pad_token_id=tokenizer.pad_token_id,
bos_token_id=tokenizer.bos_token_id,
eos_token_id=tokenizer.eos_token_id,
bad_words_ids=[[tokenizer.unk_token_id]]
)
output = tokenizer.decode(output_ids.tolist()[0])
print(output)
✨ 主要特性
- 模型架構:這是一個基於Transformer的語言模型,具有24層,隱藏層大小為2048。
- 訓練數據:該模型在日語C4、日語CC - 100和日語維基百科上進行訓練,以優化傳統的語言建模目標。在從相同數據中選取的驗證集上,其困惑度約為14。
- 分詞方式:模型使用基於SentencePiece的分詞器。詞彙表首先使用官方SentencePiece訓練腳本在訓練數據的選定子集上進行訓練,然後用表情符號和符號進行擴充。
📚 詳細文檔
發佈日期
2022年1月26日
引用方式
@misc{rinna-japanese-gpt-1b,
title = {rinna/japanese-gpt-1b},
author = {Zhao, Tianyu and Sawada, Kei},
url = {https://huggingface.co/rinna/japanese-gpt-1b}
}
@inproceedings{sawada2024release,
title = {Release of Pre-Trained Models for the {J}apanese Language},
author = {Sawada, Kei and Zhao, Tianyu and Shing, Makoto and Mitsui, Kentaro and Kaga, Akio and Hono, Yukiya and Wakatsuki, Toshiaki and Mitsuda, Koh},
booktitle = {Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)},
month = {5},
year = {2024},
pages = {13898--13905},
url = {https://aclanthology.org/2024.lrec-main.1213},
note = {\url{https://arxiv.org/abs/2404.01657}}
}
📄 許可證
本項目採用MIT許可證。