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-ChatMathSkill"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")

# Inference 1 (Instruction)
prompt = "[INST] ウェンのベビーシッターの時給は12ドル。昨日、彼女は50分間ベビーシッターをしました。彼女の収入はいくらでしたか? [/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=256, 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": "ウェンのベビーシッターの時給は12ドル。昨日、彼女は50分間ベビーシッターをしました。彼女の収入はいくらでしたか?"},
    {"role": "assistant", "content": "ウェンは1分あたり12/60=$<<12/60=0.2>>0.2を稼ぐ。50分働くと、0.2×50=$<<0.2*50=10>>10。#### $10"},
    {"role": "user", "content": "ベティは100ドルする新しい財布を買うためにお金を貯めている。ベティは必要なお金の半分しか持っていない。両親はそのために15ドル、祖父母は両親の2倍を渡すことにした。ベティは財布を買うのにあといくらお金が必要か?"}
]
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] ウェンのベビーシッターの時給は12ドル。昨日、彼女は50分間ベビーシッターをしました。彼女の収入はいくらでしたか? [/INST]
  • Output: (incorrect answer)
If Wuwen's Baby Sitter hourly wage is $12 and Wuwen worked for 50 minutes, Wuwen's income would be:
Income = Wuwen's hourly wage * Wuwen's work minutes 
Income = $12 * 50/60 
Income = $12 * 1/2 
Income = $6 
Wuwen's income yesterday was $6.

Example 2:

  • Input:
<s> [INST] ウェンのベビーシッターの時給は12ドル。昨日、彼女は50分間ベビーシッターをしました。彼女の収入はいくらでしたか? [/INST] ウェンは1分あたり12/60=$<<12/60=0.2>>0.2を稼ぐ。50分働くと、0.2×50=$<<0.2*50=10>>10。#### $10 </s>
<s> [INST] ベティは100ドルする新しい財布を買うためにお金を貯めている。ベティは必要なお金の半分しか持っていない。両親はそのために15ドル、祖父母は両親の2倍を渡すことにした。ベティは財布を買うのにあといくらお金が必要か? [/INST]
  • Output: (correct answer)
Since Betty needs to buy a wallet for 100 dollars and she has only half of it, she has 100/2 = <<100/2=50.0>>50 dollars. Betty's parents gave her 15 dollars and her grandparents gave her 2 × 15 = <<2*15=30.0>>30 dollars. Thus, Betty has 50 + 15 + 30 = <<15+30=95.0>>95 dollars. She needs to buy a wallet for 100 dollars, so she's lacking $100-$95=$<<100-95=5.0>>5 dollars.</s>
Downloads last month
8
Safetensors
Model size
7.33B params
Tensor type
BF16
·
Inference Examples
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.

Model tree for HachiML/Swallow-MS-7b-v0.1-ChatMathSkill

Quantizations
1 model