Repository navigation
quantize on config instead of on model - #3127
Conversation
…ytorch#3127) Upstream pytorch#3127 (quantize-on-config) removed model_converters from JobConfig and from every parallelize_* signature. Quantization is now applied to the model config at model_registry time rather than to the runtime model. - agpt/parallelize.py + moe/parallelize.py — drop model_converters kwarg and the ModelConvertersContainer import. - ezpz/trainer.py — drop: - runtime config.model_converters.build()/convert(model) - the register_step_post_hook post_optimizer_hook (runtime quant updates are gone; quantization runs in forward via the converted config) - model_converters= kwargs from both parallelize_fn and pipelining_fn call sites - the QuantizationConverter import Switches has_quantization to read from model_config via torchtitan.components.quantization.utils.has_quantization.
- moe/__init__.py: extend model_registry() with a quantization parameter
that takes list[QuantizationConverter.Config]. Each converter is
applied to the model config via q.build().convert(config) before the
ModelSpec is returned. Mirrors upstream's deepseek_v3 pattern.
- moe/config_registry.py: moe_671b() now re-registers via
cfg.model_spec = model_registry("671B", quantization=[...]) instead
of mutating cfg.model_converters (which no longer exists). Drop the
ModelConvertersContainer import.
- upstream-sync.md: 22nd-sync entry covering pytorch#3127 (quantize-on-config),
pytorch#2986 (LocalMapInnerAttention removal), and the MeshDimName ->
MeshAxisName rename, plus what was replayed.
22nd sync (pytorch#3127 quantize-on-config, pytorch#2986 LocalMapInnerAttention removal, pytorch#3113 MeshDimName rename). Documents the four replay commits, the Float8GroupedMMConverter -> Float8GroupedExpertsConverter rename caught during smoke-testing, and the smoke-test results (agpt 12.92 -> 7.14 across 50 steps, exit 0; moe in flight on the same trajectory).
|
|
||
| # Parallel styles used for transformer block linear weights and their | ||
| # inputs may be different for float8 linears with tensorwise scaling. | ||
| if enable_float8_tensorwise_tp: |
There was a problem hiding this comment.
Sorry for posting comment on merged PR.
But I'm curious why tensorwise was removed? We currently run an older version of torchtitan and use this, and we observe MFU drop when switching to rowwise, consistent with documentation: https://docs.pytorch.org/ao/stable/workflows/training.html
|
@zpw1337 for sure tensorwise can give faster MFU, so it's not surprise. The interesting part is the tradeoff between MFU and numerics (tensorwise is "less accurate" compared with rowwise / blockwise). Can I ask if you have evidence that tensorwise gives better model quality? |
Thanks for the reply. I'm not implying tensorwise gives better model quality. It's just that we've been training models with preference of higher MFU. I'm wondering it would reasonable to expose both and let the user choose like before? |
This is where I'm interested in learning convincing benefits over blindly supporting as many features as possible. Could you show at least one tech report / blog post which says one could train a good model with tensorwise fp8? |
We trained video DiTs up to 4B params dense with tensorwise fp8, we are writing a report + open sourcing the code for them in the next couple weeks. We haven't seen much numerics degradation with tensorwise, but we don't mind moving to row/blockwise for our next bigger runs if that does not hurt MFU much. With that said, the diff to add back support for tensorwise + enable_fsdp_float8_all_gather + precompute_float8_dynamic_scale_for_fsdp is fairly small. |
Continuation of #3032 (accidentally merged to wrong base branch). See #3032 for full description.