-
Notifications
You must be signed in to change notification settings - Fork 126
APP-10775: viam training-script test-local #5524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fdff64b
first pass
vpandiarajan20 fb04bd4
security and linting
vpandiarajan20 214911d
descrip text
vpandiarajan20 9c22fec
Merge branch 'viamrobotics:main' into APP-10775
vpandiarajan20 c76a430
dataset paths
vpandiarajan20 a8f8f8d
CLI help text
vpandiarajan20 3f4da57
lint
vpandiarajan20 e28a0d1
clean up
vpandiarajan20 753882e
Merge branch 'main' into APP-10775
vpandiarajan20 390ce70
Merge branch 'main' into APP-10775
vpandiarajan20 704f696
warning message
vpandiarajan20 1fad4ba
warning message 2
vpandiarajan20 001c886
change help text
vpandiarajan20 994b80e
remove validation
vpandiarajan20 c9d36d7
lint
vpandiarajan20 b6efdeb
to make windows work
vpandiarajan20 916fa04
Merge branch 'viamrobotics:main' into APP-10775
vpandiarajan20 4bc5312
help text
vpandiarajan20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3398,6 +3398,73 @@ This won't work unless you have an existing installation of our GitHub app on yo | |
| }, | ||
| Action: createCommandWithT[mlTrainingUpdateArgs](MLTrainingUpdateAction), | ||
| }, | ||
| { | ||
| Name: "test-local", | ||
| Usage: "test training script locally using Docker", | ||
| UsageText: createUsageText("training-script test-local", []string{ | ||
| trainFlagDatasetRoot, trainFlagTrainingScriptDirectory, | ||
| trainFlagDatasetFile, trainFlagContainerVersion, trainFlagModelOutputDirectory, | ||
| }, true, false), | ||
| Description: `Test your training script locally before submitting to the cloud. This runs your training script | ||
| in a Docker container using the same environment as cloud training. | ||
|
|
||
| REQUIREMENTS: | ||
| - Docker must be installed and running | ||
| - Training script directory must contain model/training.py and one of the following files: setup.py, setup.cfg, or pyproject.toml. | ||
| - Dataset root directory must contain: | ||
| * dataset.jsonl (or the file specified with --dataset-file) | ||
| * All image files referenced in the dataset (using relative paths from dataset root) | ||
|
|
||
| DATASET ORGANIZATION: | ||
| The dataset root should be organized so that image paths in dataset.jsonl are relative to it. | ||
| If downloaded with the 'viam dataset export' command, this will happen automatically. | ||
| For example: | ||
| dataset_root/ | ||
| ├── dataset.jsonl (contains paths like "data/images/cat.jpg") | ||
| └── data/ | ||
| └── images/ | ||
| └── cat.jpg | ||
|
|
||
| NOTES: | ||
| - Training containers only support linux/x86_64 (amd64) architecture | ||
| - Ensure Docker Desktop has sufficient resources allocated (memory, CPU) | ||
| - The container's working directory will be set to the dataset root, so relative paths resolve correctly | ||
| - Model output will be saved to the specified output directory on your host machine | ||
| `, | ||
| Flags: []cli.Flag{ | ||
| &cli.StringFlag{ | ||
| Name: trainFlagDatasetRoot, | ||
| Usage: "path to the dataset root directory (where dataset.jsonl and image files are located). This is where you ran the 'viam dataset export' command from.", | ||
|
||
| Required: true, | ||
| }, | ||
| &cli.StringFlag{ | ||
| Name: trainFlagDatasetFile, | ||
| Usage: "relative path to the dataset file from the dataset root. Defaults to dataset.jsonl", | ||
| Value: "dataset.jsonl", | ||
| }, | ||
| &cli.StringFlag{ | ||
| Name: trainFlagTrainingScriptDirectory, | ||
| Usage: "path to the training script directory (must contain setup.py and model/training.py)," + | ||
| " the container will be mounted to this directory", | ||
| Required: true, | ||
| }, | ||
| &cli.StringFlag{ | ||
| Name: trainFlagContainerVersion, | ||
| Usage: "container version to use (e.g., 'tf:2.16').", | ||
vpandiarajan20 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Required: true, | ||
| }, | ||
| &cli.StringFlag{ | ||
| Name: trainFlagModelOutputDirectory, | ||
| Usage: "directory where the trained model will be saved. Defaults to current directory", | ||
| Value: ".", | ||
| }, | ||
| &cli.StringSliceFlag{ | ||
| Name: trainFlagCustomArgs, | ||
| Usage: "custom arguments to pass to the training script (format: key=value)", | ||
| }, | ||
| }, | ||
| Action: createCommandWithT[mlTrainingScriptTestLocalArgs](MLTrainingScriptTestLocalAction), | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Maybe this goes in documentation? I also want to add that if the containers really slow, it could be because the dataset root or training script directory has a bunch of extra files. Apparently mounting volumes can be expensive.