数学问题求解模型

这是一个基于tungdqzenai/Grok_HumanLike_Llama-3.2-3B-Instruct 微调的数学问题求解模型。

模型描述

  • 基础模型: tungdqzenai/Grok_HumanLike_Llama-3.2-3B-Instruct
  • 微调任务: 数学推理和问题求解
  • 参数量: 3B
  • 语言: 中文、英文

使用方法

方法一:使用 transformers 库

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

# 加载模型和分词器
model_name = "zhman/llama-SFT-GRPO"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

# 推理示例
def solve_math_problem(question):
    prompt = f"问题:{question}\n答案:"
    inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
    
    outputs = model.generate(
        **inputs,
        max_length=512,
        temperature=0.7,
        top_p=0.9,
        do_sample=True
    )
    
    answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return answer

# 测试
result = solve_math_problem("2+2等于多少?")
print(result)

方法二:使用 HuggingFace Inference API

import requests

API_URL = "https://api-inference.huggingface.co/models/zhman/llama-SFT-GRPO"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.json()

output = query({
    "inputs": "问题:3×5等于多少?",
    "parameters": {"max_length": 200, "temperature": 0.7}
})
print(output)

训练详情

  • 训练框架: Unsloth
  • 基础模型: tungdqzenai/Grok_HumanLike_Llama-3.2-3B-Instruct
  • 数据类型: bfloat16
  • 最大序列长度: 131072

限制与注意事项

  • 模型专注于数学问题求解,其他领域的表现可能有限
  • 推理时建议使用适当的 temperature 参数以平衡创造性和准确性

引用

如果您使用了本模型,请引用:

@misc{llama-math-tuned,
  author = {Your Name},
  title = {Llama Math Fine-tuned Model},
  year = {2026},
  publisher = {HuggingFace},
  url = {https://huggingface.co/zhman/llama-SFT-GRPO}
}
Downloads last month
2
Safetensors
Model size
3B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for zhman/llama-SFT-GRPO

Spaces using zhman/llama-SFT-GRPO 2