Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2623227bb9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def _get_num_experts_from_config(model_config, preset: MoEModelPreset) -> int | None: | ||
| """Extract num_experts from model.config using the preset's attribute name.""" | ||
| model_config = getattr(model_config, "text_config", model_config) |
There was a problem hiding this comment.
Add the required Signed-off-by trailer
This is a one-parent, non-merge commit, and git log --format='%B' 7e5c4fd3085d9076a170d2540f2f3e3de5d7e8f9 confirms that its body has no Signed-off-by trailer, so it does not meet the repository's DCO requirement; sign off the commit before merging.
AGENTS.md reference: AGENTS.md:L8-L9
Useful? React with 👍 / 👎.
| @@ -0,0 +1,88 @@ | |||
| --- | |||
There was a problem hiding this comment.
Add the required license header to the tutorial
This newly added tutorial starts directly with Jekyll front matter and contains neither the required SPDX line nor the DeepSpeed Team line; add the two comments inside the YAML front matter so the page remains valid while satisfying the new-file license requirement.
AGENTS.md reference: AGENTS.md:L13-L17
Useful? React with 👍 / 👎.
| assert_hifloat8_training_available, | ||
| convert_to_hifloat8_training, | ||
| ) | ||
| policy = HiFloat8Config.from_dict(config.get("config")) |
There was a problem hiding this comment.
Restrict FP16 outputs in BF16-only HiFloat8 training
When hifloat8.config.compute_dtype is set to the documented "float16" value, this accepts the policy even though HiFloat8 initialization requires a BF16 model. The tutorial states that GEMM results use the selected working dtype, and _run_experts_npu returns that result unchanged, so selected Dense/GroupedExperts modules emit FP16 into BF16 residual paths; FP16 plus BF16 promotes to FP32, after which the next ordinary BF16 linear fails on mismatched matrix dtypes. Reject FP16 here or cast converted module outputs back to their input dtype.
Useful? React with 👍 / 👎.
| from transformers import (Qwen3_5MoeTextConfig, Qwen3_5MoeConfig, Qwen3_5MoeForCausalLM, | ||
| Qwen3_5MoeForConditionalGeneration) |
There was a problem hiding this comment.
Guard the Qwen integration against older Transformers
In the inspected cpu-torch-latest manual PyPI path, Transformers defaults to 4.51.3 and the workflow runs the full unit suite, but that supported release predates all four Qwen3_5Moe* symbols imported here. Because the import is unconditional, this test errors rather than skipping the feature whose preset is itself version-gated; use pytest.importorskip plus the existing skip_unless_transformers_has pattern before constructing these models.
Useful? React with 👍 / 👎.
Signed-off-by: hazelduan <duanxueqi@outlook.com>
Signed-off-by: hazelduan <duanxueqi@outlook.com>
Signed-off-by: hazelduan <duanxueqi@outlook.com>
Signed-off-by: hazelduan <duanxueqi@outlook.com>
6b91ff0 to
95dd780
Compare
Selected Linear and AutoEP GroupedExperts train with HiFloat8 through one public TorchAO
quantize_call. AO now owns both configuration types and both registered handlers; DeepSpeed selects modules and manages training lifecycle without defining a grouped quantization handler or choosing a GEMM callable.RFC #8777 documents the architecture, quick start and historical compute/end-to-end comparisons.
Implementation:
HiFloat8GroupedConfigand the existing Linear recipe derive from AO's sharedHiFloat8Config. Grouped uses the inherited 15/15/224 defaults andfrom_dictvalidation. LegacyHiFloat8LinearConfignative-range defaults remain compatible. No nested policy wrapper is added.ModuleFqnToConfigmap and callsquantize_after AutoEP/device preparation and before optimizer creation.grouped_mmslot and binds the unchanged HiFloat8 grouped functional/autograd implementation. It imports no DeepSpeed container. The formerdeepspeed/runtime/torchao.pyadapter is removed.torchao.hifloat8configuration/probe APIs. Dense-only selection does not require grouped exports; selected experts requireHiFloat8GroupedConfigbefore conversion. There is no DeepSpeed reference tohifloat8_grouped_mmfor execution.deepspeed/ops/npu, independent of AO. DeepSpeed retains routing, padding, activation, communication, parameter/state identity and caller-facing dtype.Merge this fragment into the existing training configuration and use the normal
deepspeed.initialize(..., config=ds_config)call:{ "bf16": {"enabled": true}, "zero_optimization": {"stage": 2}, "hifloat8": { "enabled": true, "backend": "torchao", "module_name_patterns": ["*.experts", "*.shared_experts.*_proj"], "min_numel": 65536 } }Install the paired sources with
torchao>=0.18,<0.19, matching Torch/TorchNPU and CANN, and automatic activation enabled. No explicitimport torchao_npuis needed. AutoEP topology, optimizer/batch settings and trainable-parameter selection remain separate. See the tutorial.October 19 validation on Ascend950PR, original Conda Python3.11.15, Torch/TorchNPU2.11.0, TorchAO0.18.0, CANN9.1.0 and driver25.7.rc1:
torchand publictorchaoAPIs, converts a Linear and a plain grouped module together, and runs native forward/backward. There is no explicittorchao_npuimport and no DeepSpeed module loaded. The grouped configuration derives fromHiFloat8Config.The previous published source pair was DS
6b91ff09/ AO9c6dfb4. Reproduction:/data/dxq/hif8_a5_20260914/experiments/ao_grouped_handler_20261019_01(run_all.sh,postchecks.sh, source manifests, exact configs/rank tables, per-rank results and comparisons). Original packages and host permissions were preserved; device access uses a task-local non-root container identity and cache paths.The existing feature histories are consolidated by responsibility, preserving the final trees. No new PR was created.
DeepSpeed:
98caec79— fix(autoep): preserve Qwen3.5 routing and rank-local checkpoints9a87125d— feat(npu): expose native grouped GEMM through accelerator capabilitiesb49b298f— perf(autoep): generate large permutation indices on NPU95dd780c— feat(hifloat8): integrate AO-owned quantize_ training handlersAO:
6b034fd— fix: preserve NPU auto-activation during TorchAO discoveryea917fd— feat(ops): add differentiable native NPU grouped GEMMa388ef3— feat(hifloat8): register Linear and grouped training workflowse0d59bd— bench(hifloat8): separate timing, memory and kernel attributionCurrent sources: DeepSpeed
95dd780c, AOe0d59bd(MR31), Swift3e9994baf. Swift changes are documentation only. Draft boundaries remain BF16 parameters/ZeRO0–2 on NPU; reject ZeRO3, pipeline, AutoTP/custom MPU, explicit MoE and fused gate/up overrides. Full-parameter convergence, LoRA, AutoEP checkpoint recovery, quantized checkpoint ingestion, offload/compile, EP8, multi-node and CUDA low precision remain outside the established support.