Build your docker image in a way that works with replicate, while limiting image "layers" to less than 20GB.
First build a version of the cog without weights. To do this ensure remove extra files/weights from your cog directory and then build.
$ cog build
=> => writing image sha256:f6e8050651b29b27399418ac28759fcf53bcfdea9fb5b94f450a6d820f0d137f 0.0s
=> => naming to docker.io/library/cog-hello-world 0.0s
=> exporting cache 0.0s
=> => preparing build cache for export 0.0s
Adding labels to image...
Image built as cog-your-project
Create a Dockerfile:
FROM cog-your-project:latest
COPY large-file-1 /src/large-file-1
COPY large-file-2 /src/large-file-2
Note: each large-file-1
can be an individual file or directory. The goal is to not have layers that are so large that the auth token times out during push.
Then build it
$ docker build -t r8.im/username/modelname .
And push it
$ docker push r8.im/username/modelname