cog icon indicating copy to clipboard operation
cog copied to clipboard

ERROR: failed to solve: circular dependency detected on stage: weights

Open gurteshwar opened this issue 1 year ago • 6 comments

Hello,

Trying to push a model with --separate-weights fails with this error. Works fine when the flag is not used. I am using cog version 0.9.7. I also tried deleting .cog , removed the models/ folder from the auto-generated .dockerignore

Building Docker image from environment in cog.yaml as r8.im/xxxxx/xxxxx...
[+] Building 187.8s (8/8) FINISHED                                                                                                                                                                                                                                            docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                                                                                                                                                             0.0s
 => => transferring context: 1.47kB                                                                                                                                                                                                                                                           0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                          0.0s
 => => transferring dockerfile: 141B                                                                                                                                                                                                                                                          0.0s
 => resolve image config for docker.io/docker/dockerfile:1.4                                                                                                                                                                                                                                  1.1s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc                                                                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                                                                            98.2s
 => => transferring context: 10.62GB                                                                                                                                                                                                                                                         98.2s
 => [1/1] COPY models /src/models                                                                                                                                                                                                                                                            58.0s
 => preparing layers for inline cache                                                                                                                                                                                                                                                        30.1s
 => exporting to image                                                                                                                                                                                                                                                                        0.0s
 => => exporting layers                                                                                                                                                                                                                                                                       0.0s
 => => writing image sha256:5be97ec87e2fb8b2f8f001848c916dd1a2031b3624ff2974d14e8558adc3c655                                                                                                                                                                                                  0.0s
 => => naming to r8.im/xxxxxx/xxxxxx                                                                                                                                                                                                                                    0.0s
[+] Building 3.7s (5/5) FINISHED                                                                                                                                                                                                                                              docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                          0.0s
 => => transferring dockerfile: 2.47kB                                                                                                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                             0.1s
 => => transferring context: 1.49kB                                                                                                                                                                                                                                                           0.0s
 => resolve image config for docker.io/docker/dockerfile:1.4                                                                                                                                                                                                                                  3.4s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io                                                                                                                                                                                                                              0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc                                                                                                                                                             0.0s
Dockerfile:1
--------------------
   1 | >>> #syntax=docker/dockerfile:1.4
   2 |     FROM python:3.11 as deps
   3 |     COPY .cog/tmp/build3627906443/cog-0.0.1.dev-py3-none-any.whl /tmp/cog-0.0.1.dev-py3-none-any.whl
--------------------
ERROR: failed to solve: circular dependency detected on stage: weights
ⅹ Failed to build runner Docker image: Failed to build Docker image: exit status 1

Below is cog.yaml

# Configuration for Cog ⚙️
# Reference: https://cog.run/yaml

build:
  # set to true if your model requires a GPU
  gpu: true

  # a list of ubuntu apt packages to install
  system_packages:
    - "git"

  # python version in the form '3.11' or '3.11.4'
  python_version: "3.11"
  python_requirements:  requirements.txt

# predict.py defines how predictions are run on your model
predict: "predict.py:Predictor"

gurteshwar avatar May 14 '24 07:05 gurteshwar

Same issue here with 0.9.7 and 0.9.8 on Linux.

hervenivon avatar May 23 '24 11:05 hervenivon

I have the same problem on mac with cog version 0.9.8. Also try with the versions v0.9.9-alpha and v0.10.0-alpha7 and I only got new problems. Yesterday I was talking to Replicate technical support and they usually communicated the problem to the cog developers.

Adrian-Serna avatar May 23 '24 14:05 Adrian-Serna

Hmm, seems like this isn't well maintained. No way to run custom models with everything baked into container without this :/ I guess this blocks any further evaluation of replicate as a provider

gurteshwar avatar May 24 '24 07:05 gurteshwar

This has been the response I have had.

" This is a known huge friction point for pushing/building Cog models currently. I've flagged the issues with --separate-weights to the devs on the team that maintain Cog to prioritize a fix for it, but I won't have an ETA to share on when they'll be able to land that work.

I'm sorry about that. I know it's an impediment to the workflows for iterating on models. I promise we're thinking about how to solve it!

Thanks for your patience while we work out the kinks in the product."

What makes Replicate unfeasible for developing a model with heavy dependencies without a local GPU. The option remains to work with a rented server for development and upload the implementation to Replicate only when it is ready.

Adrian-Serna avatar May 26 '24 16:05 Adrian-Serna

I still have this issue with cog 0.9.9 on Ubuntu. I have even docker clean'ed to a factory reset and can't fix it :(

@bfirsh ?

turian avatar Jun 18 '24 15:06 turian

Duplicate of #1323

turian avatar Jun 18 '24 15:06 turian

I fixed it in PR #1807. For anyone who can't wait you can download here.

LagPixelLOL avatar Jul 16 '24 11:07 LagPixelLOL

@turian btw this isn't a dupe of #1323, it's similar but that one can be fixed by deleting .cog/ folder while this one can't.

LagPixelLOL avatar Jul 16 '24 11:07 LagPixelLOL

@gurteshwar @hervenivon @Adrian-Serna @turian Sorry for the radio silence, folks. I dropped the ball on this, and I apologize for the inconvenience this caused.

I just opened a PR that should fix this regression here: https://github.com/replicate/cog/pull/1811. I haven't confirmed the fix from @LagPixelLOL's PR, but you're welcome to give that a try, too.

mattt avatar Jul 17 '24 13:07 mattt

This is now available in Cog v0.9.13 (it will take a few hours for brew upgrade cog to work, but you can install from source or download a precompiled release from GitHub in the meantime). Thanks again for your patience. Please let me know if you're still having problems after upgrading.

mattt avatar Jul 17 '24 16:07 mattt