Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instruction for chat.py in bigdl-llm-cpu #9108

Merged
merged 26 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
efb93b6
modify Dockerfile
Zhengjin-Wang Sep 21, 2023
b176fd8
add README.md
Zhengjin-Wang Sep 21, 2023
3f23eff
add README.md
Zhengjin-Wang Sep 21, 2023
41bc380
Merge remote-tracking branch 'upstream/main'
Zhengjin-Wang Sep 25, 2023
9d244e0
Modify Dockerfile
Zhengjin-Wang Sep 25, 2023
c97fbd5
Add bigdl inference cpu image build
Zhengjin-Wang Sep 25, 2023
0b294f6
Add bigdl llm cpu image build
Zhengjin-Wang Sep 25, 2023
5ccb920
Add bigdl llm cpu image build
Zhengjin-Wang Sep 25, 2023
1973993
Add bigdl llm cpu image build
Zhengjin-Wang Sep 25, 2023
6e2ce13
Modify Dockerfile
Zhengjin-Wang Sep 26, 2023
6fbe463
Merge remote-tracking branch 'upstream/main'
Zhengjin-Wang Sep 26, 2023
c09f39c
Modify Dockerfile
Zhengjin-Wang Sep 26, 2023
9341ceb
Add bigdl inference cpu image build
Zhengjin-Wang Sep 26, 2023
ce98b9a
Add bigdl inference cpu image build
Zhengjin-Wang Sep 26, 2023
c343f9d
Add bigdl llm xpu image build
Zhengjin-Wang Sep 26, 2023
ffd476d
manually build
Zhengjin-Wang Sep 26, 2023
46fc441
manually build
Zhengjin-Wang Sep 26, 2023
6db09ba
recover file
Zhengjin-Wang Sep 26, 2023
4ba165c
Merge remote-tracking branch 'upstream/main'
Zhengjin-Wang Sep 26, 2023
83a684e
manually build
Zhengjin-Wang Sep 26, 2023
0f92603
recover file
Zhengjin-Wang Sep 26, 2023
2dcd2b6
modify indentation
Zhengjin-Wang Sep 27, 2023
71c3489
Merge remote-tracking branch 'upstream/main'
Zhengjin-Wang Oct 7, 2023
2b6d361
Merge remote-tracking branch 'upstream/main'
Zhengjin-Wang Oct 9, 2023
f7ed1eb
add instruction for chat.py
Zhengjin-Wang Oct 9, 2023
485b68e
modify README
Zhengjin-Wang Oct 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/llm/inference/cpu/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ RUN env DEBIAN_FRONTEND=noninteractive apt-get update && \
pip install --pre --upgrade bigdl-llm[all] && \
pip install --pre --upgrade bigdl-nano && \
# Download chat.py script
wget -P /root https://raw.githubusercontent.com/intel-analytics/BigDL/main/python/llm/portable-executable/chat.py && \
pip install --upgrade colorama && \
wget -P /root https://raw.githubusercontent.com/intel-analytics/BigDL/main/python/llm/portable-zip/chat.py && \
export PYTHONUNBUFFERED=1

ENTRYPOINT ["/bin/bash"]
34 changes: 34 additions & 0 deletions docker/llm/inference/cpu/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,37 @@ sudo docker run -itd \
After the container is booted, you could get into the container through `docker exec`.

To run inference using `BigDL-LLM` using cpu, you could refer to this [documentation](https://github.com/intel-analytics/BigDL/tree/main/python/llm#cpu-int4).

### Use chat.py

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

@Oscilloscope98 Oscilloscope98 Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chat.py can be used to initiate a conversation with a specified model on Intel CPU.

Add some description that the model is needed to be downloaded by users themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added


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

Here is an example:
```bash
export DOCKER_IMAGE=intelanalytics/bigdl-llm-cpu:2.4.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:
```bash
cd /root
python chat.py --model-path YOUR_MODEL_PATH
```
In the example above, it can be:
```bash
cd /root
python chat.py --model-path /llm/models/MODEL_NAME
```