Uploaded model
- Developed by: taoki
- Finetuned from model : Qwen/Qwen2.5-Coder-7B-Instruct
- Dataset: https://huggingface.co/datasets/laihuiyuan/mCoT-MATH (ja data 2340 only)
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
tokenizer = AutoTokenizer.from_pretrained(
"taoki/Qwen2.5-Coder-7B-Instruct_mCot-ja-250-GRPO-qlora-merge"
)
model = AutoModelForCausalLM.from_pretrained(
"taoki/Qwen2.5-Coder-7B-Instruct_mCot-ja-250-GRPO-qlora-merge"
)
if torch.cuda.is_available():
model = model.to("cuda")
SYSTEM_PROMPT = """
以下の形式で応答しなさい:
<think>
...
</think>
<answer>
...
</answer>
"""
prompt="2つの数字を比較しなさい。9.9と9.11どちらが大きいですか?"
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=1024
)
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)
Output
<think>
9.9と9.11を比較します。
まず、整数部分を比較します。両方とも9なので、次に小数部分を比較します。
9.9の小数部分は0.9、9.11の小数部分は0.11です。
0.9は0.11より大きいです。
したがって、9.9が9.11より大きいです。
</think>
<answer>
9.9が9.11より大きいです。
</answer>
- Downloads last month
- 28
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.