-
Notifications
You must be signed in to change notification settings - Fork 650
Add local image flag for fast context loading #2236
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 27 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
bdf2904
Add local image flag for fast context loading
8W9aG 4a9a669
Merge branch 'main' into sackfield/add-local-image-flag
8W9aG 6b1c59e
Fix no tmpMount usage
8W9aG 759fe41
Potential fix for code scanning alert no. 24: Potentially unsafe quoting
8W9aG 93d9726
Fix lint
8W9aG 8e39434
Use . in non local image for copy
8W9aG 9c11d64
Add back weights copy exclusion from non local images
8W9aG 0d93f0a
Send standard build directory if not local image
8W9aG fc23efc
Fix calculating rel dir on relative dir
8W9aG d15a45e
Build then predict in int test
8W9aG 68685e7
Add fast and local image to predict test
8W9aG 4c1f97d
Merge branch 'main' into sackfield/add-local-image-flag
8W9aG 1ffbb25
Use the image name from the config in predict
8W9aG 2d0883d
Fix cog predict build on fast build
8W9aG f9a222a
Feed docker image in directly
8W9aG db768c6
Use projectDir to fill in weights path
8W9aG fc6e034
Put debug in the right position
8W9aG eb60a50
Remove -t in cog predict
8W9aG 09071f8
Capture output of test and check return code
8W9aG 1b0534c
Merge branch 'main' into sackfield/add-local-image-flag
8W9aG 9217afc
Use absolute path for weights manifest
8W9aG 5a2a60f
Merge branch 'main' into sackfield/add-local-image-flag
8W9aG 4fa0ed5
Use hard links rather than file copies
8W9aG 817ec3d
Mirror the local directories permissions
8W9aG 5d27e08
Follow symlink to target
8W9aG 7ee7e15
Make sure directory permissions are aligned
8W9aG 37178d1
Merge branch 'main' into sackfield/add-local-image-flag
8W9aG 359cb38
Fix fast push
8W9aG 1d038ef
Use MkdirAll
8W9aG dd9ee6a
Use a set for weight path check
8W9aG 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
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
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
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 |
|---|---|---|
|
|
@@ -56,6 +56,7 @@ the prediction on that.`, | |
| addGpusFlag(cmd) | ||
| addSetupTimeoutFlag(cmd) | ||
| addFastFlag(cmd) | ||
| addLocalImage(cmd) | ||
|
|
||
| cmd.Flags().StringArrayVarP(&inputFlags, "input", "i", []string{}, "Inputs, in the form name=value. if value is prefixed with @, then it is read from a file on disk. E.g. -i [email protected]") | ||
| cmd.Flags().StringVarP(&outPath, "output", "o", "", "Output path") | ||
|
|
@@ -76,22 +77,27 @@ func cmdPredict(cmd *cobra.Command, args []string) error { | |
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if cfg.Build.Fast { | ||
| buildFast = cfg.Build.Fast | ||
| } | ||
|
|
||
| if imageName, err = image.BuildBase(cfg, projectDir, buildUseCudaBaseImage, DetermineUseCogBaseImage(cmd), buildProgressOutput); err != nil { | ||
| return err | ||
| } | ||
| if buildFast { | ||
| imageName = config.DockerImageName(projectDir) | ||
| } else { | ||
| if imageName, err = image.BuildBase(cfg, projectDir, buildUseCudaBaseImage, DetermineUseCogBaseImage(cmd), buildProgressOutput); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| // Base image doesn't have /src in it, so mount as volume | ||
| volumes = append(volumes, docker.Volume{ | ||
| Source: projectDir, | ||
| Destination: "/src", | ||
| }) | ||
| // Base image doesn't have /src in it, so mount as volume | ||
| volumes = append(volumes, docker.Volume{ | ||
| Source: projectDir, | ||
| Destination: "/src", | ||
| }) | ||
|
|
||
| if gpus == "" && cfg.Build.GPU { | ||
| gpus = "all" | ||
| if gpus == "" && cfg.Build.GPU { | ||
| gpus = "all" | ||
| } | ||
| } | ||
|
|
||
| } else { | ||
|
|
@@ -127,13 +133,17 @@ func cmdPredict(cmd *cobra.Command, args []string) error { | |
|
|
||
| console.Info("") | ||
| console.Infof("Starting Docker image %s and running setup()...", imageName) | ||
| dockerCommand := docker.NewDockerCommand() | ||
|
|
||
| predictor := predict.NewPredictor(docker.RunOptions{ | ||
| predictor, err := predict.NewPredictor(docker.RunOptions{ | ||
| GPUs: gpus, | ||
| Image: imageName, | ||
| Volumes: volumes, | ||
| Env: envFlags, | ||
| }, false, buildFast) | ||
| }, false, buildFast, dockerCommand) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| go func() { | ||
| captureSignal := make(chan os.Signal, 1) | ||
|
|
@@ -155,11 +165,14 @@ func cmdPredict(cmd *cobra.Command, args []string) error { | |
| console.Info("Missing device driver, re-trying without GPU") | ||
|
|
||
| _ = predictor.Stop() | ||
| predictor = predict.NewPredictor(docker.RunOptions{ | ||
| predictor, err = predict.NewPredictor(docker.RunOptions{ | ||
| Image: imageName, | ||
| Volumes: volumes, | ||
| Env: envFlags, | ||
| }, false, buildFast) | ||
| }, false, buildFast, dockerCommand) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if err := predictor.Start(os.Stderr, timeout); err != nil { | ||
| return err | ||
|
|
@@ -177,7 +190,7 @@ func cmdPredict(cmd *cobra.Command, args []string) error { | |
| } | ||
| }() | ||
|
|
||
| return predictIndividualInputs(predictor, inputFlags, outPath, false) | ||
| return predictIndividualInputs(*predictor, inputFlags, outPath, false) | ||
| } | ||
|
|
||
| func isURI(ref *openapi3.Schema) bool { | ||
|
|
||
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
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
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
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
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
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
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
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
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
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.
nit: can you just throw this into the block above
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.
Unfortunately I don't think we can, config fast build overwrites any CLI flag which is the first block, but in the 2nd block we need to know whether the fast build flag is in general on and overwrite the
imageName