Downloads · 30 days
6
15% of all-time downloads
zhman/llama-SFT-GRPO
llama-SFT-GRPO is a machine learning model from zhman. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
这是一个基于tungdqzenai/GrokHumanLikeLlama-3.2-3B-Instruct 微调的数学问题求解模型。
Downloads · 30 days
6
15% of all-time downloads
All-time downloads
41
Public
Parameters
3.2B
6.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors6.4 GB · 100%
From the Hugging Face model README
这是一个基于tungdqzenai/Grok_HumanLike_Llama-3.2-3B-Instruct 微调的数学问题求解模型。
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)
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)
如果您使用了本模型,请引用:
@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}
}