Open zeke opened 1 year ago
When I'm running cog push
, I'm not getting the latest
in the output:
Building Docker image from environment in cog.yaml as r8.im/rdev/sdtest...
[+] Building 258.8s (18/18) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.78kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 46B 0.0s
=> resolve image config for docker.io/docker/dockerfile:1.2 0.1s
=> CACHED docker-image://docker.io/docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2230a333fdbcc 0.0s
=> [internal] load metadata for docker.io/nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04 0.2s
=> [internal] load build context 8.9s
=> => transferring context: 2.32GB 8.9s
=> [stage-0 1/10] FROM docker.io/nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04@sha256:91779650798919050553d6673d04a96bfd7cdf3fa931b6ff321 49.1s
=> => resolve docker.io/nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04@sha256:91779650798919050553d6673d04a96bfd7cdf3fa931b6ff32120b7f2eaaa4 0.0s
=> => sha256:bcf9a52c75ac54dc66b5b683fc8dc2bb8a1cc8eef9340433a3efbfe8d6fa3006 187B / 187B 0.0s
=> => sha256:9ce4eceb346b57d4be964a3a57551204b7435b2eae1d8c3154ef672661d710e4 1.12GB / 1.12GB 13.7s
=> => sha256:3a665e4036160d33fc32ce19c889271febc4fe4cdb82637cdd8c9ef10ca9541c 23.60MB / 23.60MB 0.5s
=> => sha256:624cfe37262e44c78cd50ec7bc8a98e417be3b81bb215eed099bf7da343b1a63 16.20kB / 16.20kB 0.0s
=> => sha256:cb69caf25724810d45aec6392c11de6f67c2efde38da9d46402857dedb68aefb 7.93MB / 7.93MB 0.1s
=> => sha256:8941157b58ada869bd12299ba8a56cdc5317923a5ce7df8158c5a3b44ff2fb67 6.43kB / 6.43kB 0.1s
=> => sha256:91779650798919050553d6673d04a96bfd7cdf3fa931b6ff32120b7f2eaaa4ad 743B / 743B 0.0s
=> => sha256:828017b99ce1b75fe6307d54f97bdd9f224730a1a3f31d935ce85209cb08c93c 2.43kB / 2.43kB 0.0s
=> => extracting sha256:cb69caf25724810d45aec6392c11de6f67c2efde38da9d46402857dedb68aefb 0.2s
=> => sha256:b1c91cec61e689319fc5354207f545dc4d065599ae530f8aae92bded993c72e3 62.66kB / 62.66kB 0.2s
=> => sha256:01035e520ac2fd77f181410687ecc81e9df074e738f8a4dfea4589572c663bd8 1.44GB / 1.44GB 17.4s
=> => extracting sha256:3a665e4036160d33fc32ce19c889271febc4fe4cdb82637cdd8c9ef10ca9541c 0.3s
=> => sha256:246ba1b32462cea77206e04797df75780a0bdebd112b020b9bf11a7c6694eaa1 85.60kB / 85.60kB 0.5s
=> => sha256:dc3b3af10cf618c7b3038ca70bbcc422701fa0bf6cb9afae277406df7140445a 1.48GB / 1.48GB 19.1s
=> => extracting sha256:bcf9a52c75ac54dc66b5b683fc8dc2bb8a1cc8eef9340433a3efbfe8d6fa3006 0.0s
=> => extracting sha256:8941157b58ada869bd12299ba8a56cdc5317923a5ce7df8158c5a3b44ff2fb67 0.0s
=> => extracting sha256:9ce4eceb346b57d4be964a3a57551204b7435b2eae1d8c3154ef672661d710e4 8.9s
=> => extracting sha256:b1c91cec61e689319fc5354207f545dc4d065599ae530f8aae92bded993c72e3 0.0s
=> => extracting sha256:01035e520ac2fd77f181410687ecc81e9df074e738f8a4dfea4589572c663bd8 13.1s
=> => extracting sha256:246ba1b32462cea77206e04797df75780a0bdebd112b020b9bf11a7c6694eaa1 0.0s
=> => extracting sha256:dc3b3af10cf618c7b3038ca70bbcc422701fa0bf6cb9afae277406df7140445a 13.0s
=> [stage-0 2/10] RUN rm -f /etc/apt/sources.list.d/cuda.list && rm -f /etc/apt/sources.list.d/nvidia-ml.list && apt-key del 7fa 2.7s
=> [stage-0 3/10] RUN --mount=type=cache,target=/var/cache/apt apt-get update -qq && apt-get install -qqy --no-install-recommends make 13.9s
=> [stage-0 4/10] RUN curl -s -S -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash && git c 55.7s
=> [stage-0 5/10] COPY .cog/tmp/build260375280/cog-0.0.1.dev-py3-none-any.whl /tmp/cog-0.0.1.dev-py3-none-any.whl 0.0s
=> [stage-0 6/10] RUN --mount=type=cache,target=/root/.cache/pip pip install /tmp/cog-0.0.1.dev-py3-none-any.whl 6.9s
=> [stage-0 7/10] RUN --mount=type=cache,target=/root/.cache/pip pip install torch==1.12.1 --extra-index-url=https://download.pytorc 106.1s
=> [stage-0 8/10] RUN pip install -qq git+https://github.com/ShivamShrirao/diffusers 8.1s
=> [stage-0 9/10] WORKDIR /src 0.0s
=> [stage-0 10/10] COPY . /src 2.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:e13bd98fb352c579857ff1d660ab4e2ce4846d644aeb6ca05a867c8c3ed82fac 0.0s
=> => naming to r8.im/rdev/sdtest 0.0s
=> exporting cache 0.0s
=> => preparing build cache for export 0.0s
Adding labels to image...
Pushing image 'r8.im/rdev/sdtest'...
Image 'r8.im/rdev/sdtest' pushed
Run your model on Replicate:
https://replicate.com/rdev/sdtest
The actual model ID I see in Replicate dashboard is not present anywhere in the logs 🤔
also not seeing the latest: digest: sha256...
when pushing from a linux box on ec2. i do see it when running from my mac though.
Implementation thoughts:
@bfirsh suggested that cog push
could print logs to STDERR, and meaningful response data to STDOUT.
@evilstreak suggested that the STDOUT response could be a JSON object with the model ID inside.
Just talked this through with Docker and Cog expert @bfirsh. It may be a bit difficult to get this right without still having a race condition. I'll leave it to @bfirsh to chime in here with details.
In the meantime, here's a Docker-based approximation of cog push
that gives you a way to snag the image id using Docker tags. This workflow could be used to run multiple Docker builds in parallel.
Specify a Docker tag when building your image, so you can retrieve it later from the Docker registry:
cog build -t r8.im/zeke/haiku-standard:my-tag
When the build is finished you can retrieve metadata for it using the full image URL, and use a tool like jq
to extract the hash from the resulting JSON metadata:
docker inspect r8.im/zeke/haiku-standard:my-tag | jq ".[0].Id"
Then push the image to the registry:
docker push r8.im/zeke/haiku-standard:my-tag
In situations where
cog push
is being run in an automated fashion, it's useful to be able to get the id of the published version.The version id is present in the output (see
latest: digest: sha256:7507bda...
) below), but maybe there's a nicer way to return it, or make it more obvious what it is.cc @tstramer