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
This commit is contained in:
parent
b727767f00
commit
29bf28bd6f
9 changed files with 34 additions and 26 deletions
|
|
@ -21,7 +21,7 @@ RUN echo "deb [signed-by=/usr/share/keyrings/intel-oneapi-archive-keyring.gpg] h
|
||||||
RUN mkdir /ipex_llm/data && mkdir /ipex_llm/model && \
|
RUN mkdir /ipex_llm/data && mkdir /ipex_llm/model && \
|
||||||
# install pytorch 2.0.1
|
# install pytorch 2.0.1
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y python3-pip python3.9-dev python3-wheel git software-properties-common && \
|
apt-get install -y python3-pip python3.11-dev python3-wheel git software-properties-common && \
|
||||||
pip3 install --upgrade pip && \
|
pip3 install --upgrade pip && \
|
||||||
export PIP_DEFAULT_TIMEOUT=100 && \
|
export PIP_DEFAULT_TIMEOUT=100 && \
|
||||||
pip install --upgrade torch==2.1.0 --index-url https://download.pytorch.org/whl/cpu && \
|
pip install --upgrade torch==2.1.0 --index-url https://download.pytorch.org/whl/cpu && \
|
||||||
|
|
@ -37,9 +37,9 @@ RUN mkdir /ipex_llm/data && mkdir /ipex_llm/model && \
|
||||||
pip install -r /ipex_llm/requirements.txt && \
|
pip install -r /ipex_llm/requirements.txt && \
|
||||||
# install python
|
# install python
|
||||||
add-apt-repository ppa:deadsnakes/ppa -y && \
|
add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||||
apt-get install -y python3.9 && \
|
apt-get install -y python3.11 && \
|
||||||
rm /usr/bin/python3 && \
|
rm /usr/bin/python3 && \
|
||||||
ln -s /usr/bin/python3.9 /usr/bin/python3 && \
|
ln -s /usr/bin/python3.11 /usr/bin/python3 && \
|
||||||
ln -s /usr/bin/python3 /usr/bin/python && \
|
ln -s /usr/bin/python3 /usr/bin/python && \
|
||||||
pip install --no-cache requests argparse cryptography==3.3.2 urllib3 && \
|
pip install --no-cache requests argparse cryptography==3.3.2 urllib3 && \
|
||||||
pip install --upgrade requests && \
|
pip install --upgrade requests && \
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ RUN echo "deb [signed-by=/usr/share/keyrings/intel-oneapi-archive-keyring.gpg] h
|
||||||
RUN mkdir -p /ipex_llm/data && mkdir -p /ipex_llm/model && \
|
RUN mkdir -p /ipex_llm/data && mkdir -p /ipex_llm/model && \
|
||||||
# install pytorch 2.1.0
|
# install pytorch 2.1.0
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y --no-install-recommends python3-pip python3.9-dev python3-wheel python3.9-distutils git software-properties-common && \
|
apt-get install -y --no-install-recommends python3-pip python3.11-dev python3-wheel python3.11-distutils git software-properties-common && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
pip3 install --upgrade pip && \
|
pip3 install --upgrade pip && \
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ RUN echo "deb [signed-by=/usr/share/keyrings/intel-oneapi-archive-keyring.gpg] h
|
||||||
RUN mkdir -p /ipex_llm/data && mkdir -p /ipex_llm/model && \
|
RUN mkdir -p /ipex_llm/data && mkdir -p /ipex_llm/model && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt install -y --no-install-recommends openssh-server openssh-client libcap2-bin gnupg2 ca-certificates \
|
apt install -y --no-install-recommends openssh-server openssh-client libcap2-bin gnupg2 ca-certificates \
|
||||||
python3-pip python3.9-dev python3-wheel python3.9-distutils git software-properties-common && \
|
python3-pip python3.11-dev python3-wheel python3.11-distutils git software-properties-common && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
mkdir -p /var/run/sshd && \
|
mkdir -p /var/run/sshd && \
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,15 @@ RUN curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-P
|
||||||
apt-get install -y curl wget git gnupg gpg-agent software-properties-common libunwind8-dev vim less && \
|
apt-get install -y curl wget git gnupg gpg-agent software-properties-common libunwind8-dev vim less && \
|
||||||
# install Intel GPU driver
|
# install Intel GPU driver
|
||||||
apt-get install -y intel-opencl-icd intel-level-zero-gpu=1.3.26241.33-647~22.04 level-zero level-zero-dev --allow-downgrades && \
|
apt-get install -y intel-opencl-icd intel-level-zero-gpu=1.3.26241.33-647~22.04 level-zero level-zero-dev --allow-downgrades && \
|
||||||
# install python 3.9
|
# install python 3.11
|
||||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
|
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
|
||||||
env DEBIAN_FRONTEND=noninteractive apt-get update && \
|
env DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||||
add-apt-repository ppa:deadsnakes/ppa -y && \
|
add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||||
apt-get install -y python3.9 && \
|
apt-get install -y python3.11 && \
|
||||||
rm /usr/bin/python3 && \
|
rm /usr/bin/python3 && \
|
||||||
ln -s /usr/bin/python3.9 /usr/bin/python3 && \
|
ln -s /usr/bin/python3.11 /usr/bin/python3 && \
|
||||||
ln -s /usr/bin/python3 /usr/bin/python && \
|
ln -s /usr/bin/python3 /usr/bin/python && \
|
||||||
apt-get install -y python3-pip python3.9-dev python3-wheel python3.9-distutils && \
|
apt-get install -y python3-pip python3.11-dev python3-wheel python3.11-distutils && \
|
||||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
||||||
# install XPU ipex-llm
|
# install XPU ipex-llm
|
||||||
pip install --pre --upgrade ipex-llm[xpu] --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ && \
|
pip install --pre --upgrade ipex-llm[xpu] --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ && \
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,30 @@ ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
COPY ./start-notebook.sh /llm/start-notebook.sh
|
COPY ./start-notebook.sh /llm/start-notebook.sh
|
||||||
|
|
||||||
# Install PYTHON 3.9
|
# Update the software sources
|
||||||
RUN env DEBIAN_FRONTEND=noninteractive apt-get update && \
|
RUN env DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||||
|
# Install essential packages
|
||||||
apt install software-properties-common libunwind8-dev vim less -y && \
|
apt install software-properties-common libunwind8-dev vim less -y && \
|
||||||
|
# Install git, curl, and wget
|
||||||
|
apt-get install -y git curl wget && \
|
||||||
|
# Install Python 3.11
|
||||||
|
# Add Python 3.11 PPA repository
|
||||||
add-apt-repository ppa:deadsnakes/ppa -y && \
|
add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||||
apt-get install -y python3.9 git curl wget && \
|
# Install Python 3.11
|
||||||
|
apt-get install -y python3.11 && \
|
||||||
|
# Remove the original /usr/bin/python3 symbolic link
|
||||||
rm /usr/bin/python3 && \
|
rm /usr/bin/python3 && \
|
||||||
ln -s /usr/bin/python3.9 /usr/bin/python3 && \
|
# Create a symbolic link pointing to Python 3.11 at /usr/bin/python3
|
||||||
|
ln -s /usr/bin/python3.11 /usr/bin/python3 && \
|
||||||
|
# Create a symbolic link pointing to /usr/bin/python3 at /usr/bin/python
|
||||||
ln -s /usr/bin/python3 /usr/bin/python && \
|
ln -s /usr/bin/python3 /usr/bin/python && \
|
||||||
apt-get install -y python3-pip python3.9-dev python3-wheel python3.9-distutils && \
|
# Install Python 3.11 development and utility packages
|
||||||
|
apt-get install -y python3-pip python3.11-dev python3-wheel python3.11-distutils && \
|
||||||
|
# Download and install pip, install FastChat from source requires PEP 660 support
|
||||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
||||||
# Install FastChat from source requires PEP 660 support
|
|
||||||
python3 get-pip.py && \
|
python3 get-pip.py && \
|
||||||
rm get-pip.py && \
|
rm get-pip.py && \
|
||||||
pip install --upgrade requests argparse urllib3 && \
|
pip install --upgrade requests argparse urllib3 && \
|
||||||
pip3 install --no-cache-dir --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu && \
|
|
||||||
pip install --pre --upgrade ipex-llm[all] && \
|
|
||||||
# Download ipex-llm-tutorial
|
# Download ipex-llm-tutorial
|
||||||
cd /llm && \
|
cd /llm && \
|
||||||
pip install --upgrade jupyterlab && \
|
pip install --upgrade jupyterlab && \
|
||||||
|
|
|
||||||
|
|
@ -20,16 +20,16 @@ RUN curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-P
|
||||||
wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg && \
|
wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg && \
|
||||||
echo 'deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy arc' | tee /etc/apt/sources.list.d/intel.gpu.jammy.list && \
|
echo 'deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy arc' | tee /etc/apt/sources.list.d/intel.gpu.jammy.list && \
|
||||||
rm /etc/apt/sources.list.d/intel-graphics.list && \
|
rm /etc/apt/sources.list.d/intel-graphics.list && \
|
||||||
# Install PYTHON 3.9 and IPEX-LLM[xpu]
|
# Install PYTHON 3.11 and IPEX-LLM[xpu]
|
||||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
|
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
|
||||||
env DEBIAN_FRONTEND=noninteractive apt-get update && \
|
env DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||||
apt install software-properties-common libunwind8-dev vim less -y && \
|
apt install software-properties-common libunwind8-dev vim less -y && \
|
||||||
add-apt-repository ppa:deadsnakes/ppa -y && \
|
add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||||
apt-get install -y python3.9 git curl wget && \
|
apt-get install -y python3.11 git curl wget && \
|
||||||
rm /usr/bin/python3 && \
|
rm /usr/bin/python3 && \
|
||||||
ln -s /usr/bin/python3.9 /usr/bin/python3 && \
|
ln -s /usr/bin/python3.11 /usr/bin/python3 && \
|
||||||
ln -s /usr/bin/python3 /usr/bin/python && \
|
ln -s /usr/bin/python3 /usr/bin/python && \
|
||||||
apt-get install -y python3-pip python3.9-dev python3-wheel python3.9-distutils && \
|
apt-get install -y python3-pip python3.11-dev python3-wheel python3.11-distutils && \
|
||||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
|
||||||
# Install FastChat from source requires PEP 660 support
|
# Install FastChat from source requires PEP 660 support
|
||||||
python3 get-pip.py && \
|
python3 get-pip.py && \
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ RUN cd /llm && \
|
||||||
# Fix Trivy CVE Issues
|
# Fix Trivy CVE Issues
|
||||||
pip install Jinja2==3.1.3 transformers==4.36.2 gradio==4.19.2 cryptography==42.0.4 && \
|
pip install Jinja2==3.1.3 transformers==4.36.2 gradio==4.19.2 cryptography==42.0.4 && \
|
||||||
# Fix Qwen model adpater in fastchat
|
# Fix Qwen model adpater in fastchat
|
||||||
patch /usr/local/lib/python3.9/dist-packages/fastchat/model/model_adapter.py < /llm/model_adapter.py.patch && \
|
patch /usr/local/lib/python3.11/dist-packages/fastchat/model/model_adapter.py < /llm/model_adapter.py.patch && \
|
||||||
chmod +x /opt/entrypoint.sh && \
|
chmod +x /opt/entrypoint.sh && \
|
||||||
chmod +x /sbin/tini && \
|
chmod +x /sbin/tini && \
|
||||||
cp /sbin/tini /usr/bin/tini
|
cp /sbin/tini /usr/bin/tini
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ pip install oneccl_bind_pt --extra-index-url https://developer.intel.com/ipex-wh
|
||||||
2. modify conf in `finetune_one_node_two_sockets.sh` and run
|
2. modify conf in `finetune_one_node_two_sockets.sh` and run
|
||||||
|
|
||||||
```
|
```
|
||||||
source ${conda_env}/lib/python3.9/site-packages/oneccl_bindings_for_pytorch/env/setvars.sh
|
source ${conda_env}/lib/python3.11/site-packages/oneccl_bindings_for_pytorch/env/setvars.sh
|
||||||
bash finetune_one_node_two_sockets.sh
|
bash finetune_one_node_two_sockets.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ frame_data = np.frombuffer(audio.frame_data, np.int16).flatten().astype(np.float
|
||||||
#### Sample Output
|
#### Sample Output
|
||||||
```bash
|
```bash
|
||||||
(llm) ipex@ipex-llm:~/Documents/voiceassistant$ python generate.py --llama2-repo-id-or-model-path /mnt/windows/demo/models/Llama-2-7b-chat-hf --whisper-repo-id-or-model-path /mnt/windows/demo/models/whisper-medium
|
(llm) ipex@ipex-llm:~/Documents/voiceassistant$ python generate.py --llama2-repo-id-or-model-path /mnt/windows/demo/models/Llama-2-7b-chat-hf --whisper-repo-id-or-model-path /mnt/windows/demo/models/whisper-medium
|
||||||
/home/ipex/anaconda3/envs/llm/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: ''If you don't plan on using image functionality from `torchvision.io`, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have `libjpeg` or `libpng` installed before building `torchvision` from source?
|
/home/ipex/anaconda3/envs/llm/lib/python3.11/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: ''If you don't plan on using image functionality from `torchvision.io`, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have `libjpeg` or `libpng` installed before building `torchvision` from source?
|
||||||
warn(
|
warn(
|
||||||
|
|
||||||
[?] Which microphone do you choose?: Default
|
[?] Which microphone do you choose?: Default
|
||||||
|
|
@ -189,11 +189,11 @@ Extracting data files: 100%|█████████████████
|
||||||
Generating validation split: 73 examples [00:00, 5328.37 examples/s]
|
Generating validation split: 73 examples [00:00, 5328.37 examples/s]
|
||||||
Converting and loading models...
|
Converting and loading models...
|
||||||
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:09<00:00, 3.04s/it]
|
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:09<00:00, 3.04s/it]
|
||||||
/home/ipex/anaconda3/envs/yina-llm/lib/python3.9/site-packages/transformers/generation/configuration_utils.py:362: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.9` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`. This was detected when initializing the generation config instance, which means the corresponding file may hold incorrect parameterization and should be fixed.
|
/home/ipex/anaconda3/envs/yina-llm/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:362: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.9` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`. This was detected when initializing the generation config instance, which means the corresponding file may hold incorrect parameterization and should be fixed.
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
/home/ipex/anaconda3/envs/yina-llm/lib/python3.9/site-packages/transformers/generation/configuration_utils.py:367: UserWarning: `do_sample` is set to `False`. However, `top_p` is set to `0.6` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`. This was detected when initializing the generation config instance, which means the corresponding file may hold incorrect parameterization and should be fixed.
|
/home/ipex/anaconda3/envs/yina-llm/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:367: UserWarning: `do_sample` is set to `False`. However, `top_p` is set to `0.6` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`. This was detected when initializing the generation config instance, which means the corresponding file may hold incorrect parameterization and should be fixed.
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
/home/ipex/anaconda3/envs/yina-llm/lib/python3.9/site-packages/transformers/generation/utils.py:1411: UserWarning: You have modified the pretrained model configuration to control generation. This is a deprecated strategy to control generation and will be removed soon, in a future version. Please use a generation configuration file (see https://huggingface.co/docs/transformers/main_classes/text_generation )
|
/home/ipex/anaconda3/envs/yina-llm/lib/python3.11/site-packages/transformers/generation/utils.py:1411: UserWarning: You have modified the pretrained model configuration to control generation. This is a deprecated strategy to control generation and will be removed soon, in a future version. Please use a generation configuration file (see https://huggingface.co/docs/transformers/main_classes/text_generation )
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
Calibrating...
|
Calibrating...
|
||||||
Listening now...
|
Listening now...
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue