Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@Edwardf0t1, could you help get the unit-test workflow approved for |
|
I checked this branch against current |
Resolve the existing scripted backward helper from its defining module. Keep the compiled math and public namespace unchanged. Signed-off-by: momu <[email protected]>
be3f025 to
54be831
Compare
|
Hi @Edwardf0t1, could you please help get CI approved for the current head,
|
What does this PR do?
Type of change: Bug fix
Importing
modelopt.torch.quantizationfails on PyTorch2.16.0.dev20261116because the backward helper's@torch.jit.scriptdecorator references an entry point that PyTorch no longer re-exports. This also blocks downstream quantized export/runtime tests before a model can run.Import the same implementation from
torch.jit._scriptunder a private alias and use it for the existing decorator. The helper remains a compiled TorchScript function; its math, dtype handling, STE/clipped backward behavior, and device operations are unchanged. The private alias does not expand the module's public star-import surface.Usage
Existing usage works without changes:
Testing
Matched original/repaired source at base
e03b63b27c2a94701e125c429707cc0101aaa5bb, on Linux with Python 3.12.3 andtorch==2.16.0.dev20261116+cpu:AttributeError: module 'torch.jit' has no attribute 'script'fromtensor_quant.py.test_tensor_quant_cpu.pycases:TestFakeTensorQuantCPU(including STE and clipped gradients), INT8/INT4 strict capture, FP8 strict capture, and registered CPU quantization versus eager across scale layouts and dtypes. Longest test call: 0.11 s.os.sched_getaffinityreference in the unchanged Megatron data tool; the same hook version/default arguments with--platform linuxpass for this file. No source/config suppression was added.git diff --checkpasses. The source still matches the tested snapshot after hooks.Before your PR is "Ready for review"
CONTRIBUTING.md: N/A — neither copied code nor new dependencies.Additional Information
Observed while repairing the current-PyTorch checks in pytorch/TensorRT#4952. ModelOpt 0.49.0rc0 has the same decorator; please consider the ongoing release branch for the import fix.
Summary by CodeRabbit
torch.jit.scriptis no longer available through the top-level PyTorch module.