docs(esm2_native_te): add torch.compile troubleshooting note - #1703
melissa-sanabria wants to merge 1 commit into
Conversation
Signed-off-by: Melissa Sanabria <52778364+melissa-sanabria@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Could a maintainer please add the ciflow:skip label? This is a docs-only change. |
|
torch compile isn't really supported with TE layers (yet), but thanks for the note! use_torch_compile should be off by default though: |
I tried to run it and I had the error, it worked just after adding the flag. For some reason the default config of use_torch_compile was not taken into account. |
Description
Problem
When running multi-GPU training with torchrun, users may hit the following error:
AssertionError: assert len(self.block_stack) == 1
File "/workspace/bionemo/modeling_esm_te.py", line 259, in forward
with self.get_autocast_context(None, outer=True):
This is a torch.compile incompatibility: TorchDynamo cannot trace through a context manager returned by a method call (self.get_autocast_context(...)). Dynamo has limited support for dynamic context managers, especially ones that wrap torch.autocast in non-trivial ways. As a result, the compilation graph breaks and raises an AssertionError from within the block stack tracker.
Fix
This PR adds a Troubleshooting subsection under ## Commands to Launch Training documenting the known workaround: passing use_torch_compile=false to disable torch.compile at launch time:
torchrun --nproc_per_node=8 train_fsdp2.py use_torch_compile=false
Changes
recipes/esm2_native_te/README.md: added a ### Troubleshooting section with the error signature, root cause explanation, and the workaround command.
Notes
No code changes are included. This is a docs-only PR. The underlying issue — making get_autocast_context compatible with TorchDynamo tracing — would require a separate fix in modeling_esm_te.py
Type of changes
CI Pipeline Configuration
[ciflow:skip]
Configure CI behavior by applying the relevant labels. By default, only basic unit tests are run.
Unit tests marked as
@pytest.mark.multi_gpuor@pytest.mark.distributedare not run in the PR pipeline.For more details, see CONTRIBUTING
Note
By default, only basic unit tests are run. Add appropriate labels to enable an additional test coverage.
Authorizing CI Runs
We use copy-pr-bot to manage authorization of CI
runs on NVIDIA's compute resources.
automatically be copied to a pull-request/ prefixed branch in the source repository (e.g. pull-request/123)
/ok to testcomment on the pull request to trigger CI. This will need to be done for each new commit.Triggering Code Rabbit AI Review
To trigger a code review from code rabbit, comment on a pull request with one of these commands:
See https://docs.coderabbit.ai/reference/review-commands for a full list of commands.
Pre-submit Checklist