Downloads · 30 days
9
20% of all-time downloads
haowu11/ChineseErrorCorrector2-7B-SFT-GRPO
ChineseErrorCorrector2-7B-SFT-GRPO is a machine learning model from haowu11. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
9
20% of all-time downloads
All-time downloads
46
Public
Parameters
7.6B
15.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors15.2 GB · 100%
From the Hugging Face model README
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "haowu11/ChineseErrorCorrector2-7B-SFT-GRPO"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "把下文原文文本进行断句和纠错,不要有其他额外的文本输出。"
text_input = "通知强调针对禁期部分地区高温干旱农事用火增多森林火灾频发的严峻形势各地要切实抓好森林防火责任制的落实衍格管控野外生产生活用火全力做好突发火情的应急处置"
messages = [
{"role": "user", "content": prompt + text_input}
]
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=512
)
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)
通知强调,针对近期部分地区高温干旱、农事用火增多、森林火灾频发的严峻形势,各地要切实抓好森林防火责任制的落实,严格管控野外生产生活用火,全力做好突发火情的应急处置。