Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
607 commits
Select commit Hold shift + click to select a range
068a3d9
Merge branch 'main' into 20260421_torchao_nvfp4_fix
SunMarc Apr 22, 2026
e902b1b
Merge branch 'main' into clip_tokenizer_max_model_length
Brianzhengca Apr 22, 2026
5c4a210
Guard `s_aux` cast in `flash_attention_forward` for sink-less models
jamesbraza Apr 23, 2026
dba89fd
[nemotron_h] respect _no_reinit flag on dt_bias and out_proj.weight
vai-minzhou Apr 23, 2026
2920dd7
fix padding side issue for fast_vlm tests
kaixuanliu Apr 23, 2026
83926d1
add XPU Expectation
kaixuanliu Apr 23, 2026
3606baf
Merge branch 'main' into fast-vlm-fix
kaixuanliu Apr 23, 2026
1aa1d50
fix small conflict and add comment
Cyrilvallez Apr 23, 2026
95a4781
fix 2 failed test cases for blt model on XPU
kaixuanliu Apr 23, 2026
a4f77a9
fix: Resolve backbone test regressions
harshaljanjani Apr 23, 2026
bb18772
Apply repo consistency fixes
github-actions[bot] Apr 23, 2026
7bd12b3
Merge branch 'main' into cb-very-long-gen
remi-or Apr 23, 2026
9fb7a64
align
Cyrilvallez Apr 23, 2026
1695d37
Fix
remi-or Apr 23, 2026
6b45f17
Merge branch 'main' into cb-very-long-gen
remi-or Apr 23, 2026
4888862
Merge branch 'main' into fix/paged-num-return-sequences-warning
remi-or Apr 23, 2026
2454afb
fix: compute auxiliary losses when denoising is disabled in D-FINE
Abineshabee Apr 23, 2026
d7a3935
style: fix formatting
Abineshabee Apr 23, 2026
4090f24
update expectations for gemma3n
Abdennacer-Badaoui Apr 23, 2026
70a1530
Make EtaLogitsWarper fail fast on fully masked rows
ezylopx5 Apr 23, 2026
2648669
Merge PR #43254
evalstate Apr 23, 2026
d05cad3
Merge PR #43251
evalstate Apr 23, 2026
3fc3e80
Check fully-masked rows before softmax in eta warper
ezylopx5 Apr 23, 2026
d98bad4
Merge branch 'main' into fix-deepspeed-ep-init
AmineDiro Apr 23, 2026
ff13d50
fix: continue when content is a string
RyanMullins Apr 23, 2026
5233d19
infer from config instead of hardcoding
eustlb Apr 23, 2026
535353c
Update test_modeling_gemma4.py
mathceo Apr 23, 2026
91d179d
test: add regression test for auxiliary losses when denoising is disa…
Abineshabee Apr 23, 2026
8659ae6
test: fix num_labels config in auxiliary loss regression test
Abineshabee Apr 23, 2026
8aa98af
Update modeling_gemma4.py
mathceo Apr 23, 2026
3a6ec39
Update modeling_gemma4.py
mathceo Apr 23, 2026
80f2d35
Update modeling_gemma4.py
mathceo Apr 23, 2026
529524f
Merge branch 'main' into fix/dfine-aux-loss-without-denoising
yonigozlan Apr 23, 2026
f515c11
Raise clear error for problem_type="single_label_classification" with…
gaurav0107 Apr 23, 2026
008d9e9
Switch to canonical _is_hf_initialized flag per review
vai-minzhou Apr 24, 2026
b8ef47c
Merge branch 'main' into fix/seq2seq-decoder-encoder-attention-mask
duyhv-qualgo Apr 24, 2026
c3ef3d6
fix(qianfan_ocr): auto-fix failing tests
kaixuanliu Apr 24, 2026
4df9607
Merge branch 'main' into fix/eta-warper-all-inf
Cyrilvallez Apr 24, 2026
89af6a5
Merge branch 'main' into fix/paged-num-return-sequences-warning
remi-or Apr 24, 2026
66bbcd4
remove warnings
Cyrilvallez Apr 24, 2026
4ec7e84
fix
Cyrilvallez Apr 24, 2026
2835b3f
revert
Cyrilvallez Apr 24, 2026
cbc79ea
revert useless
Cyrilvallez Apr 24, 2026
4f7488b
move function outside
Cyrilvallez Apr 24, 2026
ab9e2a7
fix
Cyrilvallez Apr 24, 2026
ab8061c
skip
Cyrilvallez Apr 24, 2026
8a1286f
skip
Cyrilvallez Apr 24, 2026
697873d
Add supports_gradient_checkpointing to NemotronHPreTrainedModel
sergiopaniego Apr 24, 2026
bbe5074
Merge branch 'main' into remove-hardcoded-rel-pos-gemma4
eustlb Apr 24, 2026
cc87b12
Merge branch 'gemma4-audio-rel-pos-test' into remove-hardcoded-rel-po…
eustlb Apr 24, 2026
da66c69
make style
eustlb Apr 24, 2026
343af8e
Processing Utils: honor pre-built sub-processor kwargs in from_pretra…
javierdejesusda Apr 24, 2026
f4b77d1
Update src/transformers/configuration_utils.py
Rocketknight1 Apr 24, 2026
c3d94f1
Update tests/utils/test_configuration_utils.py
Rocketknight1 Apr 24, 2026
787cc3b
Update src/transformers/configuration_utils.py
Rocketknight1 Apr 24, 2026
3950381
Merge branch 'main' into nemotron-h-supports-gradient-checkpointing
sergiopaniego Apr 24, 2026
5263fd9
Make patched testing debug logs xdist-safe
oleksii-tumanov Apr 22, 2026
1084d27
Keep xdist debug log patch narrowly scoped
oleksii-tumanov Apr 24, 2026
ee4c598
Fix NameError in serving CLI due to conditional import asymmetry
abhiprd200 Apr 24, 2026
1e3504b
Fix NameError in serving CLI due to conditional import asymmetry
abhiprd200 Apr 24, 2026
7889d44
Fix local trust_remote_code cache key collisions
Jeevang1-epic Apr 24, 2026
08ac3d8
Move repetition penalty guard to logits processor
ruben-aghayan Apr 25, 2026
0361926
Merge branch 'main' into fix-repetition-penalty-inputs-embeds
ruben-aghayan Apr 25, 2026
b1b7f06
upd test
Beichen-Ma Apr 25, 2026
b8c3dff
Merge branch 'main' into fix-cross-attention-cache-not-sliding
Beichen-Ma Apr 25, 2026
662508f
style: fix formatting and linting across all serving files
abhiprd200 Apr 25, 2026
27716a3
chore: bypass pyright type checking for dynamic variables
abhiprd200 Apr 25, 2026
a4d0e8b
style: apply ruff format to serving directory
abhiprd200 Apr 25, 2026
a3247ed
Merge branch 'main' into fix/serving-conditional-imports
abhiprd200 Apr 25, 2026
9abd5e7
Truncate hash to 16 chars to prevent Windows path length issues
Jeevang1-epic Apr 25, 2026
74480d4
Skip CPU param materialization on non-rank-0 FSDP ranks to avoid OOM
AmineDiro Apr 25, 2026
c0b6ec0
Fix KeyError for flash_attn in import_utils.py on Python 3.13
aryanp2107 Apr 25, 2026
692800d
Optimize LengthGroupedSampler length computation with select_columns …
AlrIsmail Apr 26, 2026
388ad09
Merge branch 'main' into gemma4-fix
kaixuanliu Apr 27, 2026
6165de2
update
kaixuanliu Apr 27, 2026
1bf5d58
[MistralCommonBackend] Soften validation mode and apply_chat_template…
juliendenize Apr 24, 2026
5e736f6
style
juliendenize Apr 24, 2026
587b45d
Remove error catch of ChatCompletionRequest.from_openai
juliendenize Apr 27, 2026
7a52c40
Merge branch 'main' into torch-type
zucchini-nlp Apr 27, 2026
ee7174e
fix the order
zucchini-nlp Apr 27, 2026
d404da9
add small docstring for reference
vasqu Apr 27, 2026
e00d26b
add a small comment
vasqu Apr 27, 2026
989ec75
fix: update PeftConfigLike import to improve type hinting
qgallouedec Apr 27, 2026
ea62f77
style
qgallouedec Apr 27, 2026
dcf9519
glmasr should be in AutoModelForMultimodalLM
eustlb Apr 28, 2026
cb7ba4d
add dia to MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES
eustlb Apr 28, 2026
ba51f15
update revision for Phi-4 model to make it run w/o remote code
kaixuanliu Apr 28, 2026
1174779
update
kaixuanliu Apr 28, 2026
edf31a4
fix
Abdennacer-Badaoui Apr 28, 2026
5f588b5
Merge branch 'main' into small-fix-tp
3outeille Apr 28, 2026
c2f5df2
Fix shared config mutation issue in flash_attn_from_config
kaixuanliu Apr 28, 2026
12c8a3c
Restore TokenizersBackend dispatch for MODELS_WITH_INCORRECT_HUB_TOKE…
ArthurZucker Apr 28, 2026
1101322
FIX Restore LoRA hotswapping functionality
BenjaminBossan Apr 28, 2026
7c31998
Merge branch 'mergeability-pr-45682' into all-defects
evalstate Apr 28, 2026
f72969d
Merge branch 'mergeability-pr-45681' into all-defects
evalstate Apr 28, 2026
42436d5
Merge branch 'mergeability-pr-45678' into all-defects
evalstate Apr 28, 2026
e036c99
Merge branch 'mergeability-pr-45675' into all-defects
evalstate Apr 28, 2026
4a15b25
Merge branch 'mergeability-pr-45671' into all-defects
evalstate Apr 28, 2026
36d19f0
Merge branch 'mergeability-pr-45670' into all-defects
evalstate Apr 28, 2026
e69eb1a
Fix EP+FSDP2: wrap EP-sharded params as DTensors and exclude experts …
AmineDiro Apr 27, 2026
83a5245
cleanup imports
AmineDiro Apr 27, 2026
438d452
Apply _local() to expert biases under EP
AmineDiro Apr 27, 2026
6b983d8
Fix import ordering
AmineDiro Apr 27, 2026
2eab354
Refactor EP sharding to apply DTensor wrapping during loading
AmineDiro Apr 28, 2026
b13aec1
Merge branch 'mergeability-pr-45658' into all-defects
evalstate Apr 28, 2026
1283a64
Merge branch 'mergeability-pr-45655' into all-defects
evalstate Apr 28, 2026
4596a4f
Merge branch 'mergeability-pr-45651' into all-defects
evalstate Apr 28, 2026
22548c6
Merge branch 'mergeability-pr-45650' into all-defects
evalstate Apr 28, 2026
0514bb6
Merge branch 'mergeability-pr-45649' into all-defects
evalstate Apr 28, 2026
e875679
Merge branch 'mergeability-pr-45642' into all-defects
evalstate Apr 28, 2026
24e90da
Merge branch 'mergeability-pr-45641' into all-defects
evalstate Apr 28, 2026
7271e9d
Merge branch 'mergeability-pr-45639' into all-defects
evalstate Apr 28, 2026
701f9e6
Merge branch 'mergeability-pr-45628' into all-defects
evalstate Apr 28, 2026
3dfc730
Merge branch 'mergeability-pr-45627' into all-defects
evalstate Apr 28, 2026
f359002
Merge branch 'mergeability-pr-45625' into all-defects
evalstate Apr 28, 2026
6e97095
Merge branch 'mergeability-pr-45624' into all-defects
evalstate Apr 28, 2026
877946c
Merge branch 'mergeability-pr-45622' into all-defects
evalstate Apr 28, 2026
91276bd
Merge branch 'mergeability-pr-45619' into all-defects
evalstate Apr 28, 2026
745134c
Merge branch 'mergeability-pr-45615' into all-defects
evalstate Apr 28, 2026
fa3b672
Merge branch 'mergeability-pr-45611' into all-defects
evalstate Apr 28, 2026
cba652e
Merge branch 'mergeability-pr-45606' into all-defects
evalstate Apr 28, 2026
dac2bd5
Merge branch 'mergeability-pr-45605' into all-defects
evalstate Apr 28, 2026
6fb3353
Merge branch 'mergeability-pr-45603' into all-defects
evalstate Apr 28, 2026
0e749e3
Merge branch 'mergeability-pr-45602' into all-defects
evalstate Apr 28, 2026
6eeaefc
Merge branch 'mergeability-pr-45601' into all-defects
evalstate Apr 28, 2026
6997664
Merge branch 'mergeability-pr-45598' into all-defects
evalstate Apr 28, 2026
2de91a9
Merge branch 'mergeability-pr-45596' into all-defects
evalstate Apr 28, 2026
a50f972
Merge branch 'mergeability-pr-45594' into all-defects
evalstate Apr 28, 2026
c5872d3
Merge branch 'mergeability-pr-45592' into all-defects
evalstate Apr 28, 2026
8edb7e0
Merge branch 'mergeability-pr-45591' into all-defects
evalstate Apr 28, 2026
503874e
Merge branch 'mergeability-pr-45589' into all-defects
evalstate Apr 28, 2026
d5b207f
Merge branch 'mergeability-pr-45582' into all-defects
evalstate Apr 28, 2026
57b233f
Merge branch 'mergeability-pr-45578' into all-defects
evalstate Apr 28, 2026
b773ba4
Merge branch 'mergeability-pr-45573' into all-defects
evalstate Apr 28, 2026
a9cea83
Merge branch 'mergeability-pr-45570' into all-defects
evalstate Apr 28, 2026
75e085e
Merge branch 'mergeability-pr-45568' into all-defects
evalstate Apr 28, 2026
571e5f2
Merge branch 'mergeability-pr-45566' into all-defects
evalstate Apr 28, 2026
5bbf2c8
Merge branch 'mergeability-pr-45564' into all-defects
evalstate Apr 28, 2026
8ddce76
Merge branch 'mergeability-pr-45562' into all-defects
evalstate Apr 28, 2026
6e94f29
Merge branch 'mergeability-pr-45552' into all-defects
evalstate Apr 28, 2026
6739b9b
Merge branch 'mergeability-pr-45549' into all-defects
evalstate Apr 28, 2026
6276a79
Merge branch 'mergeability-pr-45548' into all-defects
evalstate Apr 28, 2026
a6766c8
Merge branch 'mergeability-pr-45541' into all-defects
evalstate Apr 28, 2026
560ff6b
Merge branch 'mergeability-pr-45540' into all-defects
evalstate Apr 28, 2026
734eaf4
Merge branch 'mergeability-pr-45539' into all-defects
evalstate Apr 28, 2026
408c91e
Merge branch 'mergeability-pr-45530' into all-defects
evalstate Apr 28, 2026
5a12a11
Merge branch 'mergeability-pr-45523' into all-defects
evalstate Apr 28, 2026
78471d8
Merge branch 'mergeability-pr-45510' into all-defects
evalstate Apr 28, 2026
304886f
Apply PR 45501 label mapping prediction fix
evalstate Apr 28, 2026
4faea89
Apply PR 45499 GLUE id2label mapping fix
evalstate Apr 28, 2026
545e8c6
Merge branch 'mergeability-pr-45444' into all-defects
evalstate Apr 28, 2026
7536670
Merge branch 'mergeability-pr-45443' into all-defects
evalstate Apr 28, 2026
0f59d13
Merge branch 'mergeability-pr-45441' into all-defects
evalstate Apr 28, 2026
93d0e15
Merge branch 'mergeability-pr-45437' into all-defects
evalstate Apr 28, 2026
f2f1044
Merge branch 'mergeability-pr-45435' into all-defects
evalstate Apr 28, 2026
90b1489
Merge branch 'mergeability-pr-45428' into all-defects
evalstate Apr 28, 2026
b901114
Merge branch 'mergeability-pr-45427' into all-defects
evalstate Apr 28, 2026
cb6aabd
Merge branch 'mergeability-pr-45423' into all-defects
evalstate Apr 28, 2026
11781e2
Merge branch 'mergeability-pr-45422' into all-defects
evalstate Apr 28, 2026
acbc4ec
Merge branch 'mergeability-pr-45421' into all-defects
evalstate Apr 28, 2026
f6584b8
Merge branch 'mergeability-pr-45420' into all-defects
evalstate Apr 28, 2026
e50e34e
Merge branch 'mergeability-pr-45414' into all-defects
evalstate Apr 28, 2026
4bb11ff
Merge branch 'mergeability-pr-45413' into all-defects
evalstate Apr 28, 2026
134a810
Merge branch 'mergeability-pr-45411' into all-defects
evalstate Apr 28, 2026
db41127
Merge branch 'mergeability-pr-45410' into all-defects
evalstate Apr 28, 2026
97e9d13
Merge branch 'mergeability-pr-45407' into all-defects
evalstate Apr 28, 2026
18b6c05
Merge branch 'mergeability-pr-45404' into all-defects
evalstate Apr 28, 2026
607cbe9
Merge branch 'mergeability-pr-45403' into all-defects
evalstate Apr 28, 2026
6abd9bf
Merge branch 'mergeability-pr-45402' into all-defects
evalstate Apr 28, 2026
589cbef
Merge branch 'mergeability-pr-45400' into all-defects
evalstate Apr 28, 2026
4d98967
Merge branch 'mergeability-pr-45394' into all-defects
evalstate Apr 28, 2026
f987e2e
Merge branch 'mergeability-pr-45389' into all-defects
evalstate Apr 28, 2026
47b7df5
Merge branch 'mergeability-pr-45388' into all-defects
evalstate Apr 28, 2026
75c2914
Merge branch 'mergeability-pr-45385' into all-defects
evalstate Apr 28, 2026
224963e
Merge branch 'mergeability-pr-45380' into all-defects
evalstate Apr 28, 2026
5d8078c
Merge branch 'mergeability-pr-45369' into all-defects
evalstate Apr 28, 2026
e495301
Merge branch 'mergeability-pr-45359' into all-defects
evalstate Apr 28, 2026
8195bfc
Merge branch 'mergeability-pr-45354' into all-defects
evalstate Apr 28, 2026
cbe5412
Merge branch 'mergeability-pr-45352' into all-defects
evalstate Apr 28, 2026
728d497
Merge branch 'mergeability-pr-45351' into all-defects
evalstate Apr 28, 2026
1d41876
Merge branch 'mergeability-pr-45347' into all-defects
evalstate Apr 28, 2026
50bfadf
Merge branch 'mergeability-pr-45346' into all-defects
evalstate Apr 28, 2026
9dc3399
Merge branch 'mergeability-pr-45345' into all-defects
evalstate Apr 28, 2026
edad657
Merge branch 'mergeability-pr-45320' into all-defects
evalstate Apr 28, 2026
c4f77d5
Merge branch 'mergeability-pr-45318' into all-defects
evalstate Apr 28, 2026
c948d0f
Merge branch 'mergeability-pr-45317' into all-defects
evalstate Apr 28, 2026
ff6a809
Merge branch 'mergeability-pr-45316' into all-defects
evalstate Apr 28, 2026
dc6dab6
Merge branch 'mergeability-pr-45311' into all-defects
evalstate Apr 28, 2026
0bbba12
Merge branch 'mergeability-pr-45302' into all-defects
evalstate Apr 28, 2026
933b067
Merge branch 'mergeability-pr-45300' into all-defects
evalstate Apr 28, 2026
4cc7f47
Merge branch 'mergeability-pr-45297' into all-defects
evalstate Apr 28, 2026
73b6fe8
Merge branch 'mergeability-pr-45293' into all-defects
evalstate Apr 28, 2026
fff5e1d
Merge branch 'mergeability-pr-45289' into all-defects
evalstate Apr 28, 2026
df0b9fb
Merge branch 'mergeability-pr-45286' into all-defects
evalstate Apr 28, 2026
b433d67
Merge branch 'mergeability-pr-45284' into all-defects
evalstate Apr 28, 2026
7685333
Merge branch 'mergeability-pr-45282' into all-defects
evalstate Apr 28, 2026
4ae03ac
Merge branch 'mergeability-pr-45281' into all-defects
evalstate Apr 28, 2026
c9cc099
cb error
SunMarc Apr 28, 2026
b6c7df3
Merge branch 'mergeability-pr-45277' into all-defects
evalstate Apr 28, 2026
0a72588
Apply PR #45275 ERNIE VL MoE config loading fix
evalstate Apr 28, 2026
e1b510c
Merge branch 'mergeability-pr-45273' into all-defects
evalstate Apr 28, 2026
a255b9c
Merge branch 'mergeability-pr-45272' into all-defects
evalstate Apr 28, 2026
ee83b93
Merge branch 'mergeability-pr-45691' into all-defects
evalstate Apr 28, 2026
b6573ec
Merge branch 'mergeability-pr-45263' into all-defects
evalstate Apr 28, 2026
36dc1bf
Merge branch 'mergeability-pr-45257' into all-defects
evalstate Apr 28, 2026
b8192fb
Merge branch 'mergeability-pr-45253' into all-defects
evalstate Apr 28, 2026
34fab90
Merge branch 'mergeability-pr-45252' into all-defects
evalstate Apr 28, 2026
f6eab75
Merge branch 'mergeability-pr-45247' into all-defects
evalstate Apr 28, 2026
55dddd0
Merge branch 'mergeability-pr-45240' into all-defects
evalstate Apr 28, 2026
a80a2cb
Merge branch 'mergeability-pr-45238' into all-defects
evalstate Apr 28, 2026
4db9349
Merge branch 'mergeability-pr-45236' into all-defects
evalstate Apr 28, 2026
5e3b781
Merge branch 'mergeability-pr-45225' into all-defects
evalstate Apr 28, 2026
e5e0710
Merge branch 'mergeability-pr-45224' into all-defects
evalstate Apr 28, 2026
1b03058
Merge branch 'mergeability-pr-45223' into all-defects
evalstate Apr 28, 2026
1e6f87a
Merge branch 'mergeability-pr-45221' into all-defects
evalstate Apr 28, 2026
f97b04a
Merge branch 'mergeability-pr-45214' into all-defects
evalstate Apr 28, 2026
559b0f6
Merge branch 'mergeability-pr-45211' into all-defects
evalstate Apr 28, 2026
52153a6
Merge branch 'mergeability-pr-45204' into all-defects
evalstate Apr 28, 2026
b152b5a
Merge branch 'mergeability-pr-45202' into all-defects
evalstate Apr 28, 2026
0211a18
Merge branch 'mergeability-pr-45199' into all-defects
evalstate Apr 28, 2026
7b7e27f
Merge branch 'mergeability-pr-45193' into all-defects
evalstate Apr 28, 2026
b78d9ff
Merge branch 'mergeability-pr-45188' into all-defects
evalstate Apr 28, 2026
3f10949
Merge branch 'mergeability-pr-45185' into all-defects
evalstate Apr 28, 2026
d47759e
Merge branch 'mergeability-pr-45173' into all-defects
evalstate Apr 28, 2026
1a7e9ed
Merge branch 'mergeability-pr-45169' into all-defects
evalstate Apr 28, 2026
e1030b8
Merge branch 'mergeability-pr-45156' into all-defects
evalstate Apr 28, 2026
083abc3
Merge branch 'mergeability-pr-45147' into all-defects
evalstate Apr 28, 2026
1f12e15
Merge branch 'mergeability-pr-45140' into all-defects
evalstate Apr 28, 2026
a46ff67
Merge branch 'mergeability-pr-45138' into all-defects
evalstate Apr 28, 2026
207ed53
Merge branch 'mergeability-pr-45131' into all-defects
evalstate Apr 28, 2026
8334e8a
Merge branch 'mergeability-pr-45124' into all-defects
evalstate Apr 28, 2026
979a54d
Merge branch 'mergeability-pr-45123' into all-defects
evalstate Apr 28, 2026
d2a6b51
Merge branch 'mergeability-pr-45117' into all-defects
evalstate Apr 28, 2026
2e34e8c
Merge branch 'mergeability-pr-45108' into all-defects
evalstate Apr 28, 2026
9e6abb9
Merge branch 'mergeability-pr-45107' into all-defects
evalstate Apr 28, 2026
0569ec9
Merge branch 'mergeability-pr-45098' into all-defects
evalstate Apr 28, 2026
11c7b92
Merge branch 'mergeability-pr-45091' into all-defects
evalstate Apr 28, 2026
96a7e28
Merge branch 'mergeability-pr-45090' into all-defects
evalstate Apr 28, 2026
b372e44
Merge branch 'mergeability-pr-45088' into all-defects
evalstate Apr 28, 2026
e005884
Merge branch 'mergeability-pr-45086' into all-defects
evalstate Apr 28, 2026
9439783
Merge branch 'mergeability-pr-45085' into all-defects
evalstate Apr 28, 2026
84d7b50
Merge branch 'mergeability-pr-45080' into all-defects
evalstate Apr 28, 2026
5257e0d
Merge branch 'mergeability-pr-45074' into all-defects
evalstate Apr 28, 2026
66e4441
Merge branch 'mergeability-pr-45069' into all-defects
evalstate Apr 28, 2026
f6fe71c
Merge branch 'mergeability-pr-45062' into all-defects
evalstate Apr 28, 2026
f901b63
Merge branch 'mergeability-pr-45061' into all-defects
evalstate Apr 28, 2026
92845ec
Merge branch 'mergeability-pr-45060' into all-defects
evalstate Apr 28, 2026
c3d2b83
Merge branch 'mergeability-pr-45056' into all-defects
evalstate Apr 28, 2026
02ae108
Apply PR #45055 fix for Trainer checkpoint configs
evalstate Apr 28, 2026
ae9e74b
Merge branch 'mergeability-pr-45053' into all-defects
evalstate Apr 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/pytorch/text-classification/run_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ def compute_metrics(p: EvalPrediction):
else:
predictions = np.argmax(predictions, axis=1)
output_predict_file = os.path.join(training_args.output_dir, "predict_results.txt")
id2label = model.config.id2label
if trainer.is_world_process_zero():
with open(output_predict_file, "w") as writer:
logger.info("***** Predict results *****")
Expand All @@ -721,10 +722,10 @@ def compute_metrics(p: EvalPrediction):
writer.write(f"{index}\t{item:3.3f}\n")
elif is_multi_label:
# recover from multi-hot encoding
item = [label_list[i] for i in range(len(item)) if item[i] == 1]
item = [id2label[i] for i in range(len(item)) if item[i] == 1]
writer.write(f"{index}\t{item}\n")
else:
item = label_list[item]
item = id2label[item]
writer.write(f"{index}\t{item}\n")
logger.info(f"Predict results saved at {output_predict_file}")
kwargs = {"finetuned_from": model_args.model_name_or_path, "tasks": "text-classification"}
Expand Down
7 changes: 4 additions & 3 deletions examples/pytorch/text-classification/run_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ def main():

