omniparse
omniparse copied to clipboard
Can I run docker on M chips Mac?
What I did:
On my MBP, M1 Max
docker pull savatar101/omniparse:0.1
docker run -p 8000:8000 savatar101/omniparse:0.1
Then I got the below output:
==========
== CUDA ==
==========
CUDA Version 11.8.0
Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available.
Use the NVIDIA Container Toolkit to start this container with GPU support; see
https://docs.nvidia.com/datacenter/cloud-native/ .
/opt/nvidia/nvidia_entrypoint.sh: line 67: exec: --: invalid option
exec: usage: exec [-cl] [-a name] [command [argument ...]] [redirection ...]
Not sure what I did was wrong, but can not run this docker on my Mac. Anyone knows how to do this?
- You should git clone this repo and cp
DockerfiletoDockerfile.cpu.arm64and revise as follows:
ARG MAX_JOBS=4
FROM ubuntu:22.04 # <-- Revise here
# Update package lists and install necessary packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
curl \
unzip \
git \
python3 \
python3-pip \
libgl1 \
libglib2.0-0 \
curl \
gnupg2 \
ca-certificates \
apt-transport-https \
software-properties-common \
libreoffice \
ffmpeg \
git-lfs \
xvfb \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \
&& wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt install python3-packaging \
&& apt-get install -y --no-install-recommends google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
# Add essential fonts to support Chinese <-- If you want to support Chines, add the following command
RUN apt-get install fonts-noto-cjk fonts-noto-cjk-extra fonts-arphic-ukai fonts-arphic-uming fonts-wqy-microhei fonts-wqy-zenhei \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& fc-cache -fv
# Download and install ChromeDriver
RUN CHROMEDRIVER_VERSION=$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE) && \
wget -N https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip -P /tmp && \
unzip /tmp/chromedriver_linux64.zip -d /tmp && \
mv /tmp/chromedriver /usr/local/bin/chromedriver && \
chmod +x /usr/local/bin/chromedriver && \
rm /tmp/chromedriver_linux64.zip
# Copy Chromedriver from the builder stage (if applicable)
# COPY --from=builder /usr/local/bin/chromedriver /usr/local/bin/chromedriver
# Install PyTorch and related packages
RUN pip3 install --no-cache-dir torch torchvision torchaudio # <-- Revised here
# Set up working directory and copy application code
COPY . /app
WORKDIR /app
# Install Python package (assuming it has a setup.py)
RUN pip3 install --no-cache-dir -e .
RUN pip install transformers==4.41.2
# Set environment variables
ENV CHROME_BIN=/usr/bin/google-chrome \
CHROMEDRIVER=/usr/local/bin/chromedriver \
DISPLAY=:99 \
DBUS_SESSION_BUS_ADDRESS=/dev/null \
PYTHONUNBUFFERED=1
# Ensure the PATH environment variable includes the location of the installed packages
ENV PATH /usr/local/bin:$PATH
# Expose the desired port
ENV PORT=8000
EXPOSE ${PORT}
# Run the server
CMD ["python", "server.py", "--host", "0.0.0.0", "--documents", "--media", "--web"]
- Build a image by yourself.
docker build --arch=arm64 -f Dockerfile.cpu.arm64 -t omniparse:0.1-arm64 .
While I don't have a Macbook at hand. You can test it and submit a PR, which is a big welcome.
Will give it a try first, if it works, will try to submit a PR.
@windmemory @qyou Unfortunately, I don't have access to a MacBook. @windmemory A PR would be much appreciated, but it might have some underlying complexity due to dealing with dependencies.
@adithya-s-k Understand, thanks for the reply. I tried on my Mac, but I got network issue connecting to dockerhub (since I am in China T T), still trying to figure out a way to build the image.
First blocker: no chrome available for arm. So is Chromium compatible in this project? Or only Chrome is okay? @adithya-s-k @qyou
hihi, i am going to try adding the arm64 dockerfile as above.. i am testing on a 2023 machook pro with a apple m2 pro chip :)