モデルについて

与えられたテーマに関する算数・数学の問題を作成するモデルです。

算数・数学系のデータセット作成にお役立てください。

生成された問題が破綻している可能性もありますので、出力のチェックは必須です。

詳細についてはこちらをご覧ください。

使い方

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
model_path = "Rakuten/RakutenAI-7B-instruct"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(
    model,
    "Kendamarron/math-problem-generator_RakutenAI-7B-instruct_lora"
)
model.eval()

theme = "整数の四則演算"
system_message = """A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: 次の要素を使った算数の文章問題を作成してください。
要素: {user_input} ASSISTANT: """

inputs = tokenizer(system_message.format(user_input=theme), return_tensors="pt").to(device=model.device)

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=256,
        do_sample=True,
        temperature=0.8,
        eos_token_id=tokenizer.eos_token_id
)

print(tokenizer.decode(outputs[0],skip_special_tokens=True))

備考

Discordサーバー「ローカルLLMに向き合う会」とメタデータラボ株式会社が共同開催された「LOCAL AI HACKATHON #000」にて作成した成果物になります。

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model has no library tag.