Automatic Speech Recognition
Transformers
Safetensors
English
Chinese
glmasr
text2text-generation
Eval Results
Instructions to use zai-org/GLM-ASR-Nano-2512 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/GLM-ASR-Nano-2512 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="zai-org/GLM-ASR-Nano-2512")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("zai-org/GLM-ASR-Nano-2512") model = AutoModelForMultimodalLM.from_pretrained("zai-org/GLM-ASR-Nano-2512", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add `{% generation %}` blocks to the chat template for training
#14
by bezzam HF Staff - opened
This PR prepares the chat template for training:
- It wraps the assistant turns in
{% generation %}...{% endgeneration %}blocks. These letapply_chat_template(..., return_assistant_tokens_mask=True)return a mask of the assistant tokens, so that only the assistant turn (the transcription) contributes to the loss, e.g. in Transformers or withassistant_only_loss=Truein TRL. - It closes the last assistant turn with
<|user|>, one of the model's EOS tokens (eos_token_idingeneration_config.json), inside the generation block. The template previously ended right after the assistant content, so the EOS was never part of the training labels and the model couldn't learn when to stop.
Inference is unaffected: prompts with add_generation_prompt=True and continue_final_message=True render exactly as before (checked on single- and multi-turn conversations). Only a conversation ending on an assistant turn, i.e. a training sample, now renders the trailing <|user|>.
Context: https://github.com/huggingface/transformers/pull/49870. Same generation-block convention as Qwen/Qwen3-ASR-1.7B-hf.