ipex-llm/docker/llm/inference/cpu/docker
Shaojun Liu 29bf28bd6f
Upgrade python to 3.11 in Docker Image (#10718)
* install python 3.11 for cpu-inference docker image

* update xpu-inference dockerfile

* update cpu-serving image

* update qlora image

* update lora image

* update document
2024-04-10 14:41:27 +08:00
..
Dockerfile Upgrade python to 3.11 in Docker Image (#10718) 2024-04-10 14:41:27 +08:00
README.md refine and verify ipex-inference-cpu docker document (#10565) 2024-03-29 10:16:10 +08:00
start-notebook.sh Update_docker by heyang (#29) 2024-03-25 10:05:46 +08:00

Build/Use IPEX-LLM cpu image

Build Image

docker build \
  --build-arg http_proxy=.. \
  --build-arg https_proxy=.. \
  --build-arg no_proxy=.. \
  --rm --no-cache -t intelanalytics/ipex-llm-cpu:2.1.0-SNAPSHOT .

Use the image for doing cpu inference

An example could be:

#/bin/bash
export DOCKER_IMAGE=intelanalytics/ipex-llm-cpu:2.1.0-SNAPSHOT

sudo docker run -itd \
        --net=host \
        --cpuset-cpus="0-47" \
        --cpuset-mems="0" \
        --memory="32G" \
        --name=CONTAINER_NAME \
        --shm-size="16g" \
        $DOCKER_IMAGE

After the container is booted, you could get into the container through docker exec.

To run inference using IPEX-LLM using cpu, you could refer to this documentation.

Use chat.py

chat.py can be used to initiate a conversation with a specified model. The file is under directory '/llm'.

You can download models and bind the model directory from host machine to container when start a container.

Here is an example:

export DOCKER_IMAGE=intelanalytics/ipex-llm-cpu:2.1.0-SNAPSHOT
export MODEL_PATH=/home/llm/models

sudo docker run -itd \
        --net=host \
        --cpuset-cpus="0-47" \
        --cpuset-mems="0" \
        --memory="32G" \
        --name=CONTAINER_NAME \
        --shm-size="16g" \
        -v $MODEL_PATH:/llm/models/
        $DOCKER_IMAGE

After entering the container through docker exec, you can run chat.py by:

cd /llm
python chat.py --model-path YOUR_MODEL_PATH

In the example above, it can be:

cd /llm
python chat.py --model-path /llm/models/MODEL_NAME