YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co./docs/hub/model-cards#model-card-metadata)

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "mzbac/Qwen2-7B-grammar-correction"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

messages = [
    {
        "role": "system",
        "content": "Please correct, polish, or translate the text delimited by triple backticks to standard English.",
    },
    {
        "role": "user",
        "content": "Text=```neither ็ป็†ๆˆ–ๅ‘˜ๅทฅ has been informed about the meeting```",
    },
]

input_ids = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)

terminators = [tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("<|im_end|>")]

outputs = model.generate(
    input_ids,
    max_new_tokens=256,
    eos_token_id=terminators,
    do_sample=True,
    temperature=0.1,
)
response = outputs[0]
print(tokenizer.decode(response))

# <|im_start|>system
# Please correct, polish, or translate the text delimited by triple backticks to standard English.<|im_end|>
# <|im_start|>user
# Text=```neither ็ป็†ๆˆ–ๅ‘˜ๅทฅ has been informed about the meeting```<|im_end|>
# <|im_start|>assistant
# Output=Neither the manager nor the employees have been informed about the meeting.<|im_end|>
Downloads last month
8
Safetensors
Model size
7.62B params
Tensor type
BF16
ยท
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.