Skip to content

Commit 936d11b

Browse files
authored
Add IPEX-LLM inference jupyter notebook and instructions (#3310)
* Initial commit for IPEX LLM notebook for BF16 * update notebook with commands for quantization * update READMEs with instructions, fix quantization commands * minor updates
1 parent d260c2a commit 936d11b

File tree

3 files changed

+437
-1
lines changed

3 files changed

+437
-1
lines changed

examples/cpu/llm/README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ git submodule update --init --recursive
2424
docker build -f examples/cpu/llm/Dockerfile --build-arg COMPILE=ON --build-arg PORT_SSH=2345 -t ipex-llm:main .
2525

2626
# Run the container with command below
27-
docker run --rm -it --privileged -v /dev/shm:/dev/shm ipex-llm:main bash
27+
docker run --rm -it --net host --privileged -v /dev/shm:/dev/shm ipex-llm:main bash
2828

2929
# When the command prompt shows inside the docker container, enter llm examples directory
3030
cd llm
@@ -57,6 +57,42 @@ bash ./tools/env_setup.sh
5757
source ./tools/env_activate.sh [inference|fine-tuning]
5858
```
5959

60+
## 2.3 [Optional] Setup for Running Jupyter Notebooks
61+
62+
After setting up your docker or conda environment, you may follow these additional steps to setup and run Jupyter Notebooks. The port number can be changed.
63+
64+
### 2.3.1 Jupyter Notebooks for Docker-based Environments
65+
66+
```bash
67+
# Install dependencies
68+
pip install notebook matplotlib
69+
70+
# Launch Jupyter Notebook
71+
jupyter notebook --ip 0.0.0.0 --port 8888 --allow-root
72+
```
73+
74+
1. Open up a web browser with the given URL and token.
75+
2. Open the notebook.
76+
3. Run all cells.
77+
78+
### 2.3.2 Jupyter Notebooks for Conda-based Environments
79+
80+
```bash
81+
# Install dependencies
82+
pip install notebook ipykernel matplotlib
83+
84+
# Register ipykernel with Conda
85+
python -m ipykernel install --user --name=IPEX-LLM
86+
87+
# Launch Jupyter Notebook
88+
jupyter notebook --ip 0.0.0.0 --port 8888 --allow-root
89+
```
90+
91+
1. Open up a web browser with the given URL and token.
92+
2. Open the notebook.
93+
3. Change your Jupyter Notebook kernel to IPEX-LLM.
94+
4. Run all cells.
95+
6096
<br>
6197

6298
*Note*: In `env_setup.sh` script a `prompt.json` file is downloaded, which provides prompt samples with pre-defined input token lengths for benchmarking.

examples/cpu/llm/inference/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ python run.py --help # for more detailed usages
114114

115115
*Note:* You may need to log in your HuggingFace account to access the model files. Please refer to [HuggingFace login](https://huggingface.co/docs/huggingface_hub/quick-start#login).
116116

117+
**Alternatively, you can run the Jupyter Notebook to see ipex.llm with BF16 and various other quick start examples.**
118+
119+
Additional setup instructions for running the notebook can be found [here](../README.md#23-optional-setup-for-running-jupyter-notebooks).
120+
117121
## 2.1 Quick example for running Llama2-7b
118122

119123
### 2.1.1 To run generation task and benchmark performance

0 commit comments

Comments
 (0)