Commit cc4fd7c9 authored by chenpangpang's avatar chenpangpang
Browse files

合并了paddle分支

parents e670fa96 ec35df8c
......@@ -15,7 +15,15 @@ ARG TORCHAUDIO_VERSION
# ----- tensorflow args -----
ARG TENSORFLOW_VERSION
ARG CONDA_URL="https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py310_24.7.1-0-Linux-x86_64.sh"
#ARG CONDA_URL="https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py310_24.7.1-0-Linux-x86_64.sh"
# ----- paddlepaddle args -----
ARG PADDLEPADDLE_VERSION
ARG PADDLENLP_VERSION
ARG CUDA_VERSION
ARG PADDLE_URL
# ----- conda and python args ----
ARG CONDA_URL
#ARG CONDA_URL="https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py310_24.7.1-0-Linux-x86_64.sh"
ARG SOURCES="-i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn"
ENV TZ=Asia/Shanghai
ENV SHELL=/bin/bash \
......@@ -43,8 +51,9 @@ RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak \
&& apt-get install --no-install-recommends -y vim openssl libssl-dev net-tools locales wget git git-lfs sudo openssh-client openssh-server \
&& locale-gen en_US.UTF-8
# ----- conda and python install -----
RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \
RUN if [ -n "$CONDA_URL" ];then \
mkdir -p /tmp/conda-extension \
&& cd /tmp/conda-extension \
&& wget $CONDA_URL \
......@@ -53,6 +62,15 @@ RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \
&& cd .. \
&& rm -rf /tmp/conda-extension; fi
#RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \
# mkdir -p /tmp/conda-extension \
# && cd /tmp/conda-extension \
# && wget $CONDA_URL \
# && bash $(echo $CONDA_URL | awk -F "/" '{print $NF}') -b -p /opt/conda \
# && echo "export PATH=\$PATH:/opt/conda/bin" >> /etc/profile.d/sothisai.sh \
# && cd .. \
# && rm -rf /tmp/conda-extension; fi
ENV PATH=$PATH:/opt/conda/bin
RUN pip3 install --upgrade pip ${SOURCES} || pip install --upgrade pip ${SOURCES} \
......@@ -60,7 +78,6 @@ RUN pip3 install --upgrade pip ${SOURCES} || pip install --upgrade pip ${SOURCES
&& mv /etc/apt/sources.list.bak /etc/apt/sources.list \
&& mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d
RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 && -n "$TORCH_VERSION" ];then \
pip3 install torch==$TORCH_VERSION torchvision==$TORCHVISION_VERSION torchaudio==$TORCHAUDIO_VERSION \
--index-url https://download.pytorch.org/whl/cu$(echo "$BASE_IMAGE" | awk -F'[:-]' '{n=split($2,a,"."); print a[1] a[2]}') \
......@@ -76,6 +93,23 @@ RUN if [ -n "$TENSORFLOW_VERSION" ]; then \
apt-get update -y && \
apt-get install --no-install-recommends -y libnvinfer8 libnvjitlink-12-3 libnvjpeg-12-3 libnvinfer-plugin8; fi
# ----- paddlepaddle install -----
RUN if [ -n "$PADDLEPADDLE_VERSION" ] && [ -n "$PADDLE_URL" ]; then \
pip install paddlepaddle-gpu==$PADDLEPADDLE_VERSION -f $PADDLE_URL -i $PADDLE_URL \
&& rm -r /root/.cache/pip; \
fi
RUN if [ -n "$PADDLEPADDLE_VERSION" ] && [ -z "$PADDLE_URL" ]; then \
pip install paddlepaddle-gpu==$PADDLEPADDLE_VERSION -i https://pypi.tuna.tsinghua.edu.cn/simple \
&& rm -r /root/.cache/pip; \
fi
RUN if [ -n "$PADDLENLP_VERSION" ] ; then \
pip install paddlenlp==$PADDLENLP_VERSION ppdiffusers huggingface_hub --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple && \
pip install --upgrade ppdiffusers --no-deps && rm -r /root/.cache/pip; \
fi
COPY ./python-requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/python-requirements.txt
......
#!/bin/bash
# 框架
framework=$1
# 输出镜像tag
......@@ -38,8 +37,9 @@ cp -f ./Dockerfile.${framework}_ubuntu ./tmp/${tmp_dockerfile}
echo "docker build -f ./tmp/${tmp_dockerfile} -t ${image_tag} $build_args ./tmp/"
docker build -f ./tmp/${tmp_dockerfile} -t ${image_tag} $build_args ./tmp/
#echo "docker build -f ./tmp/${tmp_dockerfile} -t ${image_tag} $build_args ./tmp/"
build_status=$?
rm -r ./tmp
if [[ $? -eq 0 ]];then
if [[ build_status -eq 0 ]];then
echo -e "\033[32mBuild Image Successfully !\033[0m"
else
echo -e "\033[32mBuild Image fail!\033[0m"
......
......@@ -34,11 +34,12 @@ elif [[ "$1" == *"tensorflow"* ]]; then
print(\"tensorflow cuda available: \", tf.test.is_gpu_available()); \
os.system('nvcc -V | tail -n 2')
"
elif [[ "$1" == *"paddle"* ]]; then
TARGET_DIR=gpu-base-image-test/paddletest
docker run --rm --platform=linux/amd64 --gpus all -v ./$TARGET_DIR:/workspace --workdir /workspace $1 python base_test.py
else
echo "ERROR: no supported test shell"
exit 1
fi
......@@ -11,3 +11,7 @@ if [[ "$1" == *"pytorch"* ]]; then \
if [[ "$1" == *"tensorflow"* ]]; then \
docker run --rm --platform=linux/amd64 --gpus all -v ./$TARGET_DIR:/workspace --workdir /workspace/tensorflow/bert $1 python infer.py; fi
if [[ "$1" == *"paddle"* ]]; then \
TARGET_DIR=gpu-base-image-test/paddletest \
docker run --rm --platform=linux/amd64 --gpus all -v ./$TARGET_DIR:/workspace --workdir /workspace $1 python text.py; fi
......@@ -11,3 +11,8 @@ if [[ "$1" == *"pytorch"* ]]; then \
if [[ "$1" == *"tensorflow"* ]]; then \
docker run --rm --platform=linux/amd64 --gpus all -v ./$TARGET_DIR:/workspace --workdir /workspace/tensorflow/mnist $1 python train.py; fi
if [[ "$1" == *"paddle"* ]]; then \
TARGET_DIR=gpu-base-image-test/paddletest \
docker run --rm --platform=linux/amd64 --gpus all -v ./$TARGET_DIR:/workspace --workdir /workspace $1 python image.py; fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment