First commit with iGPU
This commit is contained in:
parent
ae71ea1bf7
commit
c6e868e233
2 changed files with 79 additions and 0 deletions
62
Dockerfile
Normal file
62
Dockerfile
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
# Use the Intel image - Ubuntu 24.04 (Forces native Python 3.12)
|
||||||
|
FROM intel/oneapi:2025.1.3-0-devel-ubuntu24.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
ENV PATH="/usr/local/bin:${PATH}"
|
||||||
|
|
||||||
|
ENV INTEL_ENABLE_XPU_SUPPORT=1
|
||||||
|
ENV NEOMEMSHARE=1
|
||||||
|
|
||||||
|
# Tell the runtime to present the hardware as a unified device (fixes Level Zero topology drops)
|
||||||
|
ENV ZE_FLAT_DEVICE_HIERARCHY=COMPACT
|
||||||
|
|
||||||
|
# Instruct SYCL to route through Level Zero instead of OpenCL
|
||||||
|
ENV IGC_EnableZEBinary=1
|
||||||
|
ENV ONEAPI_DEVICE_SELECTOR=level_zero:gpu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Install core runtime dependencies, including python3-venv and Intel compute runtimes for Arc GPUs
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
curl \
|
||||||
|
gnupg \
|
||||||
|
git \
|
||||||
|
python3-pip \
|
||||||
|
python3-dev \
|
||||||
|
python3-venv \
|
||||||
|
intel-opencl-icd \
|
||||||
|
clinfo \
|
||||||
|
intel-opencl-icd \
|
||||||
|
level-zero \
|
||||||
|
level-zero-dev \
|
||||||
|
hwloc \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir -p /root/.unsloth/studio && \
|
||||||
|
python3 -m venv /root/.unsloth/studio/unsloth_studio
|
||||||
|
|
||||||
|
RUN /root/.unsloth/studio/unsloth_studio/bin/pip install --no-cache-dir \
|
||||||
|
torch==2.11.0+xpu torchvision torchaudio \
|
||||||
|
--index-url https://download.pytorch.org/whl/xpu
|
||||||
|
|
||||||
|
RUN /root/.unsloth/studio/unsloth_studio/bin/pip install --no-cache-dir \
|
||||||
|
intel-cmplr-lib-rt intel-cmplr-lib-ur intel-cmplr-lic-rt intel-sycl-rt pytorch-triton-xpu \
|
||||||
|
--index-url https://download.pytorch.org/whl/xpu
|
||||||
|
|
||||||
|
ENV UNSLOTH_BACKEND=auto
|
||||||
|
RUN /root/.unsloth/studio/unsloth_studio/bin/pip install --no-cache-dir unsloth --no-deps && \
|
||||||
|
/root/.unsloth/studio/unsloth_studio/bin/pip install --no-cache-dir unsloth_zoo --no-deps
|
||||||
|
|
||||||
|
RUN /root/.unsloth/studio/unsloth_studio/bin/pip install --no-cache-dir bitsandbytes && \
|
||||||
|
/root/.unsloth/studio/unsloth_studio/bin/pip install --no-cache-dir \
|
||||||
|
transformers datasets accelerate peft trl scipy sentencepiece wheel packaging \
|
||||||
|
structlog python-multipart fastapi uvicorn pydantic click tyro sqlmodel unsloth-studio
|
||||||
|
|
||||||
|
RUN sed -i 's/raise NotImplementedError("Unsloth cannot find any torch accelerator? You need a GPU.")/return "xpu"/g' /root/.unsloth/studio/unsloth_studio/lib/python3.12/site-packages/unsloth_zoo/device_type.py
|
||||||
|
|
||||||
|
RUN /root/.unsloth/studio/unsloth_studio/bin/unsloth studio setup
|
||||||
|
|
||||||
|
EXPOSE 8888
|
||||||
|
USER root
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "-c", "export LD_LIBRARY_PATH=/root/.unsloth/studio/unsloth_studio/lib/python3.12/site-packages/torch/lib:/usr/local/lib:$LD_LIBRARY_PATH && /root/.unsloth/studio/unsloth_studio/bin/unsloth studio -H 0.0.0.0 -p 8888"]
|
||||||
17
run-cmd.txt
Normal file
17
run-cmd.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
docker run -d \
|
||||||
|
--name unsloth-intel-container \
|
||||||
|
--user root \
|
||||||
|
-e LD_LIBRARY_PATH="/root/.unsloth/studio/unsloth_studio/lib/python3.12/site-packages/torch/lib:/usr/local/lib:\$LD_LIBRARY_PATH" \
|
||||||
|
-v /usr/lib/libze_loader.so:/usr/lib/libze_loader.so:ro \
|
||||||
|
-v /usr/lib/intel-opencl:/usr/lib/intel-opencl:ro \
|
||||||
|
--group-add video \
|
||||||
|
--group-add 109 \
|
||||||
|
--device=/dev/dri \
|
||||||
|
--device=/dev/dri/card0 \
|
||||||
|
--device=/dev/dri/renderD128 \
|
||||||
|
--ipc=host \
|
||||||
|
--group-add video \
|
||||||
|
--group-add render \
|
||||||
|
-p 8888:8888 \
|
||||||
|
-v $(pwd)/work:/workspace/work \
|
||||||
|
unsloth-intel-arc:latest
|
||||||
Loading…
Add table
Reference in a new issue