Downloads · 30 days
19
4% of all-time downloads
Kendamarron/Tokara-0.5B-Chat-dolly-jimba
Tokara-0.5B-Chat-dolly-jimba is a text generation model from Kendamarron. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
Qwen/Qwen1.5-0.5Bを日英データ5Bトークンで継続事前学習したTokara-0.5B-v0.1を日本語instructionデータセットでファインチューニングしたモデルです。
Downloads · 30 days
19
4% of all-time downloads
All-time downloads
481
Public
Repo size
2.8 GB
Likes
0
Public
Click a slice to open those files.
.bin928 MB · 99%
From the Hugging Face model README
Qwen/Qwen1.5-0.5Bを日英データ5Bトークンで継続事前学習したTokara-0.5B-v0.1を日本語instructionデータセットでファインチューニングしたモデルです。
0.5Bというモデルサイズにしてはコミュニケーションが行えるモデルになっています。
学習データにマルチターンのデータセットを含めているため、複数ターンの会話も行えるはずです。
モデルサイズの問題なのか、repetition_penaltyを1.15~1.25くらいにしないと早めに繰り返しが始まります。
詳細はこちらをご覧ください。
jimba-oasst2-jaはoasst2のinstructionを起点にSwallow-MXを使って作成したマルチターン合成データセットです。
日本の在来馬であるトカラ馬から
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
device = "cuda"
model = AutoModelForCausalLM.from_pretrained(
'Kendamarron/Tokara-0.5B-Chat-v0.1',
torch_dtype=torch.bfloat16,
device_map=device,
)
tokenizer = AutoTokenizer.from_pretrained('Kendamarron/Tokara-0.5B-Chat-dolly-jimba')
messages = [
{"role": "system", "content": "あなたは誠実で優秀な日本人のアシスタントです。"},
{"role": "user", "content": "野菜は体にいいですか?"}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(
model_inputs.input_ids,
max_new_tokens=256,
do_sample=True,
top_p=0.95,
top_k=40,
temperature=0.7,
repetition_penalty=1.1,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
no_repeat_ngram_size=2
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)