Repository navigation
[profiler] Suppress Callable field from tyro CLI parsing - #3038
Merged
Merged
Conversation
The `trace_post_processor` field added in pytorch#2926 uses `Function.Config` which contains `fn: Callable[..., R]`. tyro cannot parse `Callable` types from CLI arguments, causing all training runs to crash with: Invalid input to tyro.cli() Unsupported type annotation for field profiler.trace-post-processor.fn with type collections.abc.Callable[..., typing.Any] Fix: annotate with `tyro.conf.Suppress`, matching the existing pattern used for `model_spec` in `trainer.py` and `sample_processor` in `text_datasets.py`. The field defaults to `None` and is only set programmatically by graph_trainer's `CUDAGraphWrapper`.
saforem2
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
April 21, 2026 14:34
|
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a config-parsing crash in Torchtitan’s CLI by preventing tyro from attempting to parse a Callable[..., Any] embedded in Profiler.Config.trace_post_processor (introduced via Function.Config).
Changes:
- Mark
Profiler.Config.trace_post_processorastyro.conf.Suppressviatyping.Annotatedso it’s excluded from CLI parsing/help generation. - Add a clarifying docstring note that the field is set programmatically (not via CLI).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wwwjn
reviewed
Apr 21, 2026
wwwjn
left a comment
Contributor
There was a problem hiding this comment.
Thanks this PR looks good to me and I also verified it fixed locally, can you fix the lint before merging?
wwwjn
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash introduced by #2926 where
trace_post_processor: Function.Config | NoneinProfiler.Configcausestyro.cli()to fail because tyro cannot parseCallable[..., Any]types from CLI arguments.Error:
Fix: Annotate
trace_post_processorwithtyro.conf.Suppress, matching the existing pattern used for:model_specintrainer.py:62sample_processorintext_datasets.py:502The field defaults to
Noneand is only set programmatically byCUDAGraphWrapper, never via CLI.Test plan
python -m torchtitan.train ...no longer crashes at config parsing