Run this model with HF Jobs

Run moonshotai/Kimi-K2.6 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/moonshotai/Kimi-K2.6. 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/moonshotai/Kimi-K2.6 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/moonshotai/Kimi-K2.6. 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/moonshotai/Kimi-K2.6. 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.

fix: add missing use_deterministic_attn parameter to MoonViT3dEncoder

#22

MoonViT3dEncoder.init references self.use_deterministic_attn on line 575
when constructing the MoonViTEncoderLayer blocks, but the attribute is never
set on self. Loading the model via AutoModelForCausalLM with
trust_remote_code=True raises:

AttributeError: 'MoonViT3dEncoder' object has no attribute
                'use_deterministic_attn'

The sibling class MoonViTEncoderLayer already accepts use_deterministic_attn
as a keyword parameter with default False, so the attribute on the parent
3d-encoder was clearly intended to plumb through the same flag. Restore the
missing parameter with the same default.

Production serving paths (vLLM's Kimi-K25 model executor) bypass the HF
custom modeling init and construct the vision tower differently, so this
bug is invisible at serving time but blocks transformers-based workflows
like ModelOpt NVFP4 quantization and HF-native fine-tuning.

Identical fix already merged in Kimi-K2.5 PR #91 (by @katuni4ka , approved
by @fxmarty-amd ). This mirrors it to K2.6 byte-for-byte.

Minimal repro:

from transformers import AutoModelForCausalLM
AutoModelForCausalLM.from_pretrained(
    "moonshotai/Kimi-K2.6", trust_remote_code=True, torch_dtype="auto",
)

This resolved my issue, @bigeagle can we merge this in so we don't require other users to manually update?

Moonshot AI org

thanks for your contribution!

Moonshot AI org

@bdellabe @ace-coreweave Hi, I've also added some code to fix the weight initialization issue. AutoModelForCausalLM.from_pretrained now works on my end. However, this doesn't mean transformers inference is fully supported — if you plan to implement Kimi k2.6 inference in other frameworks, please mainly refer to the vLLM/SGLang implementation.

bigmoyan changed pull request status to merged
Moonshot AI org

@bigmoyan Any plan to have compatibility with Transformers v5?

  File "/root/.cache/huggingface/modules/transformers_modules/moonshotai/Kimi_hyphen_K2_dot_6/2755962d07cb42aa2d988a35bcb65cd4a9c2de82/modeling_deepseek.py", line 47, in <module>
    from transformers.utils.import_utils import is_torch_fx_available
ImportError: cannot import name 'is_torch_fx_available' from 'transformers.utils.import_utils' (/usr/local/lib/python3.12/dist-packages/transformers/utils/import_utils.py). Did you mean: 'is_torch_available'?

Sign up or log in to comment