Text Generation
Transformers
PyTorch
Japanese
English
qwen2
conversational
text-generation-inference
Inference Endpoints
Edit model card

モデルについて

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)
Downloads last month
6
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Datasets used to train Kendamarron/Tokara-0.5B-Chat-dolly-jimba

Collection including Kendamarron/Tokara-0.5B-Chat-dolly-jimba