Skip to content

Update tiled MLP adapters and model coverage - #4

Closed
kashif wants to merge 998 commits into
vasqu:kernels-swi-geglufrom
kashif:fix/tiled-mlp-kernel-updates
Closed

kashif wants to merge 998 commits into
vasqu:kernels-swi-geglufrom
kashif:fix/tiled-mlp-kernel-updates

Conversation

@kashif

@kashif kashif commented Nov 16, 2026

Copy link
Copy Markdown

What does this PR do?

Follow-up to huggingface#48335, with current main merged in.

Use scaled/clamped tiled adapters for Falcon-H1, DeepSeek-V4 and GLM5-Next, add ROCm training mappings, and regenerate modular models to pick up the newer compatible MLPs. Also cover the missing Qwen2-VL/Qwen2.5-VL, Mllama, BLT, StableLM, Chameleon and Llama4 MLPs. Keep native forwards where the math differs.

Depends on huggingface/kernels-community#1340 and publishing those kernels to the mapped Hub versions. The Falcon-H1 regression checks the published scaling factors and activation fallback.

Tested: 15 MLP adapters forward/backward on AMD ROCm, two Falcon-H1 regression cases, and make fix-repo / make style. Kernel-side tests pass 26 local cases and 204 distributed cases on four H100s across two nodes. make typing reports existing errors in unchanged serving/quantization code with the installed dependencies.

Who can review?

@vasqu

jakobknauer and others added 30 commits October 30, 2026 13:36
add check model name in incorrect list
…ace#49944)

* Allow untokenized output from `apply_transcription_request`

Add a `tokenize` argument to the chat-template-based ASR processors so
that inference engines, which run the processor themselves, can get the
formatted prompts. Also make VibeVoice-ASR's `extract_speaker_dict` keep
the complete segments of truncated output instead of raising.

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

* doc nit

---------

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: eustlb <94853470+eustlb@users.noreply.github.com>
…ibility (huggingface#50170)

Pillow >= 13 changed the order of bicubic resize passes (vertical-first when
height shrinks more than width), producing slightly different pixel values when
compared against torchvision. Matches the fix applied to other models in huggingface#50105.

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
…49316)

* fix: save_pretrained on every rank for peft model

* test: add tests

* refactor: move args.should_save only in self._save

* refactor: rename test file

* test: use model from hub instead of config

* test: make test cleaner

* fix: add early exit

* style: restore space in test

* test: align test with huggingface#49500

* test: rename test

---------

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
* expose private parameter

* add test

* docs

* Update tests/trainer/test_trainer_checkpointing.py

---------

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
* update

* collapse table

* fix links
…uggingface#50150)

* Restore MegaBlocksMoeMLP hub kernel mapping for MXFP4 GPT-OSS MLP

huggingface#49548 replaces GptOssMLP with Mxfp4GptOssMLP, which dropped the MegaBlocksMoeMLP hub mapping, so use_kernels=True no longer kernelizes the MoE MLP of MXFP4 GPT-OSS on CPU/XPU.

* Test the megablocks kernel on a real MXFP4 GPT-OSS model on CPU/XPU

Replaces the decorator-only check with a slow test that loads openai/gpt-oss-20b with use_kernels=True, checks every MLP keeps MXFP4 experts and runs the MegaBlocksMoeMLP kernel, and checks generation. Limited to CPU/XPU: other devices dequantize to bf16 with use_kernels=True and keep GptOssMLP.

* Use the modeling flash-attn2 kernel version in benchmark_v2's FA2 check

is_fa2_or_kernel_available() pinned kernels-community/flash-attn2 to version=1, which has no XPU build, so flash_attention_2 benchmarks silently fell back to SDPA on XPU. Use FLASH_ATTN_KERNEL_VERSIONS, the same version the model loads.

