-
Notifications
You must be signed in to change notification settings - Fork 645
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
Conversation
* Add a new experimental flag —x-localimage for use with —x-fastpush * When activated, the flag uses the .cog tmp directory as an rsync for the source code without weights * It separates the different build steps into different build contexts * On run/predict/train/serve it loads the weights in as volume mounts * This allows it to not reload the context each time a small file is changed for weights
Signed-off-by: Will Sackfield <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Will Sackfield <[email protected]>
* Only if we use build fast
| if imageName, err = image.BuildBase(cfg, projectDir, buildUseCudaBaseImage, DetermineUseCogBaseImage(cmd), buildProgressOutput); err != nil { | ||
| return err | ||
| } | ||
| if buildFast { |
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
if cfg.Build.Fast {
buildFast = true
imageName = config.DockerImageName(projectDir)
} else {
...
}
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
|
|
||
| // Rsync local src with our srcdir | ||
| if g.localImage { | ||
| err := g.rsyncSrc(srcDir, weights) |
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.
Could just be me not understanding correctly but what we're doing here
- Symlinking everything in g.Dir to a subdirectory
- Hard link to all the symlinks?
I guess I'm a bit confused why we're doing the rsync first?
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.
Our process is:
- If a local image flag is used, created a src directory in
.cog - Create the necessary hard links and directories to mirror whats in the users current directory (sans weights and dockerignore directives), if it is symlink use the target path
- Tag that as a unique build context so it only changes the docker build when the user changes their code
* Synchronise directories between different golang modules
|
Going to merge this to build a new release |
weights