if label_to_id is not None:
model.config.label2id = label_to_id
model.config.id2label = {id: label for label, id in config.label2id.items()}
model.config.id2label = {id: label for label, id in model.config.label2id.items()}
elif data_args.task_name is not None and not is_regression:
model.config.label2id = {l: i for i, l in enumerate(label_list)}
model.config.id2label = {id: label for label, id in config.label2id.items()}
model.config.id2label = {id: label for label, id in model.config.label2id.items()}

if data_args.max_seq_length > tokenizer.model_max_length:
logger.warning(
Expand Down Expand Up @@ -604,6 +604,7 @@ def compute_metrics(p: EvalPrediction):
tasks.append("mnli-mm")
predict_datasets.append(raw_datasets["test_mismatched"])

id2label = model.config.id2label
for predict_dataset, task in zip(predict_datasets, tasks):
# Removing the `label` columns because it contains -1 and Trainer won't like that.
predict_dataset = predict_dataset.remove_columns("label")
Expand All @@ -619,7 +620,7 @@ def compute_metrics(p: EvalPrediction):
if is_regression:
writer.write(f"{index}\t{item:3.3f}\n")
else:
item = label_list[item]
item = id2label[item]
writer.write(f"{index}\t{item}\n")

kwargs = {"finetuned_from": model_args.model_name_or_path, "tasks": "text-classification"}
Expand Down
6 changes: 6 additions & 0 deletions src/transformers/audio_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ def load_audio(audio: str | np.ndarray, sampling_rate=16000, timeout=None) -> np
# needed. Do not raise any errors if not installed or versions do not match
if is_torchcodec_available() and version.parse("0.3.0") <= TORCHCODEC_VERSION:
audio = load_audio_torchcodec(audio, sampling_rate=sampling_rate, timeout=timeout)
elif audio.rsplit("?", 1)[0].lower().endswith((".mp4", ".mkv", ".avi", ".mov", ".webm", ".flv", ".wmv")):
raise RuntimeError(
f"The audio source appears to be a video file ('{audio.split('/')[-1]}'). "
"librosa cannot decode video containers. "
"Install torchcodec>=0.3.0 (`pip install torchcodec`) to load audio from video files."
)
else:
audio = load_audio_librosa(audio, sampling_rate=sampling_rate, timeout=timeout)
elif not isinstance(audio, np.ndarray):
Expand Down
55 changes: 55 additions & 0 deletions src/transformers/cache_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,61 @@ def get_seq_length(self) -> int:
"""Returns the sequence length of the cached states."""
return self.cumulative_length

def reorder_cache(self, beam_idx: torch.LongTensor) -> None:
"""Reorders both the residual and quantized buffers for beam search."""
super().reorder_cache(beam_idx)
if hasattr(self, "_quantized_keys"):
dequant_keys = self._dequantize(self._quantized_keys)
dequant_values = self._dequantize(self._quantized_values)
dequant_keys = dequant_keys.index_select(0, beam_idx.to(dequant_keys.device))
dequant_values = dequant_values.index_select(0, beam_idx.to(dequant_values.device))
self._quantized_keys = self._quantize(dequant_keys.contiguous(), axis=self.axis_key)
self._quantized_values = self._quantize(dequant_values.contiguous(), axis=self.axis_value)

def crop(self, max_length: int) -> None:
"""Crop the residual buffer; re-quantize the whole state if the crop falls inside the quantized region."""
if max_length < 0:
max_length = self.get_seq_length() - abs(max_length)

if self.get_seq_length() <= max_length:
return

if not hasattr(self, "_quantized_keys"):
super().crop(max_length)
self.cumulative_length = max_length
return

# Reconstruct the full-precision tensor, crop, and re-quantize
dequant_keys = self._dequantize(self._quantized_keys)
dequant_values = self._dequantize(self._quantized_values)
full_keys = torch.cat([dequant_keys, self.keys], dim=-2) if self.keys.numel() > 0 else dequant_keys
full_values = torch.cat([dequant_values, self.values], dim=-2) if self.values.numel() > 0 else dequant_values
full_keys = full_keys[..., :max_length, :]
full_values = full_values[..., :max_length, :]
self._quantized_keys = self._quantize(full_keys.contiguous(), axis=self.axis_key)
self._quantized_values = self._quantize(full_values.contiguous(), axis=self.axis_value)
self.keys = torch.tensor([], dtype=self.keys.dtype, device=self.keys.device)
self.values = torch.tensor([], dtype=self.values.dtype, device=self.values.device)
self.cumulative_length = max_length

def batch_repeat_interleave(self, repeats: int) -> None:
"""Repeat both the residual and quantized buffers in the batch dimension."""
super().batch_repeat_interleave(repeats)
if hasattr(self, "_quantized_keys"):
dequant_keys = self._dequantize(self._quantized_keys).repeat_interleave(repeats, dim=0)
dequant_values = self._dequantize(self._quantized_values).repeat_interleave(repeats, dim=0)
self._quantized_keys = self._quantize(dequant_keys.contiguous(), axis=self.axis_key)
self._quantized_values = self._quantize(dequant_values.contiguous(), axis=self.axis_value)

def batch_select_indices(self, indices: torch.Tensor) -> None:
"""Select batch indices from both the residual and quantized buffers."""
super().batch_select_indices(indices)
if hasattr(self, "_quantized_keys"):
dequant_keys = self._dequantize(self._quantized_keys)[indices, ...]
dequant_values = self._dequantize(self._quantized_values)[indices, ...]
self._quantized_keys = self._quantize(dequant_keys.contiguous(), axis=self.axis_key)
self._quantized_values = self._quantize(dequant_values.contiguous(), axis=self.axis_value)


class QuantoQuantizedLayer(QuantizedLayer):
def __init__(
Expand Down
1 change: 1 addition & 0 deletions src/transformers/cli/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def __init__(
completion_handler=self._completion_handler,
response_handler=self._response_handler,
transcription_handler=self._transcription_handler,
generation_state=self._generation_state,
enable_cors=enable_cors,
)

Expand Down
77 changes: 61 additions & 16 deletions src/transformers/cli/serving/chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
from typing import TYPE_CHECKING

from ...utils import logging
from ...utils.import_utils import is_serve_available
from .utils import BaseGenerateManager, BaseHandler, Modality, _StreamError, get_tool_call_config, parse_tool_calls


if is_serve_available():
# --- BRUTE FORCE IMPORT PATCH ---
try:
from fastapi.responses import JSONResponse, StreamingResponse
from openai.types.chat import ChatCompletion, ChatCompletionMessage, ChatCompletionMessageToolCall
from openai.types.chat.chat_completion import Choice
Expand All @@ -35,26 +36,62 @@
from openai.types.chat.completion_create_params import CompletionCreateParamsStreaming
from openai.types.completion_usage import CompletionUsage

parent_class = CompletionCreateParamsStreaming
except ImportError:
from typing import TypedDict

from .utils import (
BaseGenerateManager,
BaseHandler,
Modality,
_StreamError,
get_tool_call_config,
parse_tool_calls,
)
class _DummyDict(dict):
def __getattr__(self, name):
return None

def __setattr__(self, name, value):
self[name] = value

if TYPE_CHECKING:
from transformers import GenerationConfig, PreTrainedModel, PreTrainedTokenizerFast, ProcessorMixin
class ChatCompletion(_DummyDict):
pass

class ChatCompletionMessage(_DummyDict):
pass

class ChatCompletionMessageToolCall(_DummyDict):
pass

class Choice(_DummyDict):
pass

class ChatCompletionChunk(_DummyDict):
pass

class ChoiceDelta(_DummyDict):
pass

class ChoiceDeltaToolCall(_DummyDict):
pass

class ChoiceChunk(_DummyDict):
pass

class CompletionCreateParamsStreaming(_DummyDict):
pass

class CompletionUsage(_DummyDict):
pass

class TransformersCompletionCreateParamsStreaming(CompletionCreateParamsStreaming, total=False):
parent_class = TypedDict


class TransformersCompletionCreateParamsStreaming(parent_class, total=False): # type: ignore
generation_config: str
seed: int


# --- END PATCH ---


if TYPE_CHECKING:
from transformers import GenerationConfig, PreTrainedModel, PreTrainedTokenizerFast, ProcessorMixin


# Fields accepted by the OpenAI schema but not yet supported.
# Receiving these raises an error to avoid silent misbehaviour.
# NOTE: "stop" is NOT in this set — we map it to stop_strings.
Expand Down Expand Up @@ -133,7 +170,7 @@ async def handle_request(self, body: dict, request_id: str) -> StreamingResponse
**chat_template_kwargs,
)
if not use_cb:
inputs = inputs.to(model.device) # type: ignore[union-attr]
inputs = inputs.to(model.device) # type: ignore

gen_config = self._build_generation_config(body, model.generation_config, use_cb=use_cb)
# TODO: remove when CB supports per-request generation config
Expand Down Expand Up @@ -237,7 +274,10 @@ async def sse_gen() -> AsyncGenerator[str, None]:
index=i,
type="function",
id=f"{request_id}_tool_call_{i}",
function={"name": tc["name"], "arguments": tc["arguments"]},
function={
"name": tc["name"],
"arguments": tc["arguments"],
},
)
],
)
Expand Down Expand Up @@ -328,7 +368,12 @@ async def _non_streaming(

# ----- helpers -----

def _build_generation_config(self, body: dict, model_generation_config: "GenerationConfig", use_cb: bool = False):
def _build_generation_config(
self,
body: dict,
model_generation_config: "GenerationConfig",
use_cb: bool = False,
):
"""Apply Chat Completions params (``max_tokens``, ``frequency_penalty``, ``logit_bias``,
``stop``) on top of the base generation config."""
generation_config = super()._build_generation_config(body, model_generation_config, use_cb=use_cb)
Expand Down
48 changes: 39 additions & 9 deletions src/transformers/cli/serving/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import asyncio
import time
from collections.abc import AsyncGenerator
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, TypedDict

from ...utils import logging
from ...utils.import_utils import is_serve_available
Expand All @@ -34,19 +34,28 @@
from openai.types import Completion, CompletionChoice, CompletionUsage
from openai.types.completion_create_params import CompletionCreateParamsBase


from .utils import BaseGenerateManager, BaseHandler, _StreamError


if TYPE_CHECKING:
from transformers import GenerationConfig, PreTrainedModel, PreTrainedTokenizerFast, ProcessorMixin


class TransformersTextCompletionCreateParams(CompletionCreateParamsBase, total=False):
generation_config: str
seed: int
stream: bool
# --- FINAL ROBUST PATCH ---
if "CompletionCreateParamsBase" in globals():
# If the real OpenAI class was successfully imported, use it
class TransformersTextCompletionCreateParams(CompletionCreateParamsBase, total=False):
generation_config: str
seed: int

else:
# Fallback to standard TypedDict if OpenAI types are missing
class TransformersTextCompletionCreateParams(TypedDict, total=False):
generation_config: str
seed: int


# --- END PATCH ---

# Fields accepted by the OpenAI schema but not yet supported.
UNUSED_LEGACY_COMPLETION_FIELDS = {
Expand Down Expand Up @@ -109,10 +118,26 @@ async def handle_request(self, body: dict, request_id: str) -> "StreamingRespons
streaming = body.get("stream")

if streaming:
return self._streaming(request_id, model, processor, model_id, inputs, gen_config, gen_manager, suffix)
return self._streaming(
request_id,
model,
processor,
model_id,
inputs,
gen_config,
gen_manager,
suffix,
)
else:
return await self._non_streaming(
request_id, model, processor, model_id, inputs, gen_config, gen_manager, suffix
request_id,
model,
processor,
model_id,
inputs,
gen_config,
gen_manager,
suffix,
)

# ----- streaming -----
Expand Down Expand Up @@ -261,7 +286,12 @@ def _build_chunk_sse(

# ----- generation config -----

def _build_generation_config(self, body: dict, model_generation_config: "GenerationConfig", use_cb: bool = False):
def _build_generation_config(
self,
body: dict,
model_generation_config: "GenerationConfig",
use_cb: bool = False,
):
"""Apply legacy completion params (``max_tokens``, ``frequency_penalty``, ``stop``) on top of base config."""
generation_config = super()._build_generation_config(body, model_generation_config, use_cb=use_cb)

Expand Down
Loading