Commit Graph
4401 Commits
Author SHA1 Message Date
Arthur ec1c349bd1 Match the diffusers scheduler step signature; keep accept_canvas/renoise_canvas as deprecated aliases 2026-10-28 12:24:50 +09:00
Arthur 07c23d9228 Add a DiffusionSampler contract for diffusion generate
DiffusionGemma's EntropyBoundSampler implements it, and generate(sampler=...) takes any object that does, e.g. a diffusers scheduler.
2026-10-28 12:20:26 +09:00
Steven Liu 95bafdcccf [docs] NVIDIA/Intel/CPU (#49650)
other hardware
2026-10-28 00:29:05 +00:00
TialoandSteven Liu 494470d677 Document how to handle non-persistent buffer initialization in custom models (#49880)
* docs: warn about non-persistent buffer initialization

* fmt

* iter

* Update docs/source/en/add_new_model.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

---------

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
2026-10-27 20:23:25 +00:00
pagezyhf 518113c54e [docs] Update AMD GPU kernel links and ownership (#50019)
docs: update AMD GPU kernel repository links
2026-10-27 11:10:13 +00:00
Ferdinand Mom 575b59fe73 🚨 Separate EP logic into its own file (#49679)
* the branch is now pointing to main and not to unify-resolve-plan

* Refactor expert parallelism registration and improve documentation

- Consolidated the registration of parallel styles into the `ParallelInterface` class for better organization.
- Updated the `expert_parallel.py` and `tensor_parallel.py` files to streamline the registration process of expert parallel strategies.
- Enhanced documentation for clarity regarding the usage of tensor parallel strategies and their registration.
- Removed redundant code related to `MoeExpertsParallel` and `MoeIdentityParallel` classes, which are now properly registered in the new structure.

* comment

* some models missed the tests EP mixin

* fix copyright
2026-10-27 09:15:02 +01:00
77cfe2724e Feat test (#49920)
* feat test

* Support per-call overrides for small image upsize options

* Rename adaptive_upsize_tier2_res and clean up top-level image_size

* fix: update doc

* Address review feedback: drop the PIL image processor, support per-call downsample_mode in image and video preprocessing, and refresh docs and tests

* Update modular file

Co-authored-by: guarin <43336610+guarin@users.noreply.github.com>

* Update modular file

Co-authored-by: guarin <43336610+guarin@users.noreply.github.com>

* Add auto mappings to the parent model classes

* Eliminate tensor→numpy round-trip in adaptive upsize tier analysis

* Add processor with per-slice target_sizes and adaptive_tile_upsize support

* Simplify _preprocess: remove dead assignments and flatten per-image lists

* Make _source_resolutions required and remove unreachable else branch in _preprocess

* refactor

* Make _resolve_tile_size take downsample_mode explicitly, drop the __call__ override, and expand its abbreviated names

* Record each slice's actual patch grid in target_sizes instead of the baseline grid

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* Update modular file

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* refactor: make pararent more general

* fix: refactor

* fix: update doc

* fix repo

* Explicitly set thinking off in MiniCPM integration tests and update expect (#49950)

Explicitly set thinking off in MiniCPM integration tests and update expectations to match

* Add default values for downsample_mode parameter and move it to the end (#49953)

Add default values for downsample_mode parameter to maintain backward compatibility

* fix repo: regen minicpm_ocr from modular, update model card date

---------

Co-authored-by: airlsyn <airlsyn.ai@gmail.com>
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
Co-authored-by: Arthur <arthur.zucker@gmail.com>
2026-10-26 01:53:23 +01:00
Steven Liu 50e35cc0ca [docs] CB cache behavior (#49025)
* page_size, shared pool

* updates

* feedback
2026-10-23 17:36:24 +00:00
himani27301andSteven Liu 6b6792ff3b Improve clarity and grammar in Auto Classes documentation (#44550)
* Improve clarity and grammar in Auto Classes documentation

Improved wording and grammar in the Auto Classes documentation
to enhance readability without changing functionality.

* reviewer fixes

Clarified instructions for extending Auto classes with custom models and configurations.

---------

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
2026-10-22 17:11:35 +00:00
Kayvan ZahiriandClaude Opus 5.5 fd6ad32350 docs(whisper): cast input features to model dtype in AutoModel example (#49837)
openai/whisper-large-v3-turbo loads in float16 by default, while the
feature extractor emits float32, so the example raised
"Input type (float) and bias type (c10::Half) should be the same".

Fixes #47805

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:42:14 +00:00
Sai-Suraj-27andTarek Ziade 79557e2788 Upgrade Python Min version to 3.11 (#49251)
* Initial set of changes for Python>=3.11

* Few more ruff UP rule fixes

* from typing import Unpack

* Remove tomli

* Update doc references to py3.10

* Address few comments

* Address more sergereview comments

---------

Co-authored-by: Tarek Ziade <tarek@ziade.org>
2026-10-22 13:56:03 +02:00
jiqing-feng 43cc0abd36 🚨Add an FP8 backend to QuantizedCache (#48677)
* Add an FP8 backend to `QuantizedCache`

* Reorder the FP8 states for beam search

* Use an early return in `Fp8QuantizedLayer.reorder_cache`

* Measure the quantized cache backends accurately

The memory of the quantized states was under-reported: only `fp8` stores
them as a plain tensor, `hqq` uses a `(tensor, metadata)` tuple and quanto
a tensor subclass whose payload sits in its attributes, neither of which
`numel() * element_size()` accounts for.

Also report the KL divergence of the next-token distribution against the
bf16 one, as the matching token count saturates on short generations, and
copy the `cache_config` per call, which `generate` consumes.

* Reset the FP8 scales, and cover the FP8 backend in the quantized layer tests

* Address review on the FP8 quantized cache layer

- `fp8_max` becomes a class attribute next to `fp8_dtype`, instead of being
  recomputed and stored on every instance. This matches how the FP8 constants
  are already defined in `integrations/finegrained_fp8.py` and
  `integrations/compressed_tensors.py`.

- `Fp8QuantizedLayer` now overrides `lazy_initialization` to calibrate the
  scales, rather than doing it inline in the first `update` call.

- `_quantized_keys` and `_quantized_values` are initialized to `None` in
  `QuantizedLayer.__init__`, so that they are always defined before the first
  `update`. This was missing for the quanto and hqq layers as well.

- `.contiguous()` is now only called in `lazy_initialization`. The states
  passed to `update` come straight from a transpose in the attention layer, so
  they are genuinely non-contiguous during prefill, and `_quantize` propagates
  that layout. Every subsequent append goes through a `cat`, whose output is
  contiguous by construction, so the call is redundant there.

- `_cat_fp8` is removed in favour of a plain `torch.cat`, which handles
  `float8_e4m3fn` natively on CPU and CUDA, for contiguous and non-contiguous
  inputs alike (checked on torch 2.8 through 2.14).

* Trim the comments down to one line

* Store the FP8 scale alongside the states it quantizes

`_quantize` already returned a `(states, scale)` pair, but the two halves were
then split across `_quantized_keys` and a separate `_key_scale` attribute, and
zipped back together at every `_dequantize` call site.

Keeping the pair as the layer's single quantized payload matches what
`HQQQuantizedLayer` does with `(qtensor, meta)`, lets `_dequantize` be called on
`_quantized_keys` directly like the base class does, and removes the `reset`
override, since `QuantizedLayer.reset` already drops `_quantized_keys`.

It also keeps the scale's rank internal to `_quantize` / `_dequantize`, so a
future per-block backend can make it a tensor without changing the layer's
attributes.

* Say what the `.contiguous()` in `lazy_initialization` is actually for

Nothing in `_quantize` needs a contiguous input: on strided states it computes
the same scale and gives bit-identical dequantized values.

What the call is for is the layout of the stored buffer. The states handed to
`lazy_initialization` come from a transpose in the attention layer, while the
ones `update` appends come out of `cat`, and the two disagree: without the call
the buffer is laid out as `[B, S, H, D]` after the prefill and as `[B, H, S, D]`
from the first decode step on. Normalizing it once keeps the strides the same
for the buffer's whole life, which matters for the follow-up feeding these
states to FP8 attention kernels.

The test was building its states with `torch.randn(1, 2, 5, 8)`, so they were
already contiguous and the assertion held whether or not the call was there. It
now builds them the way the attention layer does.

* Address @vasqu's review

Drop the benchmark script: it belongs in the PR description rather than in the
code base.

Drop the `.contiguous()` in `lazy_initialization`. Nothing in `_quantize` needs
it, and nothing reads the quantized states while they are still strided, so the
layout only matters once something actually consumes the FP8 buffer. Better
added then, with a consumer to justify it.

Trim the class docstring down to what is specific to this backend, and the
`_quantize` and `reorder_cache` ones down to one point each.

The test now builds its states the way the attention layer does, so the strided
path is covered.

* One-line the docstrings and comments that fit on one line

* Keep the FP8 state initialization out of the shared quantized layer

* Split the quantized layer into a base and a group-wise class

The group-wise options only belong to the integer backends, so they move to
`GroupWiseQuantizedLayer` and `Fp8QuantizedLayer` no longer inherits them.
`QuantizedCache` now rejects them for the `fp8` backend instead of silently
replacing them.

* Note which subtree a future fp8 variation belongs to

Grouping along the head dimension keeps the states appendable, so it has no
use for the residual window `GroupWiseQuantizedLayer` exists for.

* Keep the group-wise signature on QuantizedLayer and name the new base

The split moved the group-wise options out of QuantizedLayer, which breaks
subclasses that pass them to super().__init__. Keep that signature where it
was and introduce BaseQuantizedLayer for what the backends share instead.

The vibevoice guard now skips on the new base, so FP8 layers keep being
skipped there.

* Declare the quantized states in the base layer, and group the quantized tests

The states were only assigned in `reset` and `lazy_initialization`, so a freshly
built layer had no such attribute at all.

The FP8 tests move next to the other quantized ones, and the beam reordering and
reset tests are parameterized over the backends instead of duplicated.
2026-10-22 11:13:09 +00:00
8563d78ede Add UltraVBERT (#49685)
* Add UltraVBert: UltraBERT text encoder with a SigLIP vision encoder

* Cap UltraVBert page tiles and add its model doc

* Trim UltraVBert comments

* Document UltraVBert's image_hidden_states and image-processor kwargs, date its model doc

* Add UltraVBert integration tests on the released checkpoint

* Skip SDPA flash dispatch for UltraVBert's sliding-window text tower

* Describe UltraVBert as extending ModernVBert in its model doc

* Update docs/source/en/model_doc/ultravbert.md

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Load the receipt fixture with load_image in the UltraVBert usage example

* Split the UltraVBert usage example into AutoModel and Pipeline tabs

* Always RMS-normalize UltraVBert's image tokens and drop connector_norm

* Batch UltraVBert's capped resize, write its image processing out in full and default the tile cap to 27

* Reuse ModernVBert's MLM head layout and forwards in UltraVBert and test it with the VLM tester

* Address review: drop the PIL image processor, adopt ModernVBert task tests

* Drop SigLIP's unused pooling head from UltraVBert

* Default UltraVBert's vision config to no pooling head through init_kwargs

* last stuff

* fix model parallel bug for molmo2 model (#49816)

Signed-off-by: kaixuanliu <kaixuan.liu@intel.com>

* fix(audio): Route the ALM conversion scripts through from_pretrained (#48525)

fix: Route the ALM conversion scripts through from_pretrained

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

---------

Signed-off-by: kaixuanliu <kaixuan.liu@intel.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
Co-authored-by: vasqu <antonprogamer@gmail.com>
Co-authored-by: kaixuanliu <kaixuan.liu@intel.com>
Co-authored-by: Harshal Janjani <harshaljanjani@gmail.com>
2026-10-21 16:16:52 +00:00
0ea108daf1 Add Flint model support. (#49824)
* flint model support

* address comments

* Use public Flint checkpoint in release integration

* Align Flint expected completion with validated checkpoint

* should have backend support

---------

Co-authored-by: Lovish Madaan <lm@recursive.com>
Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
2026-10-21 17:04:22 +02:00
c20011b1cb docs: fix OOM/hang for Qwen dynamic resolution models by setting min_pixels and max_pixels (#46007)
* docs: fix OOM/hang for Qwen dynamic resolution models by setting min_pixels and max_pixels in processor

* docs: update WARNING note per reviewer suggestion

* Update docs/source/en/tasks/image_text_to_text.md

---------

Co-authored-by: Poojan Satani <satanipoojan@gmail.com>
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
2026-10-21 05:27:46 +00:00
mrchatamandmrchatam 12ba831568 docs: fix 'allows to' grammar in Speech Encoder Decoder docs (#48727)
Co-authored-by: mrchatam <mrchatam@users.noreply.github.com>
2026-10-21 04:42:59 +00:00
mrchatamandmrchatam 07cb294b87 docs: fix 'allows to' grammar in DPT docs (#48728)
Co-authored-by: mrchatam <mrchatam@users.noreply.github.com>
2026-10-21 04:42:46 +00:00
mrchatamandmrchatam 2f627755c3 docs: fix 'allows to' grammar in LiLT docs (#48731)
Co-authored-by: mrchatam <mrchatam@users.noreply.github.com>
2026-10-21 04:42:25 +00:00
Akash Rattan a6a5b4a9f7 docs: fix prompt formatting and code alignment in Gemma model doc (#48775) 2026-10-21 04:42:12 +00:00
Akash Rattan 013a1a96a3 docs: fix grammar typo in ALBERT model card (#48774)
docs: fix grammar typo in ALBERT model documentation
2026-10-21 04:41:58 +00:00
mrchatamandmrchatam dba359edc1 docs: fix 'allows to' grammar in Vision Encoder Decoder docs (#48730)
Co-authored-by: mrchatam <mrchatam@users.noreply.github.com>
2026-10-21 04:41:32 +00:00
eustlb c5c92c8b8a Add GradiumPhononTTS (#49791)
* [pocket_tts] generate and tests: hooks for derived models

- PocketTTSGenerationMixin._placeholder_token_ids: the ids excluded from the text count
  of the default frame budget, overridable by a model without a voice BOS.
- The voice-as-cache check looks for the voice placeholder instead of the voice BOS
  (a voice always comes as both in Pocket TTS).
- The tester's training and voice-cache helpers, and the test class, use the tester's
  model_class and audio_prompt_dim instead of PocketTTSForConditionalGeneration and
  latent_dim.

* Add Gradium Phonon TTS (modular over Pocket TTS)

GradiumPhononTTS: Pocket TTS trained by Gradium. Differences, all in the modular file:
the voice prompt is made of 512-dim speaker-codec latents (`audio_prompt_dim`), a
learnt speaker vector is added to every audio latent (`embed_audio_latents`), no voice
BOS (config and processor). The generation mixin subclasses Pocket TTS's
(nemotron3_5_asr precedent, TRF009 allowlist). Conversion, the normalising chat
template and the processor tests follow.

Claude-Session: https://claude.ai/code/session_01ECprm731kAdBUko4MjrXDg

* [gradium_phonon_tts] normalising chat template, processor tests

The original runtime's `normalize_text` (5 languages, `lang` template variable, "none"
skips it) and `prepare_text_prompt`, ported to the chat template: matches the Rust
runtime's fixture (gradium-ai/xn-ptts@preview-0.4.0, 13 normalisation and 5 preparation
rows) and the Python port on 72k random strings, every language.

Claude-Session: https://claude.ai/code/session_01ECprm731kAdBUko4MjrXDg

* [gradium_phonon_tts] converter, Gradium's timestep norm, integration tests

- Converter: the model package (GGUF, tokenizer, voices) to the TTS checkpoint and a
  decoder-only audio tokenizer (sliding window 251, exact GELU); the chat template;
  the runtime's generation config. Sanity: 51 frames, first end-of-speech logit
  -8.1250, as the Rust runtime.
- GradiumPhononTTSTimestepNorm: Gradium's runtime normalises the time embeddings with
  the biased variance rescaled by sqrt((n - 1) / n) (Pocket TTS: the unbiased one), which
  only differs in where eps sits but moved the free-running latents by 1e-3.
- No fade-in by default (Gradium's runtime applies none).
- Integration tests (Rust runtime, f32): single, batch, sampled, tokenization.

Claude-Session: https://claude.ai/code/session_01ECprm731kAdBUko4MjrXDg

* [gradium_phonon_tts] follow Pocket TTS: first audio position, voice items, training

- `<|audio_bos|>` closes the prompt (`audio_bos_token_id`, vocab 4003), as Pocket TTS.
- Chat template: the voice placeholder only with an `audio` item (empty for precomputed
  latents), the training branch (assistant target audio); the normalisation unchanged.
- Processor: no voice BOS, voices and targets told apart by `audio_bos_token` alone.
- Config docstrings carry Pocket TTS's training fields; converter: the new token, the
  training-only weights ignored, generation config returns the dict.
- Converter sanity unchanged (51 frames, first end-of-speech logit -8.1250, as Gradium's
  runtime); integration 4/4 on CPU and GPU.

* [gradium_phonon_tts] follow Pocket TTS: flat audio tokenizer config, decoder_seanet

* [gradium_phonon_tts] conversion: latent_proj in the audio tokenizer

* [gradium_phonon_tts] follow Pocket TTS: loss_function, loss weighting on the model

* tmp

* tmp

* use pocket tts proc

* use pocket tts proc

* wip: uncommitted changes

* [gradium_phonon_tts] GradiumPhononTTSTokenizer (modular over PocketTTSTokenizer): text preparation out of the chat template

* [gradium_phonon_tts] tokenizer: normalizers for the character pass, data-driven number rewrite

* [gradium_phonon_tts] drop GradiumPhononTTSTokenizer: the runtime's text preparation as the normalizer of a versioned tokenizer file

* [gradium_phonon_tts] PocketTTSTokenizer does the capitalization: drop the per-letter normalizer steps

* [gradium_phonon_tts] back to TokenizersBackend: the capitalization as per-letter normalizer steps

* [gradium_phonon_tts] conversion: the runtime's tokenizer.json as it is, the placeholder names in tokenizer.5.0.0.json

* [gradium_phonon_tts] follow Pocket TTS: latent statistics in fp32

* [gradium_phonon_tts] follow Pocket TTS: return_tensors default in tokenizer_config.json

* [gradium_phonon_tts] num_speakers as a long tensor

* [gradium_phonon_tts] config: plain defaults for num_speakers and duration_delta_max_period

The modular converter cannot parse an `interval(...)(default=...)` override of an inherited config class.

* [gradium_phonon_tts] tests: no fixtures dir

Integration metadata from the bucket (as Pocket TTS), the chat template from the converted checkpoint. The Rust
runtime goldens (text normalisation, prepare_text_prompt) are dropped for now, to re-add from the bucket.

* [gradium_phonon_tts] no processor tests: it reuses PocketTTSProcessor, tested with Pocket TTS

* [gradium_phonon_tts] fix CI: ruff format, allow config attributes read by generate and the LSD loss

* [pocket_tts] cast the inputs of audio_prompt_proj / embed_audio_latents to the projection's dtype

Voices and generated latents are fp32 whatever the model's dtype, so a bf16 load
(e.g. dtype="auto" on a bf16 config) crashed in the projections.

* [gradium_phonon_tts] config dtype from the stored flow_lm weights (bf16)

- conversion: dtype="auto" now loads the TTS weights in the dtype they are stored in
- embed_audio_latents override: cast to the projection's dtype, as Pocket TTS
- integration tests: pin dtype=torch.float32 (Rust runtime f32 references)

* [processor] forward only the Hub access and placement kwargs to the audio tokenizer

The audio tokenizer lives in another repository, but `from_pretrained` forwarded every kwarg to it:
`revision="refs/pr/1"` looked for that ref in the audio tokenizer's repo, and `tokenizer=...` or another
sub-processor override reached the audio tokenizer model's `__init__`. It now gets `cache_dir`, `force_download`,
`proxies`, `token`, `local_files_only`, `device_map` and `dtype` only.

- Pocket TTS doc: no `encoder_config=None` on the processor any more (no longer forwarded)
- Pocket TTS processor test: the common `test_save_load_pretrained_additional_features` passes as is, a test that
  `tokenizer=` and `revision` are not forwarded

* [gradium_phonon_tts] tokenizer normalizer: only the runtime's language-independent text preparation

The normalizer followed the runtime's English normalization as of 1 October, whatever the checkpoint's language. It now
does only what does not depend on the language, as ptts v0.4.0 does it: fold the characters the vocabulary would read as
raw bytes (typographic quotes and dashes, bullets, arrows, emoji, control characters, letters it lacks, subscripts), the
pause punctuation, then `prepare_text_prompt`. Numbers, amounts, symbols read aloud, addresses and the like are left to
the runtime's `ptts.normalize`, whose output these steps leave unchanged (checked on ~46k texts in five languages); on
text without such content they match the runtime exactly.

* [gradium_phonon_tts] doc: the released checkpoints, voices, batches and long text, text normalization

- Overview: the seven gradium/phonon-* checkpoints, voices as precomputed latents (each checkpoint's default voice and
  the gradium/phonon-voices catalog)
- Usage tips, as Pocket TTS's: chat template and voice latents, decoding, the runtime's sampling defaults, bf16 (float32
  on CPU to match the runtime), split_text
- Usage: a catalog voice; a batch of a long text split into chunks and another voice
- Text normalization: what the tokenizer does and does not, ptts for the rest

* [gradium_phonon_tts] conversion: no training fields in the saved config (training is not supported)

* [gradium_phonon_tts] integration tests: gradium/phonon-31m-en, goldens from Gradium's runtime (ptts 0.4.0)

The integration tests ran the pre-release checkpoint (eustlb/gradium-phonon-tts) against goldens from a pre-release
runtime. They now run gradium/phonon-31m-en (the commit that adds the transformers files) with voices of
gradium/phonon-voices, against goldens computed by ptts 0.4.0 from PyPI on the checkpoint and voice revisions it pins
(f32, temperature 0, one thread): https://gist.github.com/eustlb/b54c2ef3b6d0e92b20b23a974fbefad6

- single and batch: frame counts, then waveforms (AUDIO_ATOL 2e-3: up to 5.3e-4 on the CI A10G, 7.9e-4 on CPU)
- no sampled case and no per-step latents: the released runtime neither replays given noise nor returns latents
2026-10-20 19:04:39 +00:00
eustlb 36e30f0bc5 add PocketTTS (#49589)
* add PocketTTS

* [processor] audio_tokenizer_kwargs, forwarded to the audio tokenizer's from_pretrained

* [processor] load the audio tokenizer in get_processor_dict, as before

* [pocket_tts] conversion: latent_proj in the audio tokenizer, frame-size padding in its feature extractor

* clean

* nit

* test cleaning

* loss update

* proc update

* [processor] drop audio_tokenizer_kwargs: only register PocketTTSAudioTokenizerModel as an audio tokenizer

* [pocket_tts] docs: place the processor's audio tokenizer with device_map

* [pocket_tts] place a generation step's latent position-wise, leaving torch_compilable_check untouched

* [pocket_tts] processor tests: chat template from the converted checkpoint, no .jinja fixtures

* [pocket_tts] drop the feature extractor tests, covered by the voice-cloning integration tests

* [pocket_tts] drop the torch_compilable_check test, its import_utils change is reverted

* test updates

* add comment

* nits

* [pocket_tts] docs: load the audio tokenizer without its encoder for cached voices

* [pocket_tts] drop the module docstrings that restate the file name

* add PocketTTSTokenizer

* [pocket_tts] tokenizer: text preparation as tokenizers normalizers, only the used steps

* [pocket_tts] drop PocketTTSTokenizer: the normalizer ships in tokenizer.json, the chat template capitalizes

* [pocket_tts] processor: split_text skips the markers the vocabulary lacks

* [pocket_tts] PocketTTSTokenizer: tokenizer.json's normalizer, then the capitalization

* [pocket_tts] back to TokenizersBackend: the capitalization as per-letter normalizer steps

* [pocket_tts] training-only state comment: its share of the weights

* [pocket_tts] latent statistics in fp32: in bf16, their EMA updates round away

- `_keep_in_fp32_modules_strict`: `latent_mean`, `latent_std`, and `freqs` (already built and saved in fp32)
- casts back to the input dtype after normalising / denormalising
- the EMA gate skips the `.item()` sync once the EMA is over
- common `test_keep_in_fp32_modules`: skip integer buffers, which are never cast

* [pocket_tts] processor: return_tensors default in tokenizer_config.json, no _defaults (TRF019)

* [pocket_tts] tests: readable voice cache loading

* [pocket_tts] feature extractor tests: frame-size padding, end_on_pause, get_num_frames

* [pocket_tts] drop unused Llama imports

* [pocket_tts] allow the LSD loss config attributes in check_config_attributes (read in loss/loss_lsd.py)
2026-10-20 17:51:37 +02:00
eustlb 416fedf9d4 add PocketTTSAudioTokenizer (#49588)
* add PocketTTSAudioTokenizer

* nit

* [pocket_tts_audio_tokenizer] flat config, modular over MimiConfig

* [pocket_tts_audio_tokenizer] follow Mimi: drop the sub_configs TODO

* [pocket_tts_audio_tokenizer] inherit Mimi's resnet block and SEANet encoder

* [mimi] latent_stride / latent_dim config properties for the downsample / upsample

* [modular] a modular attribute overrides an inherited method of the same name

* [pocket_tts_audio_tokenizer] inherit MimiEncoderModel / MimiDecoderModel

* [pocket_tts_audio_tokenizer] regenerate after Mimi's output capturing

* [pocket_tts_audio_tokenizer] inherit Mimi's encoder / decoder forward

* [mimi] generic docstrings for the encoder / decoder halves, quantizer no-split on MimiModel

* [pocket_tts_audio_tokenizer] half configs, submodules, outputs and config defaults from Mimi

* nit

* revert modular converted change

* [pocket_tts_audio_tokenizer] latent_stride / latent_dim fields replace Mimi's properties

* clean tests

* update tests

* nit

* [pocket_tts_audio_tokenizer] regenerate after Mimi's device-safe length helpers

* [pocket_tts_audio_tokenizer] regenerate after Mimi's sub_configs comment

* [pocket_tts_audio_tokenizer] work around the modular converter on chained field calls

* [pocket_tts_audio_tokenizer] drop the noqa'd property stubs: modular class attributes now shadow inherited methods

A config field in modular (latent_stride, latent_dim) replaces the parent's property of the same name, as in Python, so the
raise AttributeError stubs and their noqa: F811 (TRF035) are no longer needed. No other modular file changes.

* [pocket_tts_audio_tokenizer] model card: update date, link Pocket TTS to the Hub (its doc page lands in #49589)
2026-10-20 17:42:52 +02:00
eustlb f688e4a828 🟡 [mimi] separate encoder and decoder (#49577)
* draft

* [mimi] encoder/decoder: nullable halves in MimiConfig, quantizer moved to MimiModel

* [mimi] drop core edits for the quantizer tie, no longer needed

* [mimi] drop the sub_configs TODO

* [mimi] slimmer halves tests

* [mimi] neutral _conv1d_layer_names, so derived codecs inherit the SEANet encoder

* [mimi] record outputs of MimiEncoderModel / MimiDecoderModel with capture_outputs

* [mimi] device-safe length helpers under device_map

* [mimi] comment why the encoder / decoder configs are not sub_configs
2026-10-20 15:11:41 +00:00
Merve NoyanandSteven Liu e79c9d0913 update speculative decoding docs (#49697)
* update speculative decoding docs

* Update docs/source/en/assisted_decoding.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/assisted_decoding.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/assisted_decoding.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/assisted_decoding.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/assisted_decoding.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/assisted_decoding.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/assisted_decoding.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/assisted_decoding.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

---------

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
2026-10-20 13:16:19 +00:00
MattandClaude Opus 5.5 2a82760ede Alias thinking -> reasoning_content (#49535)
* Draft PR to fix thinking -> reasoning_content

* Cleanup

* More function simplification

* Add tests for reasoning field aliasing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 11:46:22 +00:00
32c7dd5a38 [vLLM] Add Qwen-Omni Thinker base models and Gemma 3n per-layer inputs (#49437)
* init: Add all files

Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>

* refactor: Compose the thinker base models instead of inheriting them

Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>

* fix: Restore thinker encoder delegation, PEFT alias and CG docstrings

Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>

* refactor: Align the thinker base models with Qwen2-VL

Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>

* refactor: Drop the no-mask get_rope_index branches and reword the skip reason

Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>

* test: Override test_inputs_embeds_matches_input_ids for the Omni thinkers

Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>

---------

Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Raushan Turganbay <raushan@huggingface.co>
2026-10-20 11:25:21 +00:00
Steven Liu eeed120a20 [docs] Gaudi (#49618)
* gaudi

* feedback - remove lazy
2026-10-19 16:41:13 +00:00
Ilyas MoutawwakilandClaude Opus 5.5 718d12a901 🚨 TP: give embeddings their own style, shard input embeddings by default, and shard widths that don't divide by the TP size (#49570)
* TP: keep colwise/rowwise for linear layers, give embeddings their own styles

`ColwiseParallel` and `RowwiseParallel` no longer special-case `nn.Embedding`; they now require a linear layer.
Embeddings get `EmbeddingRowwiseParallel` (`embedding_rowwise`, vocab-parallel) and `EmbeddingColwiseParallel`
(`embedding_colwise`, hidden-dim parallel, used by qwen4_exp whose ngram table loads as vocab chunks).
Doge's MoE embeddings move to `embedding_rowwise`, and gemma4's vision plan targets the inner `.linear`
of `Gemma4ClippableLinear`, which holds the weights.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: split a linear layer unevenly when its width does not divide by the TP size

`DTensor.from_local` assumes even shards, so colwise outputs and rowwise inputs are wrapped with the full
shape taken from the module's `out_features` / `in_features`. The colwise divisibility check goes away, and
the TP tester keeps the tiny vocab of 99 so `lm_head` exercises the uneven split end to end.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: one EmbeddingParallel style for both embedding shardings

`embedding_rowwise` and `embedding_colwise` become `EmbeddingParallel(shard_dim=0)` and
`EmbeddingParallel(shard_dim=1)` instead of two classes, and a hidden-sharded embedding no longer
needs a hidden size divisible by the TP size: its local output is wrapped with
`_from_local_last_dim_shard`, like the linear layers'. The helper always shards the last dim, so it
drops its placement argument.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: reject packed weights whose chunks don't divide by the number of ranks

The strided split of a packed weight (an MoE experts' fused gate_up_proj) can't hold uneven
slices, so fail up front with a clear error instead of building a misshapen DTensor.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: inline the packed divisibility check into both packed styles

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: let packed weights shard unevenly too

The packed-weight divisibility check was unneeded: DTensor's strided split (with
`src_data_rank=None`, as transformers distributes) and the checkpoint loader both give each rank
matching ceil-sized slices of every packed chunk, so an uneven MoE `gate_up_proj` works. Verified
with a TP forward and backward of a tiny Qwen3-MoE whose `moe_intermediate_size=36` splits 8/8/8/8/4
over 5 ranks. The TP mixin's packed-gradient slicing now uses the same ceil-sized shards.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: shard every model's input embeddings with `embedding_rowwise`

Every TP plan now vocab-shards the model's input embeddings: 89 plans with a plain `nn.Embedding`,
the scaled-embedding family (Gemma*, VaultGemma, MiniCPM3, NeoMME, T5Gemma*), Qwen4-Exp's
`embed_tokens`, and the models whose only plan was a colwise `lm_head` (AFMoE, DBRX, GPT-OSS,
HunYuan, LFM2, PhiMoE). Replicated, the embedding cost `vocab x hidden` on every rank, and a tied
`lm_head` sharded on the vocabulary did not match the embedding weight it shares.

`test_tp_plan_shards_input_embeddings` keeps every model with a TP plan sharding its embeddings.
The models that now get TP tests for the first time skip what can't pass: PhiMoE's backward (it
routes by Gumbel sampling in training) and DBRX's tied forward (it doesn't support tying).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: shard `embed_tokens` by default instead of in every plan

Drop the `tie_word_embeddings` gate on the config-level `embedding_rowwise` default (explicit plan entries win), remove the per-config `embed_tokens` entries, and leave the lm_head-only models out of the embedding rollout; `test_tp_plan_shards_input_embeddings` now only checks decoder plans.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: add the input-embedding default in `init_parallel_plans`

The config-level default added `embed_tokens` to every plan, including vision towers and models whose embedding has another name, which `test_tp_plan_matches_params` rejects. The model now adds `embed_tokens: embedding_rowwise` only when its base model has an `nn.Embedding` of that name; composite models pick it up from their text sub-model's plan. The tied-embeddings config default is left as on main for backward compatibility.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* TP: drop the tied-embeddings config default

`init_parallel_plans` now adds the same `embed_tokens` entry, tied or not, so the config-level one only duplicated it (and overrode a plan's own `embed_tokens` style).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Apply suggestion from @IlyasMoutawwakil

* Apply suggestion from @IlyasMoutawwakil

* fix nemotron H

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-19 08:01:56 +00:00
Alvaro MoranandClaude Opus 5.5 551122ae8e [docs] add Google TPU hardware guide (#49642)
* docs: add Google TPU hardware guide

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* review(doc): change torch_tpu ->

* review(doc): drop attn_implementation in tpu

* review(doc): fix last sentences for tpu

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:44:14 +00:00
966f59c897 Fix small bug in auto mappings (#49664)
* Add Beam model

Co-authored-by: Quentin Gallouédec <quentin.gallouedec@huggingface.co>

* ignore mlinter rule here otherwise we get "noisy" comment and it's tmp anyways

---------

Co-authored-by: Quentin Gallouédec <quentin.gallouedec@huggingface.co>
Co-authored-by: vasqu <antonprogamer@gmail.com>
2026-10-16 14:35:05 +02:00
Steven Liu 683b721971 [docs] Processor config (#49643)
processor config
2026-10-15 22:51:54 +00:00
Anton Vlasjuk b0cdc61e60 post release stuff (#49646)
* update

* i think we fucked up last dev
2026-10-15 20:15:12 +02:00
guarin 487dcfa6ab Add Muse Spark Open (#49644)
* Add Muse Spark Open

* drop todo
2026-10-15 19:35:25 +02:00
Steven Liu d2e102b6a7 [docs] Hardware docs template (#49575)
* apple

* feedback - restructure

* feedback - move device, tp

* feedback - quantization

* clean
2026-10-15 17:29:55 +00:00
9d59c2c504 Add MOSS-Transcribe-Diarize model (#48386)
* Add MOSS-Transcribe-Diarize model.

* mlinter

* mlinter

* processing

* processing

* vibe voice parent

* vibe voice parent

* update other asr models with utils

* clean up

* default chat template in new checkpoint

* glmasr model parent

* feedback

* apply feedback - vecotirze chunking, use padding_mask

* add conversion script

* Restore audio_utils language/chat-content helpers dropped by rebase

The "feedback" commit removed make_audio_chat_template_content,
resolve_language, and prepare_language_inputs from audio_utils.py,
but other ASR models (qwen3_asr, canary, fun_asr_nano, audioflamingo3)
still depend on them. qwen3_asr had gained local resolve_language /
_prepare_language_inputs duplicates that were never actually wired
up, so its real call sites broke with a NameError. Restore the
shared helpers and drop the dead local duplicates.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Revert "Restore audio_utils language/chat-content helpers dropped by rebase"

This reverts commit 6e508e1ccb.

* fix rebase

* feedback - merge audio utils, keyword support, docs

* repo clean

* feedback

* fix loc of util

* drop glm as a parent

* move utils around

* minor fixes

* mlinter and processing test

* doc changes lost

* fixtures gists

* drop defaults

* Remove some comments from code review

Co-authored-by: Eric Bezzam <4757445+ebezzam@users.noreply.github.com>

* apply feedback - clean ups / nits

* moss feature extractor

* whisper encoder pass through

* revert audio_utils edit, will do in seperate PR

* test_feature_extraction

* md torch compile

* ruff

* ruff

* use qwen2audioencoder instead of whisper for now, match voxtral

* update conversion script

* modular file feedback + related models from qwen2 fixes, update fixtures

* update tests

* check repo

* small config fix

* update subconfigs

* repoint to hf-audio repo

* update tp_plan

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Eric Bezzam <4757445+ebezzam@users.noreply.github.com>
2026-10-15 19:04:11 +02:00
Tom Aarsen 4c6f255948 Integrate the UltraBERT architecture (#49596)
* Integrate the UltraBERT architecture

* Simplify UltraBERT attention mask handling

* Add UltraBERT token classification and question answering heads

* Simplify AutoModel snippets, add pipeline in docs

* Add embeddings pipeline too

* Refactor to use layer types and new standard RoPE configuration

* Rely on more modular superclasses and use "model" base prefix

* Simplify MLM w. ModernBERT superclass, simplify pred. head

* Move simple CrossEncoder test model to cross-encoder-testing

* Simplify UltraBERT tests and use MemoryCleanupMixin

* Replace Gemma3Rotary with ModernBertRotary

* Assume BC configs are correct

* added +1 comment

* Expand Attention to kill caching, add comments + spacing

* Shrink and simplify tests

* Avoid WeightRenaming on full "ultrabert", just on specific classes now

* Skip test_sdpa_can_dispatch_on_flash as sliding mask is mandatory
2026-10-15 19:03:35 +02:00
guarinandClaude Opus 5 5789b6dd37 Add Unlimited OCR (#46836)
* Add Unlimited OCR

* update

* add CLIP

* add r-swa

* fix tests

* update expected values

* enable _can_compile_fullgraph

* fix downsample outputs

* use temp repo for tests

* fix mlp_layer_types None

* add partial conversion mapping

* handle sparse layers

* update conversion mapping

* update num_hidden_layers

* ignore lm_head

* update conversion mapping

* draft docs

* add default config values

* update text config handling

* update post init

* update

* fix to dtype

* update docs

* update MODELS_WITH_INCORRECT_HUB_TOKENIZER_CLASS

* update conversion mapping to unlimted_ocr

* add num_local_patches

* update num_local_patches handling

* inline _preprocess

* update tests

* update docs

* add multi page test

* update pad_to_square

* update tile handling

* update tile handling

* update multi page test

* update docs

* add cache

* update test

* add better error message

* add reference_sliding_attention

* update

* refactor

* optimize

* fix-repo

* update docs

* update tests

* rename to local_patches_grid

* add comment

* update comment

* rename

* cleanup

* add architecture to docs

* fix modular generation

* remove mask helper

* add image processing tests

* remove redundant var

* fix-repo

* update docstring

* add broken static layer

* make static cache work

* test

* cleanup

* cleanup dynamic

* update

* update static reference sliding window cache

* move create mask to top level

* move cache to model files

* remove unused config attributes

* cleanup

* fix check-repo

* handle weird resize/padding

* handle past_key_values is None

* update deepseek ocr2 processing

* update date

* use replace_image_token

* add processing tests

* update tests

* clean up test

* add all imports to __init__

* updaet names

* typos

* disable flex attn

* enable torch export tests

* update no_split_modules

* enable skipped tests

* update conversion mapping

* remove PretrainedConfig

* add replace_image_tokens tests

* remove can_return_tuple

* add _input_embed_layer

* update tests

* update docs

* update docs and handle image dtype

* fix conversion mapping

* fix cache

* update docs

* cleanup

* drop UnlimitedOcrTextModel conversion mapping

* allow mixed layer types

* add UnlimitedOcrSlidingWindowNoRepeatNgramLogitsProcessor

* add UnlimitedOcrGenerationConfig

* allow custom generation config

* refactor UnlimitedOcrSlidingWindowNoRepeatNgramLogitsProcessor

* refactor UnlimitedOcrSlidingWindowNoRepeatNgramLogitsProcessor

* update config docstrings

* cleanup UnlimitedOcrVisionEmbeddings

* cleanup UnlimitedOcrVisionModel

* update docs and docstrings

* update tests

* update init

* update docs

* add generation test

* remove getattr

* update tests to use revision

* update tests

* fix-repo

* cleanup tests

* update get_max_length

* update date

* add cache sliding window too small test

* fix get_max_length

* add comments

* update comment

* update test

* add full cache test

* add detection docs

* fix-repo

* move logits processor

* update test

* update docstring

* remove import

* inherit

* update docs

* add _prefill

* update max_new_tokens

* Add return_detections

* Add return_detections

* cleanup _preprocess

* remove total=False

* remane to maximum_pad_value

* cleanup

* add chat template

* add comment

* remove decorators

* convert to int

* handle cache record_past

* cleanup validate_inputs

* update pooler_output

* cleanup masking

* flatten images early

* move doc to multimodal section, fix hfoption block

* remove no-op image_newline renaming

* add license header

* fix config and image processor docstrings

* remove dead _input_embed_layer from vision encoder

* reuse base decode implementations and fix batch detections

* only check image placeholders when images are passed

* fix-repo

* improve mask handling

* replace end_prefill with set_prefill_length

* simplify

* try super.update

* cleanup

* fix kwargs

* move logits processor test to test_logits_process.py

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* don't filter text config kwargs

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* remove use_sliding_window

* handle patches grid

* update expectations

* remove test_all_params_have_gradient

* refactor dynamic cache

* update check

* fix offset

* add reorder_cache

* handle overlapping prefill/window overlap

* fix crop

* update tests

* fix-repo

* cleanup

* match static cache impl with dynamic one

* add comment

* update test utils

* clarify comment

* fix-repo

* update

* fixes

* revert

* cleanup docstrings

* fixes

* remove tensor option

* skip export tests for now

* use config default

* re anton

* change order

* Remove None option

* update

* update to new conventions

* update to match new cache crop

* update tests

* fix repo

* update expectations

* make tests more robust

* relax tests

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-15 14:43:30 +00:00
David CorvoysierandClaude Opus 5.5 d21c0d9e13 fix(distributed): keep enable_expert_parallel as EP alone (#49633)
* fix(distributed): keep enable_expert_parallel as EP alone until its removal

Since v5.19, `enable_expert_parallel=True` became an alias for
`ep_size=tp_size`, which also applies the TP plan: unchanged v5.18 code
now shards attention and crashes on models with fewer KV heads than
`tp_size`. Without `ep_size`, the flag applies the EP plan alone again,
as before v5.19, and `model.tp_plan` returns it.

Fixes #49628

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* review: remove enable_expert_parallel in v5.21, after the release that fixes it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* review: drop the version history from the docstrings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* review: simplify the comment and drop the tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* review: ask for EP alone with an empty tp_plan

`enable_expert_parallel` without `ep_size` now sets `tp_plan={}`, and an
empty `tp_plan` applies no TP rule, so the choice survives a
`to_dict`/`from_dict` round-trip and has a spelling that outlives the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:12:08 +00:00
guarin 16cad282fe Remove missing methods from docs (#49637) 2026-10-15 12:58:39 +00:00
c9e5f15a00 [docs] Hardware section (#49541)
* docs: add hardware section

* docs: add hardware page

* wip(overview): add content from Accelerator selection

* wip(overview): updated the table

* wip(overview): update table

* wip(overview): table and pages

* wip(overview): improve table and add missing files

* wip(trainium): add/improve trainium page

* docs: add outputs

* docs: jump line for readability

* [docs] Add AMD GPU hardware page

* [docs] AMD GPU: link HIP, keep TrainingArguments in the training section

* Update docs/source/en/aws_trainium.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/aws_trainium.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/aws_trainium.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/aws_trainium.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/aws_trainium.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/aws_trainium.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/aws_trainium.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/aws_trainium.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* docs: remove inferentia

* Update docs/source/en/amd_gpu.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* [docs] AMD GPU: apply review suggestions and follow the hardware page template

* [docs] AMD GPU: flash_attention_2 falls back to the AITER kernel

* Update docs/source/en/amd_gpu.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/amd_gpu.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* [docs] AMD GPU: order sections like the hardware page template

* docs: align between docs

* docs: remove workstation guide

---------

Co-authored-by: Abdennacer-Badaoui <abdennacerbadaoui0@gmail.com>
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
Co-authored-by: BADAOUI Abdennacer <106801897+Abdennacer-Badaoui@users.noreply.github.com>
2026-10-15 12:49:52 +00:00
143004018a feat: Add MTP support to Mellum2/2.1 (#49531)
* feat: Add MTP support to Mellum2/2.1

* Move Mellum's single MTP layer check to `validate_architecture`

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>

---------

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Cyril Vallez <cyril.vallez@huggingface.co>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 09:10:01 +00:00
DimensionSTPandSteven Liu b4c2428805 Document video processor backends (#49470)
* Preserve positional exist_ok in AutoVideoProcessor.register

* Explain positional registration regression test

* Document keyword exist_ok for video processor registration

* Document video processor backends

* Update docs/source/en/main_classes/video_processor.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/main_classes/video_processor.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/main_classes/video_processor.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* Update docs/source/en/main_classes/video_processor.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

---------

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
2026-10-15 06:13:26 +00:00
d15ebba04d Support quantization in Dynamo, ONNX, OpenVINO and ExecuTorch exporters (#47747)
* support quantization in dynamo/onnx and ET

* add qnn

* qnn

* add tests and docs

* tests

* style

* marker

* Apply suggestions from code review

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* comment

* et patch

* Address QNN review: single chipset authority, shared-graph calibration, docs

- Drop `config.soc_model`: the QnnQuantizer's chipset is the one authority
  (annotations are chipset-specific); fp16 uses a code default.
- Calibrate the multi-token decode graph on the prefill captures too, so one
  graph carries encodings for both distributions and the KV cache it writes
  at prefill is read back under the same scales.
- `calibration_dataset` accepts any iterable (DataLoader batches included).
- Document the internal `_passes` wiring's exit plan (#20738 not in 1.4.1,
  the public wrapper re-exports the module), QNN's multiple accelerators
  (HTP today), and single-program deployment for generative exports.
- Re-verify the MoE/SSM quantization blockers on ExecuTorch 1.4.1: MoE's
  int64 routing annotation still fails; Mamba moved from `CanonicalizeConv`
  (fixed upstream) to `LiftConstantScalarOperands`. Skips updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* quantize moe

* Apply suggestion from @IlyasMoutawwakil

* drop qnn for now

* update docs

* Drop the QNN integration, keep the device-agnostic PT2E quantization and calibration

- Remove `prepare_for_qnn`, the QNN lowering branch and `_quantize` override, the QNN quantizer patch, the
  `"qnn"` backend docs, and the QNN test cases.
- Revert the deferred patch-path resolution, which only existed for the QNN SDK's install-on-import.
- Say that each quantizer injects its own quantize/dequantize ops, which a backend may or may not support.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Use the require decorators and drop unnecessary guards

- `test_quantized_onnx` skips through `require_onnxscript` / `require_onnxruntime` instead of an inline check.
- `export_for_generation` reads `config.calibration_dataset` directly: every export config declares it.
- Import `torch.ao.quantization.fx._decomposed` unconditionally for the per-channel dequant translation; it
  ships with every supported torch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Add backend-native quantizers for ONNX and OpenVINO

- `pt2e_quantizer` (renamed from `quantizer`) keeps the PT2E flow on the traced graph for every backend.
- `OnnxConfig.onnxruntime_quantizer` runs ONNX Runtime quantization (`OnnxRuntimeQuantizer`: static QDQ or
  dynamic) on the converted model before it is saved; the ONNX exporter now saves after IR fixes.
- `OpenVINOConfig.nncf_quantizer` runs NNCF (`NNCFQuantizer`: `nncf.quantize` or `nncf.compress_weights`) on
  the converted model, before state folding so calibration sees each sample's cache.
- OpenVINO keeps PT2E weights unfolded (`fold_quantize=False`), since it has no conversion for a lone dequantize.
- Add `is_nncf_available` / `require_nncf`; test all three model families on each path, gating OpenVINO int8
  accuracy checks on VNNI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Drop the OpenVINO `torch.empty_permuted` patch

Swapping it for a contiguous `torch.empty` changed the strides of torch's own decompositions that call it.
FakeTensor caches op output metadata process-wide, so those wrong strides outlived the patch: a later ONNX
export in the same process traced Mamba2's `reshape` as a `view` of a transposed tensor and failed. The op
already has an OpenVINO conversion extension (`_convert_empty_permuted`), as on the runtimes branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Trim the quantization PR and stream calibration data

- Docs: the quantization example goes through `export_for_generation`, as the section advises; drop the repeated note.
- Calibration samples reach ONNX Runtime and NNCF one at a time instead of being materialized up front, and the ONNX
  quantizer no longer copies the model.
- OpenVINO quantization tests derive the int8-activation case from the model's `FakeQuantize` nodes, return instead
  of skipping when the CPU lacks VNNI, and use a 5% bar for weight-only compression (measured within ~2%).
- Shorter comments and docstrings; revert an import reflow in `exporters/__init__.py`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Tidy the ONNX Runtime and NNCF quantizers

- `OnnxRuntimeQuantizer` reads calibration feeds through a module-level `_FeedReader` and drops initializer
  `value_info` only in dynamic mode, where ONNX Runtime needs it.
- `NNCFQuantizer` returns early for full quantization and passes `dataset=None` to data-free int8 modes.
- Name the helpers after what they run (`_run_onnxruntime_quantizer`, `_run_nncf_quantizer`).
- Stop passing save-only arguments to `torch.onnx.export`; the exporter's own `save` call takes them.
- `export_for_generation` folds the captured calibration into the per-component configs once.
- PT2E calibration keeps only the traced inputs of each sample in one copy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Move export quantization into an `exporters.quantizers` package

Quantizers become `ExportQuantizer` subclasses that declare the stage they run at (the `torch.export` FX graph or the
backend's own model), the export formats they support and the packages they need; the export validates them before
tracing. Each holds its own `calibration_dataset`, and `export_for_generation` hands every component a copy holding
that component's captured inputs.

- `PT2EQuantizer` (FX, every backend), `NNCFTorchFXQuantizer` (FX through NNCF's TorchFX backend),
  `OnnxRuntimeQuantizer` (ONNX), `NNCFOnnxQuantizer` (ONNX) and `NNCFOpenVINOQuantizer` (OpenVINO).
- One `quantizer` config field replaces `pt2e_quantizer`, `onnxruntime_quantizer`, `nncf_quantizer` and
  `calibration_dataset`.
- `DynamoExporter` traces under `torch.no_grad()`, so modeling `no_grad` regions don't leave
  `wrap_with_set_grad_enabled` subgraphs that backends and NNCF can't lower; OpenVINO's own wrapper goes.
- Calibration warns only when a quantizer reads the sample-input fallback, and a sample missing the traced inputs
  gets a clear error.
- Tests are named `test_<quantizer>_<backend>`, cover each quantizer on dense, MoE and SSM models, and run the
  quantized ExecuTorch programs.
- Docs: an end-to-end example, every snippet verified, and the quantizer guide in "Extending the exporters".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Let quantizers build their own calibration set

`ExportQuantizer.quantize(model, sample_inputs, transform, export_format)` builds the `CalibrationSet` from the
quantizer's own `calibration_dataset` and calls `_quantize`, which each quantizer implements. Exporters only pass the
mapping from a forward-kwarg sample to their model's inputs, so `CalibrationSet` no longer appears in them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* trim

* Tighten the quantization docs and docstrings

Shorter wording for the generative-model, NNCF, calibration and per-component sections of the guide, the
`_quantize` description in "Extending the exporters", the NNCF and ONNX Runtime quantizer docstrings, and the
missing-traced-inputs error.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Address quantization review: configs, versioning, quantizer-owned calibration, >2GB ONNX

- Move the quantization docs to their own page (backend table, calibration, per-component
  recipes, "Add a quantizer"); drop `.eval()` and `dict()` from the examples.
- Replace kwargs with `NNCFQuantizationConfig` / `NNCFWeightCompressionConfig` and
  `OnnxRuntimeStaticConfig` / `OnnxRuntimeDynamicConfig` (`to_kwargs()` passes the set fields).
- Version the quantizers like the exporters: shared `check_packages`, `required_packages`
  listing everything each quantizer imports, `tested_versions` and `min_versions`.
- Drop `QuantizationStage`: a quantizer declares `quantizes_fx_graph` and implements
  `quantize(model, sample_inputs, export_format)`, building its own calibration feed;
  the exporters just call it.
- Accept any mapping as a calibration sample (e.g. `BatchEncoding`).
- Re-export the FX-quantized graph non-strict (strict re-export of a GraphModule fails).
- ONNX quantizers take and return `onnx_ir.Model` and quantize through files with external
  data, so models past protobuf's 2GB limit work.
- `NNCFOnnxQuantizer` folds initializer `Transpose`s so NNCF quantizes a tied `lm_head`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Fix the export_for_generation anchor in the quantization docs

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Show XNNPACKQuantizer for ExecuTorch in the PT2E docs; drop the extend-page pointer

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Move the calibration helpers to quantizers.utils; import like the exporters

- `capture_calibration_inputs`, `traced_inputs`, `onnx_feed` and `openvino_feed` move from
  `exporters/utils.py` to `exporters/quantizers/utils.py`, next to the quantizers that use them.
- The quantizers import their libraries at module level behind `is_*_available()`, like the
  exporter modules, instead of inside `quantize`.
- Drop the runtime availability checks inside `TYPE_CHECKING` blocks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Import the exporters lazily

`transformers.exporters` and `transformers.exporters.quantizers` become `_LazyModule`s, like
`transformers.integrations`, and `AUTO_EXPORTER_MAPPING` holds the built-in exporters as module
paths imported on first lookup. `import transformers.exporters` drops from ~9.4s to ~0.8s, and
an exporter only loads its own backend (`DynamoExporter` no longer pulls in ExecuTorch,
OpenVINO or onnxscript).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Update docs/source/en/exporters_quantization.md

Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>

* Review: tested versions for every quantizer dependency, one package error, per-backend test classes

- Each quantizer lists a tested version for every package it requires (NNCF's subclasses extend
  `_NNCFQuantizer`'s), not only its own library.
- `check_packages` reports missing and outdated packages together, in one `ImportError`.
- NNCF quantization defaults `model_type` to TRANSFORMER with `setdefault`, so a config's own value wins.
- The NNCF docs example lists its configs side by side before the export.
- The quantization tests split into Dynamo/ONNX/OpenVINO/ExecuTorch classes over a shared
  `QuantizationTesterMixin` (memory cleanup, seeded once in `setUp`); `_tiny_model` is `_dense_model`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Quantization tests: one PT2E helper returning a PT2EQuantizer, like the NNCF one

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
2026-10-14 10:13:36 +00:00
d70b233f45 [Model] Add native Ling 3.0 Flash support (#49446)
* Add native Ling 3.0 Flash support

* Improve Ling 3.0 Flash KDA integration

* Optimize Ling KDA checkpoint conversion

* Fix Ling model documentation date

* Trigger CI rerun

* fix(cache): reuse compiled graphs with recreated caches

* refactor(bailing_hybrid): reuse shared model components

* refactor(bailing_hybrid): tighten architecture validation

* test(bailing_hybrid): cover hybrid attention outputs

* fix(bailing_hybrid): preserve MTP config alias

* revert unrelated

* small things

* delete unused stuff

* revert cache

* remove uneeded override

* a bit more inheritance

* a bit simpler

* remove redundant tests

* oupsi forgot style

---------

Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
Co-authored-by: Cyril Vallez <cyril.vallez@huggingface.co>
2026-10-14 12:29:58 +02:00
Steven LiuandQuentin Gallouédec 28034545c3 [docs] Context parallelism during eval (#48663)
* docs

* feedback

* feedback

---------

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
2026-10-13 17:24:50 +00:00
6fb6859aae Add Kolibri 1 (#49463)
* Add Kolibri 1

* fix(kolibri1): fall back to the fp32 router upcast when dtypes differ

`torch.mm(..., out_dtype=)` rejects operands of different dtypes, e.g.
fp32 activations into a bf16 router under autocast at inference.

* fix(kolibri1): reject configs without a sliding window

Without one, the attention inherited from EXAONE 4 applies RoPE in every
layer, a model Kolibri 1 was never trained as.

* fix(kolibri1): drop the softmax load-balancing loss

Kolibri 1 balances experts through `e_score_correction_bias`, which
training updates outside the loss. The loss inherited from Qwen3-MoE
ranks experts by softmax over unbiased logits, so it balanced a routing
the model does not use. Other bias-routed models (DeepSeek-V3, GLM-4-MoE,
EXAONE-MoE) have no aux loss either.

* docs(kolibri1): use a Kolibri checkpoint in the causal LM example

* docs(kolibri1): trim the expert-parallel plan comment

* test(kolibri1): add integration tests on the BF16 checkpoint

* fix(kolibri1): update model name and contribution date

* docs(kolibri1): note that the CUDA router fast path is for performance

---------

Co-authored-by: Sascha Wirges <sascha.wirges@aleph-alpha-research.com>
Co-authored-by: Eric Schreiber <eric.schreiber@aleph-alpha-research.com>
Co-authored-by: Cyril Vallez <cyril.vallez@huggingface.co>
2026-10-13 16:19:39 +00:00
Marc Sun 14d7637051 Remove examples (#49357)
* lotttts of cleaning

* update

* clean

* up

* more cleaning

* update
2026-10-13 15:11:48 +00:00
Raushan Turganbay e880ddc57b Minicpm 4.7 update integration tests (#49565)
* have to check with runners

* fix expectations

* also config and docs
2026-10-13 11:18:48 +00:00