AutoEP: read and write the transformers output-capture registry as a dict #9029
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 494 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.371
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9029"
general
weight: 0.35
delock
AutoEP: read and write the transformers output-capture registry as a dict
Problem
cpu-torch-latestinstalls transformers from gitmain, and since 2026-11-06 it fails on every PR with:Cause
huggingface/transformers#49594 (commit
c5bd76ec51, 2026-11-06) changedtransformers.utils.output_capturing._CAN_RECORD_REGISTRYfrom a plain dict toclass _CanRecordRegistry(dict), whoseget(model)and__setitem__(model, value)take a model and usestr(model.__class__)as the key. The released transformers 5.22.1 and 5.22.2 still have the plain dict.AutoEP's
router_logitsretargeting (deepspeed/module_inject/auto_ep_presets/base.py) uses the registry as a plain dict keyed bystr(module.__class__):| Line | Call | With the new class |
|---|---|---|
| 326 |
registry.get(key, default)|TypeError(the failure above) || 364 |
registry.get(key)| looks up"<class 'str'>"and returns{}|| 305 |
registry[key] = entry(restore) | stores under"<class 'str'>"|registry.popandregistry.updateare not overridden and keep working.Change
| Where | What |
|---|---|
|
deepspeed/module_inject/auto_ep_presets/base.py| Two helpers,_registry_getand_registry_set, calldict.getanddict.__setitem__directly; lines 305, 326 and 364 use them. The keys staystr(module.__class__), which is also what the subclass stores under, so this works for both registry shapes. ||
tests/unit/v1/moe/test_autoep_unit.py|TestTransformersOutputRecorderRegistry: runs_install_instance_transformers_output_recorderswith a plain dict and with a dict subclass that mirrors the newget(model)/__setitem__(model, value); checks that the retargeted entries are visible under the class key while the hooks are installed, and that the registry is restored exactly afterwards (the original entry back, the added one removed). CI runs one transformers version, so this covers both shapes in every run. |Duplicate check
Searched open PRs and issues on 2026-11-06 for "_CanRecordRegistry", "_CAN_RECORD_REGISTRY", "output capture registry" and the error message: none found.
Tests
Hardware: CPU only (
DS_ACCELERATOR=cpu), Intel Xeon Platinum 8375C, Ubuntu 22.04.5, CPython 3.12.14, torch 2.10.0, pytest 8.3.5, pytest-xdist 3.8.0. Command, fromtests/:pytest --forked -n 4 unit/v1/moe/test_autoep_unit.py(as incpu-torch-latest).|
unit/v1/moe/test_autoep_unit.py| transformers 5.22.1 (plain dict) | transformersmainat073a202c6(_CanRecordRegistry) ||---|---|---|
| master (
8af59b2e7) | 197 passed, 6 skipped | 2 failed (the two tests above), 195 passed, 6 skipped || this PR | 199 passed, 6 skipped | 199 passed, 6 skipped |
| the new test on master's code |
plain_dictpasses,model_keyedfails |plain_dictpasses,model_keyedfails |pre-commit run --fileson both changed files: all hooks pass.Not run: GPU (the change touches only registry reads and writes on the host).
Compatibility
AutoEP with Hugging Face models that record
router_logits: the Mixtral, MiniMax-M3 and Qwen3-MoE presets (throughTransformersTopLevelRouterLogitsAdapter) and the Qwen3.5-MoE preset use this path. Works with transformers 5.22.x and with transformersmain. No ZeRO, offload, precision or parallelism behavior changes.AI assistance
This change, its test and this description were prepared with AI assistance (Claude), which also ran the tests above.
🤖 Generated with Claude Code