---------

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
…apping lazily (huggingface#50047)

Build the package distribution mapping lazily

importlib.metadata.packages_distributions() stats every file of each
distribution without a top_level.txt (torch >= 2.14 ships none). Build it on
first use, and try the import name as distribution name before it.
* docs bot

* fix quality

* feedback - docs status
* deorecate and ley users decicde where to add

* let both be passed but order is wrong yet

* move it all over here

* nit

* split it into overridable fn

* fix the order

* CI repo consistency

* modular fix and revert bad rebase

* whta?

* eg2 modular and tests

* actually fixing it might breaks other models...

* some comments and BOA/EOA

* nits

* henrique's big comment

* fix repo

* fix some tests, maybe need `@require_torchcodec_greater` now :(

* fix CI i hope

* dont allow old qwen - we need to completely override processor one day

* skip this one

* add bucket

* very very weird, but runners dont have latest torchcodec yet, maybe that?

* so do i skip all integraion tests for now????

* more comments i forgot to address

* got accdentally changed - revert

* so maybe precompute audio frames and dump leftover there?

* ugh fix repo and style

* off by one comment
Apply final logit softcapping in PaliGemma
* nit

* seems no models are affected, deal with it later if someone complains

* revert, i accidentally merged :(
* fix(trainer): preserve fractional parallel token counts

* test(trainer): minimize fractional token count regression

* style(trainer): satisfy Ruff formatting

* Test the fractional token count through a real Trainer

---------

Co-authored-by: BlazeSR10hawk <BlazeSR10hawk@users.noreply.github.com>
Co-authored-by: Ferdinand Mom <47445085+3outeille@users.noreply.github.com>
Co-authored-by: Ferdinand Mom <ferdinand.mom@epita.fr>
…attributes (huggingface#50181)

The CI security gate blocks fork PRs editing .gitattributes; per-model lines tripped it on every new model.
* update to torch 2.15 for xpu

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>

* add peft

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>

---------

Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
Co-authored-by: regisss <15324346+regisss@users.noreply.github.com>
…gface#50234)

Load DETR-family panoptic masks with load_image_as_tensor
…uggingface#50237)

Gemma4: pass num_frames_per_video through forward to get_video_features
…ace#49351)

* Remove the GitHub API cache-bust from the AMD docker images

* Bust the AMD images' clone cache with the commit being built

Replaces the removed GitHub API `ADD`: the build workflow now passes
`REF=${{ github.sha }}` to the AMD images, so the `git checkout $REF`
step (and every layer after it) changes, and is rebuilt, for each new
commit. No network call, and the image is pinned to the commit it was
built from.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
….sep/os.path.join patterns (huggingface#50219)

* fix(tests_fetcher): use posix separators and resolve case-insensitive paths on Windows

Three uses of os.path.sep in extract_imports produced backslash paths on Windows,
causing all module dependency lookups to silently fail (wrong keys in reverse_map).
A fourth issue: os.path.join built Windows-absolute paths for submodule lookups.

Changes:
- extract_imports: split/join with "/" instead of os.path.sep throughout
- get_module_dependencies: replace "." with "/" (not os.path.sep) for import_structure keys
- get_module_dependencies: skip import_structure entries whose resolved path does not exist
- get_module_dependencies: use Path.resolve().name when adding submodule deps so that
  case-insensitive Windows filesystems return the real on-disk filename (e.g.
  "sliding_attention.py" instead of "SLIDING_ATTENTION.py" when the import name is all-caps)

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

* fix(tests_fetcher): eliminate all remaining Windows path patterns

Replace every remaining os.path.sep / os.path.join / str(path.relative_to(...))
with posix-only equivalents, and add a static regression test.

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

* fix(tests_fetcher): address review feedback — revert speculative changes, fix str(k), tighten test

- Revert silent `continue` for non-existent import_structure paths (behavioural
  change bundled into path-separator commit, restores original behaviour)
- Revert `resolve().name` for submodule casing (speculative Windows fix with
  symlink edge case; no actual ALL_CAPS file exists in transformers)
- Fix `str(k)` absolute path in `infer_tests_to_run` test_all branch:
  `PATH_TO_TESTS.glob("*/*")` returns absolute Path objects whose `str()`
  never matches relative posix reverse_map keys; use `.relative_to().as_posix()`
- Tighten static regression test: check line-by-line so `str(...relative_to(...).as_posix())`
  (valid) is not incorrectly flagged

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

* fix(tests_fetcher): fix glob.glob Windows paths, annotate test limitations

- Fix glob.glob("tests/**/...") returning OS-native backslash paths on Windows;
  wrap with Path(f).as_posix() so f.split("/")[1] doesn't IndexError
- Add comment on os.path.join( ban explaining intent and escape hatch
- Add comment on str(...relative_to() regex limitation (.as_posix() in comments)

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

* fix(tests_fetcher): strip comments before assertNotIn checks to avoid false positives

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

* fix(tests_fetcher): simplify comment-stripping in regression test

Revert code_lines comment-stripping (over-engineering) and document
the inline-comment false-positive limitation instead. Same approach
already used for the regex check.

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

* fix(tests_fetcher): drop redundant backslash normalisation in extract_imports

After the posix-path cleanup, all callers of extract_imports already
guarantee posix strings, so the defensive replace("\\", "/") is dead
code. Use plain split("/") instead.

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

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* fix failed test cases for pocket_tts model

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

* avoid skipping for CALM model

---------

Signed-off-by: kaixuanliu <kaixuan.liu@intel.com>
Co-authored-by: eustlb <94853470+eustlb@users.noreply.github.com>
…res (huggingface#50179)

* [VibeVoice-ASR] Add `sample` to disable VAE noise in audio features

`get_audio_features` always added `vae_std` noise to the acoustic latents, so
outputs could not be made deterministic. Add a `sample` argument (default
`True`, unchanged behaviour), plumbed through `forward` so `generate` accepts
it too. With `sample=False` the latent mean is used.

The common tests now pass `sample=False`, so the nine tests skipped for VAE
randomness run again.

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

* [VibeVoice] Add `sample` to disable VAE noise in audio features

The voice prompt encoder hard-coded `sample=True`. Expose it on
`get_audio_features` and both `forward` methods, default `True` (unchanged).

With `sample=False` the latents are a view created under `no_grad`, so apply
the latent bias and scaling out of place.

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

* clearer doc

---------

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: eustlb <94853470+eustlb@users.noreply.github.com>
* Fix IndexError in _init_weights for padded embeddings under DeepSpeed ZeRO-3

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

* avoid gather the same embeddings with ds nested gather

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

* update code

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

---------

Signed-off-by: kaixuanliu <kaixuan.liu@intel.com>
…ngface#49811) (huggingface#50098)

Co-authored-by: serge[bot] <serge[bot]@users.noreply.github.com>
…els (huggingface#45649)

* Skip CPU param materialization on non-rank-0 FSDP ranks to avoid OOM

* fix it

---------

Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
Co-authored-by: Cyril Vallez <cyril.vallez@huggingface.co>
* Filter NaN/Inf batches out of the eval loss when `logging_nan_inf_filter` is set

A batch without label tokens has a NaN loss: an eval set with masked samples,
or a fully masked chunk under context parallelism. One such batch made the
whole `eval_loss` NaN. `logging_nan_inf_filter` already filters non-finite
training losses, so it now also leaves non-finite batches out of the eval
loss. If no batch is finite, the loss stays NaN.

Supersedes huggingface#44257, which also used `nanmean` on the gathered training loss.
That is not needed: the filter already replaces non-finite step losses
before they are accumulated.

Co-authored-by: Wing Lian <wing@axolotl.ai>

* Update src/transformers/trainer.py

---------

Co-authored-by: Wing Lian <wing@axolotl.ai>
Dequantize MXFP4 experts to the target parameter's dtype
ydshieh and others added 28 commits November 14, 2026 11:51
…ingface#50757)

Move model to torch_device in test_bc_cache_name_{forward,generate}

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
…t_mismatch` (list output differs (2)) (huggingface#50233)

Co-authored-by: serge[bot] <serge[bot]@users.noreply.github.com>
… with `output_mismatch` (list output differs (1)) (huggingface#49581)

* [serge] Fix 1 integration test for model `deepseek_vl_hybrid` failing with `output_mismatch` (list output differs (1))

* [serge] Fix 2 integration tests for model `deepseek_vl_hybrid` failing with `OOM`, raising `OutOfMemoryError` (other (2)

---------

Co-authored-by: serge[bot] <serge[bot]@users.noreply.github.com>
…utput_mismatch` (tensor values differ (2)) (huggingface#50146)

* [serge] Fix 2 integration tests for model `ministral` failing with `output_mismatch` (tensor values differ (2))

* Use default dtype ("auto", bf16) and re-record expectations in ministral 8b logits test

Instead of pinning `dtype=torch.float32`, keep the default `dtype="auto"` (bf16 for this
checkpoint since huggingface#42805) as on main, and update EXPECTED_MEAN / EXPECTED_SLICE with values
recorded on A10G (sm 8.6), torch 2.15.0+cu132, main 3a134bc (2 identical runs).

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

---------

Co-authored-by: serge[bot] <serge[bot]@users.noreply.github.com>
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…t_mismatch` (list output differs (4), other (2)) (huggingface#50469)

* [serge] Fix 6 integration tests for model `bloom` failing with `output_mismatch` (list output differs (4), other (2))

* Explain why the bloom-560m generation tests pin fp32

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

---------

Co-authored-by: serge[bot] <serge[bot]@users.noreply.github.com>
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
…tput_mismatch` (tensor values differ (2)) (huggingface#50006)

Co-authored-by: serge[bot] <serge[bot]@users.noreply.github.com>
…gingface#50697)

Since huggingface#49861, attention_mask_padding_matches_padding_free_with_position_ids
sets every norm eps to 1.0 to make the test less flaky. With the tiny random
test models this shrinks the logits to about 1e-2 (1e-3 for BERT-like
models), below the fixed atol of torch.finfo(torch.bfloat16).eps, so the
comparison passes even when packed documents attend to each other (for
example Ministral3 and Mistral4 on main, which do not forward position_ids
to FlashAttention).

Scale atol by the largest padded logit and keep rtol, so the test catches
cross-document attention again while keeping the norm settings from huggingface#49861.

Co-authored-by: Raushan Turganbay <raushan@huggingface.co>
* fix

* needs normal test

* i guess?
huggingface#50792)

* [docs] Fix the any-to-any guide's inference example

The example imported infer_device, which was removed in huggingface#41088, so it
failed on the first line. Use Accelerator().device like the other task
guides, and pass generation_mode="text" so Qwen2.5-Omni returns token
ids for batch_decode instead of a (text, audio) tuple.

* [docs] Load the any-to-any model with device_map="auto" and default dtype
…face#50808)

Use MemoryCleanupMixin in Mamba2IntegrationTest to fix CI OOM

Three tests each load mistralai/Mamba-Codestral-7B-v0.1 (bf16, ~13.4 GB) and nothing frees it after
the test, so the next test loads a second copy and runs out of memory on a 22 GB GPU.

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
…t_mismatch` (list output differs (2)) (huggingface#49407)

* [serge] Fix 2 integration tests for model `utils` failing with `output_mismatch` (list output differs (2))

* Narrow test_cache_copy expectation key to ("cuda", (8, 6))

The new value was verified on A10G (sm 8.6) only; keep the previous value as the default for other devices.

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

---------

Co-authored-by: serge[bot] <serge[bot]@users.noreply.github.com>
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* Update SECURITY.md

* Update SECURITY.md

fixes
)

* Fix OpenVINO generate export tests for xLSTM and Bark

- exporters: `openvino_feed` read the batch size off the first cache leaf,
  which for xLSTM (after the `cache_params` -> `cache` rename) is the 1-d
  `seqlen_offset` counter -> batch 1 instead of 2. Use the highest-rank
  cache tensor instead.
- bark: pass `cache` to `create_bidirectional_mask` so the mask spans
  past + new tokens when no `attention_mask` is given.

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

* Skip Swin/Swinv2 OpenVINO dynamic export (timeout)

Dynamic-shape OpenVINO export of Swin/Swinv2 takes ~960-1000s (static: ~8s)
and hits the 1000s test timeout. Skip it, as already done for MaskFormer's
Swin backbone and for Swin/Swinv2 in the ONNX scope.

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

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
…gingface#50780)

* perf: skip impossible stop string matching offsets

* perf: canonicalize stop string cache vocabulary order
…ents (huggingface#50760)

* Add files via upload

* Test duplicate and single XML array arguments

Add tests for merging duplicates in tool call arguments.

* Remove misplaced test file from parser source directory

The regression tests are in tests/utils/test_chat_parsing.py.
…e#50817)

- tapas.md: AdamW was removed from transformers; import it from torch.optim
- trocr.md: BitsandBytesConfig -> BitsAndBytesConfig
- persimmon.md: there is no PersimmonTokenizer; load it with AutoTokenizer
- testing.md: MemoryCleanupMixin lives in tests/test_memory_cleanup_mixin.py,
  not transformers.testing_utils; also import unittest, which the snippet uses
…sk it drops (huggingface#50724)

* Disable Flash Attention for multimodal models with bidirectional image masks

* Set the DiffusionGemma Flash Attention flag once on its base class

* Remove the Flash Attention test overrides that no longer run
…` query selection) (huggingface#50815)

Mark OmDetTurboModelTest::test_batching_equivalence as flaky (topk query selection)

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
…ggingface#50624)

* fix: preserve Mistral prefill in Voxtral and multimodal pipelines

* Address Voxtral prefill review feedback

---------

Co-authored-by: BlazeSR10hawk <BlazeSR10hawk@users.noreply.github.com>
…ace#50786)

* fix(pipelines): avoid mutating multimodal generation kwargs

* test(pipelines): cover reused generation kwargs with tiny Llava

---------

Co-authored-by: BlazeSR10hawk <BlazeSR10hawk@users.noreply.github.com>
@vasqu

vasqu commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Uh oh ig id need to sync with main for the other base branch before. Will come around this later but thanks 🫡

@kashif kashif closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.