replicate / cog

Containers for machine learning
https://cog.run
Apache License 2.0
7.88k stars 549 forks source link

quickstart failing on M2 Mac #1447

Open davehorton opened 9 months ago

davehorton commented 9 months ago

I've seen a few related issues and made the changes suggested therein, but still failing for me.

$ system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: Mac14,5
      Model Number: Z17M0015KLL/A
      Chip: Apple M2 Max
      Total Number of Cores: 12 (8 performance and 4 efficiency)
      Memory: 96 GB
      System Firmware Version: 10151.41.12
      OS Loader Version: 10151.41.12
      Serial Number (system): KY993HWYJ5
      Hardware UUID: C8476BA0-043D-5A25-B2B6-EA850976A82B
      Provisioning UDID: 00006021-001440423EEBC01E
      Activation Lock Status: Enabled

cog.yaml

build:
  gpu: false
  python_version: "3.11"
  python_packages:
    - pillow==9.5.0
    - tensorflow==2.13.0
  run:
    - pip install typing-extensions --upgrade
predict: "predict.py:Predictor"

result:

$ cog predict -i image=@input.jpg
Building Docker image from environment in cog.yaml...
[+] Building 0.7s (18/18) FINISHED                                                                                                                                                                                                   docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                 0.0s
 => => transferring dockerfile: 1.11kB                                                                                                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                                                                                                      0.0s
 => resolve image config for docker.io/docker/dockerfile:1.4                                                                                                                                                                                         0.3s
 => [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
 => [internal] load metadata for docker.io/library/python:3.11-slim                                                                                                                                                                                  0.2s
 => [auth] library/python:pull token for registry-1.docker.io                                                                                                                                                                                        0.0s
 => [stage-0 1/8] FROM docker.io/library/python:3.11-slim@sha256:8f64a67710f3d981cf3008d6f9f1dbe61accd7927f165f4e37ea3f8b883ccc3f                                                                                                                    0.0s
 => [internal] load build context                                                                                                                                                                                                                    0.0s
 => => transferring context: 83.76kB                                                                                                                                                                                                                 0.0s
 => CACHED [stage-0 2/8] RUN --mount=type=cache,target=/var/cache/apt set -eux; apt-get update -qq; apt-get install -qqy --no-install-recommends curl; rm -rf /var/lib/apt/lists/*; TINI_VERSION=v0.19.0; TINI_ARCH="$(dpkg --print-architecture)";  0.0s
 => CACHED [stage-0 3/8] COPY .cog/tmp/build3089610978/cog-0.0.1.dev-py3-none-any.whl /tmp/cog-0.0.1.dev-py3-none-any.whl                                                                                                                            0.0s
 => CACHED [stage-0 4/8] RUN --mount=type=cache,target=/root/.cache/pip pip install /tmp/cog-0.0.1.dev-py3-none-any.whl                                                                                                                              0.0s
 => CACHED [stage-0 5/8] COPY .cog/tmp/build3089610978/requirements.txt /tmp/requirements.txt                                                                                                                                                        0.0s
 => CACHED [stage-0 6/8] RUN --mount=type=cache,target=/root/.cache/pip pip install -r /tmp/requirements.txt                                                                                                                                         0.0s
 => CACHED [stage-0 7/8] RUN pip install typing-extensions --upgrade                                                                                                                                                                                 0.0s
 => CACHED [stage-0 8/8] WORKDIR /src                                                                                                                                                                                                                0.0s
 => preparing layers for inline cache                                                                                                                                                                                                                0.0s
 => exporting to image                                                                                                                                                                                                                               0.0s
 => => exporting layers                                                                                                                                                                                                                              0.0s
 => => writing image sha256:a3a4b86178251852a94f3161c20a9f20c4960c577a01240e5a13903ca0f76b34                                                                                                                                                         0.0s
 => => naming to docker.io/library/cog-quickstart-base                                                                                                                                                                                               0.0s

Starting Docker image cog-quickstart-base and running setup()...
ⅹ Failed to get container status: exit status 1
altarofwisdom commented 1 month ago

Same here, quickstart won't work on Apple Silicon:

cog predict -i image=@input.jpg --debug

Building Docker image from environment in cog.yaml... Generated requirements.txt: pillow==9.5.0 tensorflow==2.12.0 $ docker buildx build --platform linux/amd64 --load --cache-to type=inline --file - --tag cog-quickstart-base --progress auto . [+] Building 1.1s (11/11) FINISHED docker:desktop-linux => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 294B 0.0s => resolve image config for docker-image://docker.io/docker/dockerfile:1.4 0.7s => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for r8.im/cog-base:python3.11 0.2s => [internal] load build context 0.0s => => transferring context: 240B 0.0s => [1/4] FROM r8.im/cog-base:python3.11@sha256:55a1644ecbe88d767a957d069fa9fa86ace75d7c947b7fe0f10ddf8ff161ddca 0.0s => CACHED [2/4] COPY .cog/tmp/build20240807113304.588273463898349/requirements.txt /tmp/requirements.txt 0.0s => CACHED [3/4] RUN pip install -r /tmp/requirements.txt 0.0s => CACHED [4/4] WORKDIR /src 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => preparing layers for inline cache 0.0s => => writing image sha256:57d0fc3111b8be6995d830e5aaa0be6b4905645802e86ef3154a96ea3ba1d1cd 0.0s => => naming to docker.io/library/cog-quickstart-base 0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/unxpfgvs8qtefdakf8wnb6fv0

Starting Docker image cog-quickstart-base and running setup()... $ docker run --rm --shm-size 6G --detach --env COG_LOG_LEVEL=debug --publish 0:5000 --mount type=bind,source=/Users/yoto/Projects/cog-quickstart,destination=/src cog-quickstart-base {"logger": "uvicorn.error", "timestamp": "2024-08-07T09:33:07.225869Z", "severity": "INFO", "message": "Started server process [7]"} {"logger": "uvicorn.error", "timestamp": "2024-08-07T09:33:07.226828Z", "severity": "INFO", "message": "Waiting for application startup."} {"logger": "uvicorn.error", "timestamp": "2024-08-07T09:33:07.233051Z", "severity": "INFO", "message": "Application startup complete."} {"logger": "uvicorn.error", "timestamp": "2024-08-07T09:33:07.247287Z", "severity": "INFO", "message": "Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit)"} ⅹ Model setup failed

The container is being geerated for AMD64 platform, which may be the reason why it's failing ? EDIT: the docker is started, but the :5000 only serves an empty page, so it's the underlying stuff which fails...

There is no detail about why the model setup is failing, no error message. Is there a plan at Replictae to make that available for the (pretty big) Apple users community ? Thanks !

vjaramillo commented 1 month ago

Having the same issue as @altarofwisdom on M1 Pro.

ocluf commented 3 weeks ago

I'm also experiencing issue with M1 Pro

cog run python
Building Docker image from environment in cog.yaml...
[+] Building 1.3s (6/6) FINISHED                                                                                                                        docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                    0.0s
 => => transferring dockerfile: 294B                                                                                                                                    0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1.4                                                                                             0.9s
 => [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
 => [internal] load .dockerignore                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                         0.0s
 => ERROR [internal] load metadata for r8.im/cog-base:python3.11                                                                                                        0.3s
------
 > [internal] load metadata for r8.im/cog-base:python3.11:
------
Dockerfile:2
--------------------
   1 |     #syntax=docker/dockerfile:1.4
   2 | >>> FROM r8.im/cog-base:python3.11
   3 |     COPY .cog/tmp/build20240901192419.804546391760398/requirements.txt /tmp/requirements.txt
   4 |     RUN pip install -r /tmp/requirements.txt
--------------------
ERROR: failed to solve: failed to resolve source metadata for r8.im/cog-base:python3.11: no match for platform in manifest: not found
ⅹ Failed to build Docker image: exit status 1
qzchenwl commented 1 week ago

Same for M3 Pro

https://github.com/replicate/cog/issues/958#issuecomment-2351066495