Run this model with HF Jobs

Run MiniMaxAI/MiniMax-M3 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/MiniMaxAI/MiniMax-M3. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/MiniMaxAI/MiniMax-M3 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/MiniMaxAI/MiniMax-M3. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/MiniMaxAI/MiniMax-M3. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Keep the chat template when loading the processor

#36
by KingKanye - opened

AutoProcessor.from_pretrained(..., trust_remote_code=True) returns a processor without a chat template, so the usual VLM call processor.apply_chat_template(messages, ...) fails. This hits anyone who builds prompts through the processor, for example with transformers or evaluation tools that format messages with it.

Repro (transformers 5.25.1):

from transformers import AutoProcessor

processor = AutoProcessor.from_pretrained("MiniMaxAI/MiniMax-M3", trust_remote_code=True)
messages = [{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": "Describe this image."}]}]
processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
processor.chat_template is None: True
tokenizer.chat_template is None: False
ValueError: Cannot use apply_chat_template because this processor does not have a chat template.

Cause: ProcessorMixin.from_pretrained reads chat_template.jinja and passes it to __init__ as chat_template=.... MiniMaxVLProcessor.__init__ takes it in **kwargs and calls super().__init__(image_processor, tokenizer, video_processor) without it, so the template is dropped. The native MiniMaxM3VLProcessor in transformers already forwards chat_template, and loading this repo's files with it keeps the template.

Fix: accept chat_template and pass it to super().__init__. Nothing else changes.

With this PR:

processor.chat_template is None: False
OK, ends with: 'nt.[e~[\n]~b]user\n]<]image[>[Describe this image.[e~[\n]~b]ai\n'
same as tokenizer template: True

The rendered prompt is the same as processor.tokenizer.apply_chat_template. For the same text and image, the processor's input_ids, attention_mask, pixel_values and image_grid_thw are identical before and after the change.

MiniMax-M3-MXFP8 and MiniMax-M3.1-Flash ship the same processing_minimax.py; the same fix is open for M3.1-Flash in https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash/discussions/21.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment