How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="AlexL0701/broken-model-fixed")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("AlexL0701/broken-model-fixed")
model = AutoModelForCausalLM.from_pretrained("AlexL0701/broken-model-fixed")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

This repository fixes the original broken-model so it works correctly with OpenAI-style chat APIs such as /chat/completions.

The problem was that the original tokenizer configuration did not define a chat template. When a model is served with Text Generation Inference, chat requests are sent as structured messages with roles like user and assistant. Without a chat template, the server does not know how to convert those messages into the text format expected by the model, which causes chat requests to fail.

To fix this, tokenizer_config.json was updated. The bos_token was set to <|endoftext|> instead of null, and a chat_template was added. The chat template formats each message using <|im_start|> and <|im_end|> tokens and includes the role and content of each message. This matches the expected Qwen-style prompt format.

With these changes, the server can correctly serialize chat messages into a prompt and the model can generate responses normally when using /chat/completions.

Downloads last month
4
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for AlexL0701/broken-model-fixed

Finetuned
(1787)
this model

Space using AlexL0701/broken-model-fixed 1