Update torchtune component paths from utils to training in torchtune notebook#634
Open
johndmulhausen wants to merge 1 commit into
Open
Update torchtune component paths from utils to training in torchtune notebook#634johndmulhausen wants to merge 1 commit into
johndmulhausen wants to merge 1 commit into
Conversation
torchtune relocated several APIs out of torchtune.utils, so the
notebook's generated config crashed with:
AttributeError: module 'torchtune.utils' has no attribute 'metric_logging'
Updated component paths (verified against torchtune 0.6.1):
- torchtune.utils.metric_logging.WandBLogger
-> torchtune.training.metric_logging.WandBLogger
- torchtune.utils.FullModelHFCheckpointer
-> torchtune.training.FullModelHFCheckpointer
- torchtune.utils.profiler
-> torchtune.training.setup_torch_profiler
- torchtune.modules.get_cosine_schedule_with_warmup
-> torchtune.training.lr_schedulers.get_cosine_schedule_with_warmup
Fixes #579
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the torchtune notebook’s YAML _component_ references to match torchtune’s newer module layout (torchtune.training), fixing runtime config instantiation failures caused by stale torchtune.utils / torchtune.modules paths.
Changes:
- Update W&B metric logger component path to
torchtune.training.metric_logging.WandBLogger(in both the markdown snippet and the written YAML cell). - Update checkpointer component path to
torchtune.training.FullModelHFCheckpointer. - Update LR scheduler and profiler component paths to
torchtune.training.lr_schedulers.get_cosine_schedule_with_warmupandtorchtune.training.setup_torch_profiler.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
johndmulhausen
marked this pull request as ready for review
July 21, 2026 21:33
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.
What
Running the config generated by
colabs/torchtune/torchtune_and_wandb.ipynbfails with:torchtune relocated these APIs out of
torchtune.utils(and one out oftorchtune.modules) intotorchtune.training. This PR updates the stale_component_paths in the notebook's markdown YAML snippet and the%%writefile mistral_wandb_lora.yamlcell:torchtune.utils.metric_logging.WandBLoggertorchtune.training.metric_logging.WandBLoggertorchtune.utils.FullModelHFCheckpointertorchtune.training.FullModelHFCheckpointertorchtune.utils.profilertorchtune.training.setup_torch_profilertorchtune.modules.get_cosine_schedule_with_warmuptorchtune.training.lr_schedulers.get_cosine_schedule_with_warmupThe lr_scheduler and profiler paths match the ones used in torchtune's own bundled
recipes/configs/mistral/7B_lora_single_device.yaml. The profiler path is also the only value thelora_finetune_single_devicerecipe accepts (it asserts_component_ == torchtune.training.setup_torch_profiler). Inline# <---comments and all other YAML content are unchanged; the diff is 5 lines.Verification (against torchtune 0.6.1, torch 2.8.0)
from torchtune.training.metric_logging import WandBLoggerimports cleanly.%%writefilecell, walked every_component_:value, and resolved each withtorchtune.config._utils._get_component_from_path(the exact code path that crashed in the issue) — all 9 components resolve:tune validate mistral_wandb_lora.yamlon the extracted config reportsConfig is well-formed!lora_finetune_single_devicerecipe used by the notebook still exists intune ls.nbformat.validatepasses; no othertorchtune.utilsreferences remain in the notebook.Notes
git clone --depth 1ofpytorch/torchtunemain, so the hardcoded component paths track a moving upstream — the same drift that caused this breakage. Left as-is to keep the diff minimal, but pinning a release could prevent a repeat.Fixes #579
🤖 Generated with Claude Code