Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
gpu-base-image-build
Commits
cc4fd7c9
Commit
cc4fd7c9
authored
Oct 15, 2024
by
chenpangpang
Browse files
合并了paddle分支
parents
e670fa96
ec35df8c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
11 deletions
+55
-11
build_space/Dockerfile.jupyterlab_ubuntu
build_space/Dockerfile.jupyterlab_ubuntu
+37
-3
build_space/build_ubuntu.sh
build_space/build_ubuntu.sh
+3
-3
build_space/python-requirements.txt
build_space/python-requirements.txt
+1
-1
script/1_base_test.sh
script/1_base_test.sh
+4
-3
script/2_text_test.sh
script/2_text_test.sh
+5
-1
script/3_image_test.sh
script/3_image_test.sh
+5
-0
No files found.
build_space/Dockerfile.jupyterlab_ubuntu
View file @
cc4fd7c9
...
...
@@ -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
...
...
build_space/build_ubuntu.sh
View file @
cc4fd7c9
#!/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
"
\0
33[32mBuild Image Successfully !
\0
33[0m"
else
echo
-e
"
\0
33[32mBuild Image fail!
\0
33[0m"
...
...
build_space/python-requirements.txt
View file @
cc4fd7c9
script/1_base_test.sh
View file @
cc4fd7c9
...
...
@@ -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
script/2_text_test.sh
View file @
cc4fd7c9
...
...
@@ -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
script/3_image_test.sh
View file @
cc4fd7c9
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment