Repository navigation
Conversation
#49830) fix: Route the DETR conversion scripts through from_pretrained
* 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>
…enerate modules (#48951) Use forward slashes in hub-relative path for relative imports of custom modules get_cached_module_file recurses into relative imports of a remote custom_generate/modeling module, building the child module path with Path(module_file).parent / module_needed. On Windows that yields a backslash path (e.g. 'custom_generate\beam_search.py') which the Hub lookup then cannot find: OSError: transformers-community/group-beam-search does not appear to have a file named custom_generate\beam_search.py Normalize with as_posix() so the Hub-relative path keeps forward slashes. Local filesystem uses of the same value are unaffected (Windows accepts forward slashes). Co-authored-by: dltsum <dltsum@users.noreply.github.com> Co-authored-by: Claude Code <noreply@anthropic.com>
…49552) * Only tie MM Grounding DINO decoder heads when the config shares them MMGroundingDinoForObjectDetection tied every decoder layer's bbox and class heads to layer 0 unconditionally, ignoring the checkpoint config. Published checkpoints (LLMDet tiny/base/large, openmmlab mm_grounding_dino variants) set decoder_bbox_embed_share=False and decoder_cls_embed_share=False and store per-layer heads, so layers 1+ silently used layer 0's heads and boxes came out wrong. GroundingDinoForObjectDetection already handles its share flag; mirror that pattern for both MM flags (defaults True preserve current behavior). Also drop the stray ^ in the class_embed replacement and the stale 'class embed has no weights' comment (MMGroundingDinoContrastiveEmbedding has a learnable bias). Fixes #49529. * Remap published decoder head keys on load and compare head values in tests * Trim AI-flavored comments to terse maintainer style (no code change) * Assert decoder heads are untied before the published-layout value check test_decoder_heads_load_values_from_published_layout passed on code where every head was still tied to layer 0: tying makes the per-layer values collapse, so the comparison could not tell the layouts apart. Assert the untied precondition, which makes the test fail on unfixed code. * Drop the redundant nesting and leave the tuned weight keys alone The outer share check duplicated the two inner ones, and the class_embed replacement did not need its anchor normalised. * fix the slop * fix * style --------- Co-authored-by: lu123bing <lu123bing@users.noreply.github.com> Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
Adds base_model_tp_plan to NemotronConfig (colwise q/k/v + up_proj, rowwise o_proj + down_proj) and a colwise_gather_output plan for lm_head, matching the Llama convention. Verified on a 2-rank CPU/gloo mesh: sharded forward matches the single-process forward (max abs diff 4e-7), 13/24 params sharded. test_tp_plan_matches_params passes. Related: #34789 Co-authored-by: Ferdinand Mom <47445085+3outeille@users.noreply.github.com>
…49698) (#49703) fix(mask2former): register input_projections as nn.ModuleList Mask2FormerTransformerModule kept input_projections in a plain Python list, so the input projection layers were never registered as PyTorch submodules: their parameters were excluded from model.parameters(), optimizers and the state dict, and model.to(device) left them on CPU causing 'input type ... and weight type ... should be the same' RuntimeErrors on CUDA. The pixel decoder already uses nn.ModuleList for the same structure (line 1266-1276) and the original Mask2Former implementation registers them the same way. Fixes #49698
* Add two workflows for INtel XPU CI * Fix Docker image name * Add subdirs support to XPU caller workflow for testing bert, gpt2, vit, t5 * Test * Test removing env_file * Fix * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Add pipeline, fsdp, deepspeed, quantization jobs * Test * Test * Finish PR * Remove trigger on add_xpu_ci branch * Switch to ubuntu-22.04 --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* Defer generation, gguf and sklearn imports out of config/tokenizer loading Importing AutoConfig/AutoTokenizer pulled in the generation stack (watermark processors, GenerationMixin) and the GGUF loader, which import torch, plus sklearn.metrics via candidate_generator. Each is only needed on one code path, so import it there. Fixes #49378 * Test that deferred watermark imports still load on first use * Test the llama config path and the deferred sklearn import Also check that AutoConfig.for_model('llama') keeps sklearn, the candidate generator and the gguf loader out of sys.modules, and that the assisted candidate generator still reaches sklearn.metrics.roc_curve on first use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Use the run_command test helper instead of calling subprocess directly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop the import tests per review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…oken IDs (#49696) * Fix encoder logits processors when precomputed encoder_outputs lack token IDs * fix the slop * better --------- Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
* turns out it is sometimes an issue on main * revert * 👀 * untie modules, tie weights * alright, noisy comments;.. * add back tests skipped * appropriate test * fix inits --------- Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
…sors (#49826) * [Fetcher] Fix missing test deps for dynamically-resolved image processors Since PR #43514, test_image_processing_*.py files no longer statically import their image processor class — resolution happens dynamically via IMAGE_PROCESSOR_MAPPING_NAMES in test_image_processing_common.py, and via IMAGE_PROCESSOR_MAPPING in test_processing_common.py. The fetcher's static import analysis is blind to this. Wire image_processing*.py files to their test files explicitly by naming convention in create_reverse_dependency_map, covering two cases: 1. test_image_processing_<model>.py (uses _get_image_processing_classes) 2. test_processing_<model>.py (uses _get_component_class_from_processor, when processing_<model>.py itself has no static import of the image processor — e.g. CLIP's processing_clip.py only imports ProcessorMixin) Add a regression test verifying the wiring for CLIP and Fuyu (both slow and fast/PIL backends). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Extend preprocessor wiring to video/audio processors, feature extractors, and tokenizers Previously only image_processing*.py files were explicitly wired to their test files. Generalize the naming-convention block to cover all preprocessor types that suffer the same dynamic-resolution blind spot: video_processing, feature_extraction, audio_processing, and tokenization files are now wired to both their type-specific test file and test_processing_<model>.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix video test: add missing assert for test_video_processing_qwen2_vl.py --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* feat(gemma4): bool mask logits_to_keep, expose last_hidden_state logits_to_keep only supported an int (keep the last N) or a flat index tensor for a single packed sequence. SFT training with sequence packing needs to exclude non-contiguous spans per example in a batch, which neither form can express. Accept a 2D bool mask shaped like input_ids (batch_size, sequence_length); logits are computed only for the True positions, flattened in input_ids order. Existing int/tensor behavior is unchanged. Also add last_hidden_state to Gemma4CausalLMOutputWithPast, independent of output_hidden_states, since packed-sequence loss computation needs the full hidden states regardless of that flag. Closes #48784 * feat(gemma4): extend logits_to_keep mask support to all ForXXX classes, fix negative layer indices Extend the bool-mask logits_to_keep support added for Gemma4ForConditionalGeneration to the rest of the family (Gemma4ForCausalLM, Gemma4UnifiedForCausalLM, Gemma4UnifiedForConditionalGeneration), settling on a plain if/else with a single lm_head call per branch to match the convention already used elsewhere in the codebase (Gemma4ForCausalLM itself, biogpt, csm, llava_onevision, etc.). Also fix output_hidden_states selective layer capture (src/transformers/utils/output_capturing.py, #48081) to resolve negative indices (e.g. -1 for the last layer). The hook fires progressively during the forward pass and can't know the total layer count in advance, so count how many hidden_states hooks get installed per model during the one-time hook installation walk, store it on the model, and resolve negative indices against that count before the forward pass runs. No change to the per-layer hook logic itself. Refs #48784 * feat: extend logits_to_keep bool-mask support to all ForCausalLM/ForConditionalGeneration classes * remove last_hidden_state field, rely on output_hidden_states indices instead * revert CSM to original logits_to_keep handling, drop stray gemma4-only docstring * revert output_capturing.py * Add: slice_logits_to_keep to modeling_utils.py * apply to `bit`, `falcon`, `hyperclovax`, `hyperclovax_vision_v2`, `nemotron_h`, `opt` * Add: 2d idx process * Address review feedback: #48825 (review) * Address feedback: #48825 (comment) * Address feedback: #48825 (comment) * Update src/transformers/modeling_utils.py Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com> * Update src/transformers/modeling_utils.py Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com> * Apply slice_logits_to_keep to the models that were missed * dont like the newline that was added * more newline * more * remove more newline and nonsense assignment * unrelated * more based on latest main --------- Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com> Co-authored-by: Cyril Vallez <cyril.vallez@huggingface.co>
…path (#46169) * Replace for-loop with unfold in LED/Longformer _chunk ONNX-export path * Ran ruff on both files * comment does not make sense * random files added --------- Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com> Co-authored-by: Cyril Vallez <cyril.vallez@huggingface.co>
* 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.
* skip `sdpa_can_dispatch_on_flash` tests for 3 models 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>
* 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>
…ig (#49848) * Read DeepSeek-V4.1's expert_dtype from its quantization config V4 names its experts' dtype on the model config, and V4.1 in its quantization config. The FP8 experts read the model config, so DeepseekV4Config.__post_init__ moves V4.1's there. A model config value wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep DeepSeek-V4's expert_dtype in the quantization config The experts' format describes the quantization. DeepseekV4Config.__post_init__ moves V4's model-config expert_dtype into the quantization config, where V4.1 ships it, and FineGrainedFP8Config reads it. FP8Experts no longer reads the model config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Run fine-grained FP8 expert parallelism as masked expert parallelism update_parallel_plan rewrites ep_dispatch_experts to moe_tp_experts with an ep_router. Each rank runs its own experts on every token, and an all-reduce sums the outputs, so the quantized experts need no all-to-all dispatch. Mega MoE keeps its own styles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Inline the masked expert parallelism rewrite into update_parallel_plan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop the expert_dtype config test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Shorten comments, drop an unused import Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Move masked expert parallelism to its own PR Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The non-tracing branches used int(x) (copy-paste from torch_int), so the result was truncated instead of returned as a float.
minimal fix
* Fix Qwen4-Exp indexer position cache lifecycle * Fix indexer position cropping before early return
#48970) docs(optimization): standardize 'Return:' to 'Returns:' in schedule docstrings - Fix docstring returns header from singular 'Return:' to standard 'Returns:' across all 13 schedule functions in src/transformers/optimization.py - Ensures doc-builder and Sphinx correctly parse and render return types in generated documentation
* fix: update outdated sampler comment from generation_utils_samplers.py to logits_process.py The comment references generation_utils_samplers.py which doesn't exist. The sampling processors are actually defined in logits_process.py. * fix --------- Co-authored-by: ivan <blues74285700@gmail.com> Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
* [gradium_phonon_tts] point to the released Hub repos - integration tests: pin gradium/phonon-31m-en to the merge of its transformers PR (5c8a65f0), whose processor points to the public audio tokenizer gradium/phonon-mimi instead of the private eustlb/gradium-phonon-tts-audio-tokenizer (weights, config and tokenizer unchanged, goldens still valid) - converter: default audio tokenizer repo gradium/phonon-mimi - auto_docstring checkpoint: gradium/phonon-31m-en * [gradium_phonon_tts] integration tests: load the checkpoint from main
* 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>
* Add cpu ram capping * Style
…#49992) * fix(ci): skip bot suggestion if a maintainer already posted run-slow: Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ci): skip bot suggestion if maintainer posted run-slow: after current merge commit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * style(ci): improve comment clarity in send_comment step Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ci): skip bot suggestion if maintainer posted run-slow: after current merge commit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
… keys (#49994) * [tests_fetcher] fix missing .as_posix() in preprocessor_patterns path keys `str(path.relative_to(PATH_TO_REPO))` produces backslash-separated paths on Windows, which don't match the forward-slash keys used everywhere else in `reverse_map`. Use `.as_posix()` consistently, matching the existing pattern used in the backbone-map block just above. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * [tests_fetcher] also fix .as_posix() in create_reverse_dependency_tree/map all_modules Same Windows-path issue: str() on a Path gives backslashes, but all keys throughout tests_fetcher use forward-slash paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* fix fa static cache * make this uncompiled * fix the condition --------- Co-authored-by: vasqu <antonprogamer@gmail.com>
* Respect CSM codebook embedding tying configuration `CsmConfig` unconditionally set `tie_word_embeddings = False`, so the core `get_expanded_tied_weights_keys` dropped CSM's structural tie between the backbone audio embeddings and the depth decoder embeddings. They then loaded as two independent parameters. Derive `tie_word_embeddings` from `tie_codebooks_embeddings` in the config instead, since both flags have the same meaning for CSM. Older checkpoints store `tie_word_embeddings: false` together with `tie_codebooks_embeddings: true`, so the incoming `tie_word_embeddings` value is ignored and `tie_codebooks_embeddings` stays the source of truth. `_tied_weights_keys` has no `lm_head` entry, so the text embeddings and the LM head stay untied. Add regression tests covering both flag values for tied and untied configurations, including weight values after a save/load roundtrip, and re-enable the common `test_tied_weights_keys`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix the tests and clean everything --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
`ReplicatedWithGradAllReduce.install_forward` registered a module-level backward hook on every per-head norm at TP setup time. Dynamo breaks the graph at each call of a module carrying a full backward hook, including under `torch.no_grad()`, so `tp_plan="auto"` cost every affected model a graph break per norm per layer in inference. Reported for Qwen3, where decoding slowed from 37.6 ms to 140 ms per token. Register the all-reduce from the module's forward instead, and only when `torch.is_grad_enabled()`: inference installs nothing. Doing it at forward time rather than install time also means the parameters the loader actually installed are the ones hooked, which is what the module-level hook was working around, so a `register_post_accumulate_grad_hook` is safe here. That also removes a latent bug. A full backward hook fires on grad w.r.t. outputs when no input requires grad, at which point `param.grad` is still None and the all-reduce was silently skipped; a post-accumulate hook cannot run before the gradient exists.
* fix diverged after bert refactor * fix missing and repo copies * weird why, fix repo * new model needs a new commit
* Removed useless kwargs dict * Cleanup * Reword comment * fix repo
… imports (#50000) * [exporters] resolve patch paths lazily in apply_patches, not at decoration time `@register_patch` previously called `_resolve_dotted_path` (which runs `importlib.import_module`) at module-load time, eagerly importing ~37 model modules the moment any exporter file was imported. Since exporter files are imported from `test_export.py`, and `test_export.py` is imported transitively by every `test_modeling_*.py` file via `ModelTesterMixin → ExportTesterMixin`, this caused ~511 test files to record spurious source dependencies on those model modules in `tests_fetcher.py`. Fix: store the dotted-path string in `_PATCHES` instead of the resolved object. `apply_patches` resolves each path just before installing the patch, at which point the model module is already loaded anyway. The `if obj is None` skip logic moves to `apply_patches` via the walrus operator. `patch_attributes` and any direct `patch_attributes(config_patches)` call-sites are unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(test_utils): update test to reflect lazy path resolution in register_patch Path resolution moved from decoration time to apply_patches time, so _PATCHES now stores the raw string — not the resolved object. Update test_register_patch_skips_unresolvable_path to assert the string is stored and that apply_patches silently skips it (still no patch installed, still no exception at import time). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * style: shorten comment to satisfy NC001 (5-line limit) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * style: add PR reference to test comment Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
…ification (#50001) pipelines: defer eager model imports to avoid spurious test dependencies `token_classification.py` imported `BasicTokenizer` at module level, and `text_to_audio.py` imported `SpeechT5HifiGan` inside the `if is_torch_available()` block — both at import time, unconditionally. This caused every test file that loads any pipeline (via PipelineTesterMixin → test_pipeline_mixin.py → pipeline source files) to record a transitive dependency on `modeling_bert_legacy` and `modeling_speecht5`, even when those models are completely unrelated to the test being run. Move both imports to the call site where they are first needed (`__init__` for `BasicTokenizer`, the spectrogram-model branch of `__init__` for `SpeechT5HifiGan`), so they are only executed when the relevant pipeline class is actually instantiated. Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* 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
Signed-off-by: kaixuanliu <kaixuan.liu@intel.com>
…50012) * fix(canary): set layerdrop=0.0 in test tester to prevent flaky test `test_retain_grad_hidden_states_attentions` runs without `model.eval()`, so LayerDrop is active. With `layerdrop=0.1` (the default) and only 2 test layers, both can be dropped simultaneously with 1% probability, leaving `encoder_attentions` empty and causing an `IndexError`. Mirrors the existing pattern in `ParakeetEncoderModelTester`, which explicitly sets `dropout=0.0` (and `layerdrop=self.dropout`) with the comment "so gradient checkpointing doesn't fail". Verified: 1000/1000 passes on GPU runner after this fix (previously ~10/1000 failures). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * add inline comment explaining layerdrop placement Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
…50007) `check_noisy_comments.py` runs `git blame --line-porcelain` per file that has findings, to decide whether a comment is old enough to ignore and whether the file's owner wrote it. On a partial clone (`git clone --filter=blob:none`, routine for a repo this size) the historical blobs blame needs are not on disk, so plain `git blame` lazily fetches each missing object from the promisor remote -- one object at a time, inside git's own machinery. Each round trip is slow even when it ultimately fails: measured here at ~12s per file, and 97-138s for files with long histories (`masking_utils.py`, `conversion_mapping.py`). On this checkout's default diff-only scan (56 files with findings) that added up to 52m48s of wall time for a check whose actual comment parsing takes ~4s. Setting `GIT_NO_LAZY_FETCH=1` for this one subprocess makes a missing object a local, immediate failure instead of a network fetch. `blame` already reports that as a nonzero exit, which the caller treats as "no blame info for this file", so behavior is unchanged where every object is local -- the ordinary case in CI, where actions/checkout makes a full clone. Where the flag does trigger, the cutoff/owner filters simply see no commit dates, which can only keep a finding, never hide one. Measured on the default diff-only path: 52m48s -> ~1m48s (~29x). Adds a regression test asserting the env var reaches the subprocess; it fails without the fix. Co-authored-by: Tarek Ziade <tarek@ziade.org>
…49772) * Keep a capturing group's escapes when reversing a conversion pattern process_target_pattern unescaped \. before extracting the capturing group, so the reversed rename's group matched any character in place of a dot. Unescape only outside the group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Place the escaping comment next to the unescape and rename the test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Say what the escaped-dots test expects Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * very very nit --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
docs: update AMD GPU kernel repository links
…vision mlp keys (#49786) * Rename only MiniMax-M3-VL's MoE block so a save keeps the dense and vision mlp keys The `.block_sparse_moe.` -> `.mlp.` rename reversed on save turned every `.mlp.` key back into `.block_sparse_moe.`, the dense and vision ones too. Name the MoE block's children in the pattern; the reversed group keeps its escaped dots. Run the reverse-mapping test that was skipped, on the composite model only, as for Llava. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop the end anchor from the MiniMax-M3-VL MoE rename No other key under the MoE block starts with `e_score_correction_bias`, so the alternative matches without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * more redable --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
* [moshi] Remove Moshiko integration tests whose checkpoint is gone kmhf/hf-moshiko no longer exists on the Hub and there is no public transformers-format Moshiko checkpoint to replace it. Moshika tests keep covering the same generation path. Fixes #50016 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [moshi] Skip the Moshiko integration tests instead of removing them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Accept code_revision from either the top level or model_kwargs, put it in hub_kwargs so the model, tokenizer and processor loads get the pin too, and stop AutoTokenizer from leaking it into tokenizer_config.json. Fixes #49272 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
add lfm kwargs
…49890) Co-authored-by: Jim Burtoft <jimburtoft@users.noreply.github.com>
* Fix test_pil_can_load_without_torchvision leaking reloaded module into other tests * lets actually test without torchvision * unskip * fix-repo
* fix * style * fix
* Bump kernels-community/flash-attn2 to v4 The v3 branch of the flash-attn2 kernel repo ships an XPU build that predates huggingface/kernels#921, so it has ahead-of-time compilation silently disabled and is built against a sycl-tla revision with a flash-attention forward regression. v4 carries both fixes. v3 and v4 produce bit-identical logits, so this is a build-level change only. * only on recent versions --------- Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
A compressed-tensors checkpoint that only quantizes the KV cache (`kv_cache_scheme` set, no `config_groups`) crashed at load time: `get_experts_scheme` indexed `groups[0]` on an empty list from `serialized_names` and `get_load_operations`. Guard both on empty config groups, like the existing sparsity-only case, and add a CI test on inference-optimization/TinyQwen3-KV-Cache-Only that checks the scales load onto every attention module.
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: afmoe, aimv2, albert, align, altclip, apertus, arcee, aria, audioflamingo3, auto, axk1, axk2, aya_vision, bailing_hybrid, bamba, bark |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft for discussion.
Given #49848 was recently merged, this PR builds on top of it and #49851 to further extend the use of
expert_dtype, rather than supporting MiniMax's custommoe_quant_algo. This would encourage the use of standard / well known configurations rather than exploding per-lab variants.I merged
mainto bring the changes from #49848. The only new commit is f3617b8.Tested locally on a modified version of the MiniMax checkpoint with the appropriate quantization_config.
If something like this goes forward, then this Hub PR should no longer be necessary (assuming MiniMax accepts the proposed configuration).
cc @IlyasMoutawwakil as the main author, @Cyrilvallez as he's looking into nvfp4 right now, and @LysandreJik about the transformers counterpart of the Hub PR.