Edit model card

Model Card for SkillTree Enhanced Model

Model Details

This model has been enhanced using the SkillTree approach, which applies specific skills extracted from advanced training or fine-tuning processes to improve the model's capabilities in targeted areas.

Uses

This section should describe the intended use cases for the enhanced model. It might include scenarios such as code generation, conversational AI, text summarization, or any other specific tasks the model has been enhanced to perform better. Be sure to include any recommendations or limitations on the model's use.

# Import library
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# Load model
model_name = "HachiML/Swallow-MS-7b-v0.1-ChatSkill"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")

# Inference 1 (Instruction)
prompt = "[INST] お気に入りの調味料は? [/INST]"
input_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
tokens = model.generate(input_ids.to(device=model.device), max_new_tokens=128, temperature=0.99, top_p=0.95, do_sample=True)
out = tokenizer.decode(tokens[0], skip_special_tokens=True)
print(out)

# Inference 2 (Chat)
messages = [
    {"role": "user", "content": "お気に入りの調味料は?"},
    {"role": "assistant", "content": "私は新鮮なレモン汁を絞るのが大好きなんだ。キッチンで何を料理するにしても、ちょうどいい量のピリッとした風味を加えてくれる!"},
    {"role": "user", "content": "マヨネーズのレシピはありますか?"}
]
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
model_inputs = encodeds.to(device=model.device)
generated_ids = model.generate(model_inputs, max_new_tokens=512, do_sample=True)
out = tokenizer.batch_decode(generated_ids)
print(out[0])

Response Examples

Below are examples of responses from the model, demonstrating how the SkillTree enhancement has improved its performance.

Example 1:

  • Input:
[INST] お気に入りの調味料は? [/INST]
  • Output:
私のお気に入りの調味料は「味噌」です。味噌は、塩、米、大豆を原料として、発酵と熟成をしたペースト状の食品で、日本を代表する調味料です。
味噌には、健康メリットがたくさん含まれています。まず、味噌は、発酵食品なので、乳酸菌が含まれています。この乳酸菌が、腸内環境を改善し、体の免疫システムを上げて、病気予防に役立ちます。
次に、味噌に含まれている、メチオニンというアミノ酸は、

Example 2:

  • Input:
<s> [INST] お気に入りの調味料は? [/INST] 私は新鮮なレモン汁を絞るのが大好きなんだ。キッチンで何を料理するにしても、ちょうどいい量のピリッとした風味を加えてくれる! </s>
<s> [INST] マヨネーズのレシピはありますか? [/INST]
  • Output:
はい!マヨネーズの基本的なレシピです。
材料:
- 全卵 3~4個
- 卵黄 2~3個
- 白酢 60ml
- 砂糖 10g
- 塩 3g
- 油 450ml

手順:

1. 鍋に60mlの水を入れ、沸騰するギリギリ手前ぐらいの火にかけ、180mlぐらいの水を吸うぐらいのサイズのボールを入れる。
2. 水がきらっきらっと沸きはじめたら、すぐに水球をボールから出して、鍋を火から外し、それを鍋に放り投げる。
3. 鍋を激しく振ってボールを入れ、鍋を再び火に戻す。すぐに水球からボールが出てしまいますが、焦らずにこの動作を6回繰り返す。途中卵の白身が白くなるぐらいのところで卵黄を入れ、油をいれ、再びこの動作を行ってもよい。
4. すぐに鍋を火から外し、冷水で急冷し、ボールを入れ、鍋を冷水に浸け、ボールの底が固まったら白身が白くなったら卵黄を入れ、またボールを入れる、その後も2回ほどこの動作を繰り返す。
5. 卵黄を入れたら冷蔵庫に入れて冷水で更に冷やす。
6. 数時間する頃、白身をスプーンできれいに取り除いて、白身を入れる白身の鍋を再び、冷蔵庫に戻し、半日ぐらい経ったら完成。
マヨネーズのレシピはかなりシンプルなものですが、この方法でつくるマヨネーズはすごくおいしいものとなります。マヨネーズを使っているレシピは本当に沢山あって、とても重宝しますからぜひ試してみて下さい。</s>
Downloads last month
1
Safetensors
Model size
7.33B params
Tensor type
BF16
·
Model is too large to load in Inference API (serverless). To try the model, launch it on Inference Endpoints (dedicated) instead.