This repository was archived by the owner on Sep 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 248
CLI: Fix unsafe arg access of unused args #987
Merged
Merged
Conversation
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchchat/987
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 460ef5b with merge base cd0307a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Jack-Khuu
commented
Aug 1, 2024
| if verb == "export": | ||
| _add_export_output_path_args(parser) | ||
| if verb == "eval": | ||
| _add_exported_input_path_args(parser) |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this arg input was previously dropped and is now added back in (Eval can take exported model inputs)
Jack-Khuu
commented
Aug 1, 2024
Comment on lines
+364
to
+384
| Initialize distributed related setups if the user specified | ||
| using distributed inference. If not, this is a no-op. | ||
| Args: | ||
| builder_args (:class:`BuilderArgs`): | ||
| Command args for model building. | ||
| Returns: | ||
| Tuple[Optional[DeviceMesh], Optional[ParallelDims]]: | ||
| - The first element is an optional DeviceMesh object, | ||
| Tuple[Optional[DeviceMesh], Optional[ParallelDims]]: | ||
| - The first element is an optional DeviceMesh object, | ||
| which which describes the mesh topology of devices for the DTensor. | ||
| - The second element is an optional ParallelDims object, | ||
| - The second element is an optional ParallelDims object, | ||
| which represents the parallel dimensions configuration. | ||
| """ | ||
| if not builder_args.use_distributed: | ||
| return None, None | ||
| dist_config = 'llama3_8B.toml' # TODO - integrate with chat cmd line | ||
| world_mesh, parallel_dims = launch_distributed(dist_config) | ||
|
|
||
| world_mesh, parallel_dims = launch_distributed(dist_config) | ||
|
|
||
| assert world_mesh is not None and parallel_dims is not None, f"failed to launch distributed using {dist_config}" | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint
malfet
approved these changes
Aug 3, 2024
This was referenced Aug 3, 2024
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
As described in Issue 932, the legacy implementation of the arg parser results in subcommands requiring the existence of cli args that they don't actually use.
This PR fixes this by doing a safe getattr check instead of a raw field access.
As a side effect, it also allows us to remove conditional suppression of args.
Instead we can just omit the arg from the parser if they aren't needed.
Also happens to solve a --help bug #976
chat
generate
export
eval