Upload 11 files
Browse files- build/README.md +99 -0
- build/build_matplotlib.sh +3 -0
- build/build_torch.sh +3 -0
- build/launch_matplotlib.sh +8 -0
- build/launch_torch.sh +14 -0
- build/matplotlib.Dockerfile +46 -0
- build/numpy.Dockerfile +41 -0
- build/sklearn.Dockerfile +47 -0
- build/torch.Dockerfile +60 -0
- build/torch_gpu.Dockerfile +68 -0
- build/ubuntu-mirror-2204.txt +11 -0
build/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Build Setups
|
| 2 |
+
|
| 3 |
+
## Pytorch
|
| 4 |
+
|
| 5 |
+
The build setup require [Docker](https://docker.com/), and the built image has a size of about 2GB.
|
| 6 |
+
|
| 7 |
+
```shell
|
| 8 |
+
# Build docker image
|
| 9 |
+
$ docker build -t unknownue/pytorch.docs -f torch.Dockerfile .
|
| 10 |
+
|
| 11 |
+
# Build docs for pytorch
|
| 12 |
+
$ mkdir -p build/torch
|
| 13 |
+
$ docker run --rm \
|
| 14 |
+
-v $(pwd)/build/torch:/root/dev/pytorch/docs/build \
|
| 15 |
+
-w /root/dev/pytorch/docs/ \
|
| 16 |
+
unknownue/pytorch.docs \
|
| 17 |
+
pip3 install -r requirements.txt --no-cache-dir && \
|
| 18 |
+
make html
|
| 19 |
+
|
| 20 |
+
# Build docs for torchvision
|
| 21 |
+
$ mkdir -p build/vision
|
| 22 |
+
$ docker run --rm \
|
| 23 |
+
-v $(pwd)/build/vision:/root/dev/vision/docs/build \
|
| 24 |
+
-w /root/dev/vision/docs/ \
|
| 25 |
+
unknownue/pytorch.docs \
|
| 26 |
+
pip3 install -r requirements.txt --no-cache-dir && \
|
| 27 |
+
pip3 install --no-cache-dir av && \
|
| 28 |
+
make html
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
Now the documentation can be found in current `build` directory.
|
| 32 |
+
|
| 33 |
+
Remove docker images if need:
|
| 34 |
+
|
| 35 |
+
```shell
|
| 36 |
+
$ docker rmi unknownue/pytorch.docs
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Numpy
|
| 40 |
+
|
| 41 |
+
Build docker image:
|
| 42 |
+
|
| 43 |
+
```shell
|
| 44 |
+
$ docker build -t unknownue/numpy.docs -f numpy.Dockerfile .
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Build the documentation:
|
| 48 |
+
|
| 49 |
+
```shell
|
| 50 |
+
$ mkdir build/
|
| 51 |
+
$ docker run --rm \
|
| 52 |
+
-v $(pwd)/build:/root/numpy/doc/build \
|
| 53 |
+
-w /root/numpy/doc/ \
|
| 54 |
+
unknownue/numpy.docs \
|
| 55 |
+
make html
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
After the building finish, the documentation can be found in `build` directory.
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
## Scikit-learn
|
| 62 |
+
|
| 63 |
+
Build the docker image:
|
| 64 |
+
|
| 65 |
+
```shell
|
| 66 |
+
$ docker build -t unknownue/sklearn.docs -f sklearn.Dockerfile .
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
```shell
|
| 70 |
+
$ mkdir build/
|
| 71 |
+
$ docker run --rm \
|
| 72 |
+
-v $(pwd)/build:/root/scikit-learn/doc/_build \
|
| 73 |
+
-w /root/scikit-learn/doc/ \
|
| 74 |
+
unknownue/sklearn.docs \
|
| 75 |
+
make html
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
After the building finish, the documentation can be found in `_build/html/stable` directory.
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
## Matplotlib
|
| 82 |
+
|
| 83 |
+
Build the docker image:
|
| 84 |
+
|
| 85 |
+
```shell
|
| 86 |
+
$ docker build -t unknownue/matplotlib.docs -f matplotlib.Dockerfile .
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
```shell
|
| 90 |
+
$ mkdir build/
|
| 91 |
+
$ docker run --rm \
|
| 92 |
+
-v $(pwd)/build/matplotlib:/root/matplotlib/doc/build \
|
| 93 |
+
-w /root/matplotlib/doc/ \
|
| 94 |
+
unknownue/matplotlib.docs \
|
| 95 |
+
pip install -r ../requirements/doc/doc-requirements.txt && \
|
| 96 |
+
make html
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
After the building finish, the documentation can be found in `build/matplotlib` directory.
|
build/build_matplotlib.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
docker build -t unknownue/matplotlib.docs -f matplotlib.Dockerfile .
|
| 3 |
+
|
build/build_torch.sh
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
docker build -t unknownue/pytorch.docs -f torch_gpu.Dockerfile .
|
| 3 |
+
|
build/launch_matplotlib.sh
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
mkdir -p build/matplotlib
|
| 3 |
+
docker run -it --rm \
|
| 4 |
+
-v $(pwd)/build/matplotlib:/root/matplotlib/doc/build \
|
| 5 |
+
-w /root/matplotlib/doc/ \
|
| 6 |
+
unknownue/matplotlib.docs \
|
| 7 |
+
bash
|
| 8 |
+
|
build/launch_torch.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
mkdir -p build/torch
|
| 3 |
+
docker run -it --rm \
|
| 4 |
+
-v $(pwd)/build/torch:/root/dev/pytorch/docs/build/torch \
|
| 5 |
+
-v $(pwd)/build/vision:/root/dev/vision/docs/build/vision \
|
| 6 |
+
--gpus all \
|
| 7 |
+
-e NVIDIA_DRIVER_CAPABILITIES=graphics,display,compute,utility \
|
| 8 |
+
-w /root/dev/pytorch/docs/ \
|
| 9 |
+
unknownue/pytorch.docs \
|
| 10 |
+
bash
|
| 11 |
+
|
| 12 |
+
# pip3 install -r requirements.txt --no-cache-dir
|
| 13 |
+
# make html
|
| 14 |
+
|
build/matplotlib.Dockerfile
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# See also https://github.com/matplotlib/matplotlib/blob/master/doc/devel/documenting_mpl.rst
|
| 3 |
+
|
| 4 |
+
FROM ubuntu:22.04 AS matplotlib
|
| 5 |
+
|
| 6 |
+
LABEL maintainer="unknownue <unknownue@outlook.com>"
|
| 7 |
+
LABEL description="An docker environment to build offline Matplotlib docs"
|
| 8 |
+
LABEL license="MIT"
|
| 9 |
+
|
| 10 |
+
ARG MATPLOTLIB_VERSION=3.8.1
|
| 11 |
+
ARG PYTHON_VERSION=3.11
|
| 12 |
+
|
| 13 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 14 |
+
|
| 15 |
+
WORKDIR /root/
|
| 16 |
+
ADD ubuntu-mirror-2204.txt /etc/apt/sources.list
|
| 17 |
+
ENV PATH "/root/usr/bin:${PATH}"
|
| 18 |
+
|
| 19 |
+
# ADD sources.list /etc/apt/sources.list
|
| 20 |
+
RUN apt update && apt upgrade -y && \
|
| 21 |
+
apt install -y --no-install-recommends git wget build-essential p7zip-full ca-certificates ffmpeg && \
|
| 22 |
+
apt clean
|
| 23 |
+
|
| 24 |
+
RUN apt install -y --no-install-recommends python$PYTHON_VERSION python3-distutils
|
| 25 |
+
RUN wget https://bootstrap.pypa.io/get-pip.py && python$PYTHON_VERSION get-pip.py && \
|
| 26 |
+
ln -sf python$PYTHON_VERSION /usr/bin/python && ln -sf pip3 /usr/bin/pip
|
| 27 |
+
|
| 28 |
+
RUN pip3 install --upgrade pip
|
| 29 |
+
RUN pip3 install pqi && pqi use aliyun
|
| 30 |
+
|
| 31 |
+
# Install docs build dependencies
|
| 32 |
+
RUN apt install -y --no-install-recommends graphviz python3-tk optipng inkscape && \
|
| 33 |
+
pip install --no-cache-dir matplotlib==$MATPLOTLIB_VERSION \
|
| 34 |
+
sphinx sphinx_gallery sphinx_copybutton sphinxcontrib-svg2pdfconverter \
|
| 35 |
+
numpydoc ipython colorspacious scipy ipykernel
|
| 36 |
+
|
| 37 |
+
# Install latex dependencies
|
| 38 |
+
RUN apt install -y --no-install-recommends latexmk && \
|
| 39 |
+
apt install -y --no-install-recommends dvipng texlive-latex-extra texlive-full cm-super && \
|
| 40 |
+
apt install -y --no-install-recommends ttf-mscorefonts-installer fonts-noto-cjk fonts-humor-sans
|
| 41 |
+
|
| 42 |
+
RUN wget https://github.com/matplotlib/matplotlib/archive/refs/tags/v$MATPLOTLIB_VERSION.zip -O matplotlib.zip && \
|
| 43 |
+
7z x matplotlib.zip && rm matplotlib.zip && mv matplotlib-$MATPLOTLIB_VERSION/ matplotlib/
|
| 44 |
+
|
| 45 |
+
WORKDIR /root/matplotlib/doc
|
| 46 |
+
CMD ["bash"]
|
build/numpy.Dockerfile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# See also https://numpy.org/devdocs/docs/howto_build_docs.html
|
| 3 |
+
|
| 4 |
+
FROM ubuntu:18.04 AS numpy-docs-build
|
| 5 |
+
|
| 6 |
+
LABEL maintainer="unknownue <unknownue@outlook.com>"
|
| 7 |
+
LABEL description="An docker environment to build offline Numpy Docs"
|
| 8 |
+
LABEL numpy-version="1.18.1"
|
| 9 |
+
LABEL python-version="3.6.x"
|
| 10 |
+
LABEL license="MIT"
|
| 11 |
+
|
| 12 |
+
ARG NUMPY_VERSION=1.18.1
|
| 13 |
+
|
| 14 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 15 |
+
|
| 16 |
+
WORKDIR /root/
|
| 17 |
+
|
| 18 |
+
ENV PATH "/root/usr/bin:${PATH}"
|
| 19 |
+
|
| 20 |
+
RUN apt update && apt upgrade -y && \
|
| 21 |
+
apt install -y --no-install-recommends git wget build-essential ca-certificates && \
|
| 22 |
+
apt clean
|
| 23 |
+
|
| 24 |
+
# Install Python 3.6 and corresponding pip
|
| 25 |
+
RUN apt install -y --no-install-recommends python3.6 python3-distutils && \
|
| 26 |
+
wget https://bootstrap.pypa.io/get-pip.py && python3.6 get-pip.py && \
|
| 27 |
+
apt clean && \
|
| 28 |
+
ln -sf python3.6 /usr/bin/python && ln -sf pip3 /usr/bin/pip && \
|
| 29 |
+
pip3 install --upgrade pip && \
|
| 30 |
+
pip install --no-cache-dir numpy==$NUMPY_VERSION sphinx==2.4.2 scipy==1.4.1 ipython Matplotlib numpydoc
|
| 31 |
+
|
| 32 |
+
# install latex
|
| 33 |
+
RUN apt install -y --no-install-recommends latexmk && \
|
| 34 |
+
apt install -y --no-install-recommends texlive-latex-extra
|
| 35 |
+
|
| 36 |
+
RUN git clone https://github.com/numpy/numpy.git && cd numpy && \
|
| 37 |
+
git checkout tags/v$NUMPY_VERSION && \
|
| 38 |
+
git submodule init && \
|
| 39 |
+
git submodule update
|
| 40 |
+
|
| 41 |
+
CMD ["bash"]
|
build/sklearn.Dockerfile
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# See also https://scikit-learn.org/dev/developers/contributing.html#documentation
|
| 3 |
+
|
| 4 |
+
FROM ubuntu:22.04 AS sklearn
|
| 5 |
+
|
| 6 |
+
LABEL maintainer="unknownue <unknownue@outlook.com>"
|
| 7 |
+
LABEL description="An docker environment to build offline scikit-learn Docs"
|
| 8 |
+
LABEL license="MIT"
|
| 9 |
+
|
| 10 |
+
ARG PYTHON_VERSION=3.11
|
| 11 |
+
ARG SKLEARN_VERSION=1.3.2
|
| 12 |
+
|
| 13 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 14 |
+
|
| 15 |
+
WORKDIR /root/
|
| 16 |
+
|
| 17 |
+
ENV PATH "/root/usr/bin:${PATH}"
|
| 18 |
+
|
| 19 |
+
RUN apt update && apt upgrade -y && \
|
| 20 |
+
apt install -y --no-install-recommends git wget build-essential p7zip-full ca-certificates ffmpeg && \
|
| 21 |
+
apt clean
|
| 22 |
+
|
| 23 |
+
# Install Python 3 and corresponding pip
|
| 24 |
+
RUN apt install -y --no-install-recommends python$PYTHON_VERSION python3-distutils python3-scipy python$PYTHON_VERSION-dev && \
|
| 25 |
+
wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && \
|
| 26 |
+
apt clean && \
|
| 27 |
+
ln -sf python$PYTHON_VERSION /usr/bin/python && ln -sf pip3 /usr/bin/pip
|
| 28 |
+
|
| 29 |
+
RUN pip3 install --upgrade pip && \
|
| 30 |
+
pip3 install pqi && pqi use aliyun
|
| 31 |
+
|
| 32 |
+
RUN pip3 install --no-cache-dir Cython joblib pytest && \
|
| 33 |
+
pip3 install --no-cache-dir sphinx sphinx-gallery numpydoc matplotlib Pillow pandas \
|
| 34 |
+
scikit-image packaging seaborn sphinx-prompt \
|
| 35 |
+
sphinxext-opengraph sphinx-copybutton plotly pooch && \
|
| 36 |
+
pip install --no-cache-dir scikit-learn==$SKLEARN_VERSION
|
| 37 |
+
|
| 38 |
+
# install latex
|
| 39 |
+
# RUN apt install -y --no-install-recommends latexmk && \
|
| 40 |
+
# apt install -y --no-install-recommends texlive-latex-extra
|
| 41 |
+
|
| 42 |
+
RUN wget https://github.com/scikit-learn/scikit-learn/archive/refs/tags/$SKLEARN_VERSION.zip -O sklearn.zip && \
|
| 43 |
+
7z x sklearn.zip && rm sklearn.zip && mv scikit-learn-$SKLEARN_VERSION/ sklearn/
|
| 44 |
+
|
| 45 |
+
WORKDIR /root/scikit-learn/doc
|
| 46 |
+
CMD ["bash"]
|
| 47 |
+
|
build/torch.Dockerfile
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM ubuntu:22.04 AS pytorch-docs-build
|
| 3 |
+
|
| 4 |
+
LABEL maintainer="unknownue <unknownue@outlook.com>"
|
| 5 |
+
LABEL description="An docker environment to build offline PyTorch Docs"
|
| 6 |
+
LABEL license="MIT"
|
| 7 |
+
|
| 8 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 9 |
+
|
| 10 |
+
ARG VERSION_PYTHON=python3.12
|
| 11 |
+
ARG VERSION_PYTORCH=2.1.0
|
| 12 |
+
ARG VERSION_VISION=0.16.0
|
| 13 |
+
|
| 14 |
+
WORKDIR /root/
|
| 15 |
+
ADD ubuntu-mirror-2204.txt /etc/apt/sources.list
|
| 16 |
+
|
| 17 |
+
RUN apt update && apt install -y ca-certificates
|
| 18 |
+
RUN apt update && \
|
| 19 |
+
apt install -y --no-install-recommends git wget p7zip-full build-essential && \
|
| 20 |
+
apt install -y --no-install-recommends software-properties-common && \
|
| 21 |
+
add-apt-repository ppa:deadsnakes/ppa && \
|
| 22 |
+
apt clean
|
| 23 |
+
|
| 24 |
+
# ENV PATH "/root/usr/bin:${PATH}"
|
| 25 |
+
|
| 26 |
+
# Install Python and corresponding pip
|
| 27 |
+
RUN apt install -y --no-install-recommends $VERSION_PYTHON python3-distutils && \
|
| 28 |
+
wget https://bootstrap.pypa.io/get-pip.py && $VERSION_PYTHON get-pip.py && \
|
| 29 |
+
# $VERSION_PYTHON get-pip.py && \
|
| 30 |
+
apt install -y --no-install-recommends $VERSION_PYTHON-dev && \
|
| 31 |
+
apt clean && \
|
| 32 |
+
ln -sf $VERSION_PYTHON /usr/bin/python && ln -sf pip3 /usr/bin/pip
|
| 33 |
+
# RUN pip3 install pqi && pqi use aliyun
|
| 34 |
+
|
| 35 |
+
WORKDIR /root/dev/
|
| 36 |
+
|
| 37 |
+
# clone PyTorch and vision Repository
|
| 38 |
+
RUN pip3 install setuptools --no-cache-dir && \
|
| 39 |
+
wget https://github.com/pytorch/vision/archive/v$VERSION_VISION.zip -O vision.zip && \
|
| 40 |
+
wget https://github.com/pytorch/pytorch/archive/v$VERSION_PYTORCH.zip -O torch.zip && \
|
| 41 |
+
7z x vision.zip && 7z x torch.zip && \
|
| 42 |
+
rm vision.zip && rm torch.zip && mv vision-$VERSION_VISION/ vision/ && mv pytorch-$VERSION_PYTORCH/ pytorch/
|
| 43 |
+
RUN wget https://github.com/pytorch/pytorch/raw/master/requirements.txt -P /home/unknownue/deps/ && \
|
| 44 |
+
echo "torch==$VERSION_PYTORCH" >> /home/unknownue/deps/requirements.txt && \
|
| 45 |
+
echo "torchvision==$VERSION_VISION" >> /home/unknownue/deps/requirements.txt && \
|
| 46 |
+
$VERSION_PYTHON -m pip install --no-cache-dir --no-deps -r /home/unknownue/deps/requirements.txt
|
| 47 |
+
# pip3 install torch==$VERSION_PYTORCH torchvision==$VERSION_VISION --no-cache-dir
|
| 48 |
+
|
| 49 |
+
# install katex globally. See https://github.com/pytorch/pytorch/issues/27705
|
| 50 |
+
RUN apt install -y --no-install-recommends nodejs npm
|
| 51 |
+
RUN npm cache clear --force && \
|
| 52 |
+
npm config set registry https://registry.npmmirror.com && \
|
| 53 |
+
npm install -g katex
|
| 54 |
+
|
| 55 |
+
# clean up
|
| 56 |
+
RUN apt autoremove -y && apt clean && \
|
| 57 |
+
rm /usr/bin/python && ln -s /usr/bin/$VERSION_PYTHON /usr/bin/python
|
| 58 |
+
|
| 59 |
+
CMD ["bash"]
|
| 60 |
+
|
build/torch_gpu.Dockerfile
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04 AS pytorch-docs-build
|
| 3 |
+
|
| 4 |
+
LABEL maintainer="unknownue <unknownue@outlook.com>"
|
| 5 |
+
LABEL description="An docker environment to build offline PyTorch Docs"
|
| 6 |
+
LABEL license="MIT"
|
| 7 |
+
|
| 8 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 9 |
+
|
| 10 |
+
ARG VERSION_PYTHON=python3.11
|
| 11 |
+
ARG VERSION_PYTORCH=2.1.0
|
| 12 |
+
ARG VERSION_VISION=0.16.0
|
| 13 |
+
|
| 14 |
+
WORKDIR /root/
|
| 15 |
+
ADD ubuntu-mirror-2204.txt /etc/apt/sources.list
|
| 16 |
+
|
| 17 |
+
RUN apt update && apt install -y ca-certificates
|
| 18 |
+
RUN apt update && \
|
| 19 |
+
apt install -y --no-install-recommends git wget p7zip-full build-essential && \
|
| 20 |
+
apt install -y --no-install-recommends software-properties-common && \
|
| 21 |
+
add-apt-repository ppa:deadsnakes/ppa && \
|
| 22 |
+
apt clean
|
| 23 |
+
|
| 24 |
+
# ENV PATH "/root/usr/bin:${PATH}"
|
| 25 |
+
|
| 26 |
+
# Install Python and corresponding pip
|
| 27 |
+
RUN apt install -y --no-install-recommends $VERSION_PYTHON python3-distutils && \
|
| 28 |
+
wget https://bootstrap.pypa.io/get-pip.py && $VERSION_PYTHON get-pip.py && \
|
| 29 |
+
# $VERSION_PYTHON get-pip.py && \
|
| 30 |
+
apt install -y --no-install-recommends $VERSION_PYTHON-dev && \
|
| 31 |
+
apt clean && \
|
| 32 |
+
ln -sf $VERSION_PYTHON /usr/bin/python && ln -sf pip3 /usr/bin/pip
|
| 33 |
+
# RUN pip3 install pqi && pqi use aliyun
|
| 34 |
+
|
| 35 |
+
WORKDIR /root/dev/
|
| 36 |
+
|
| 37 |
+
# clone PyTorch and vision Repository
|
| 38 |
+
RUN pip3 install setuptools --no-cache-dir && \
|
| 39 |
+
wget https://github.com/pytorch/vision/archive/v$VERSION_VISION.zip -O vision.zip && \
|
| 40 |
+
wget https://github.com/pytorch/pytorch/archive/v$VERSION_PYTORCH.zip -O torch.zip && \
|
| 41 |
+
7z x vision.zip && 7z x torch.zip && \
|
| 42 |
+
rm vision.zip && rm torch.zip && mv vision-$VERSION_VISION/ vision/ && mv pytorch-$VERSION_PYTORCH/ pytorch/
|
| 43 |
+
|
| 44 |
+
RUN wget https://download.pytorch.org/whl/cu121/torch-2.1.0%2Bcu121-cp311-cp311-linux_x86_64.whl && \
|
| 45 |
+
wget https://download.pytorch.org/whl/cu121/torchvision-0.16.0%2Bcu121-cp311-cp311-linux_x86_64.whl && \
|
| 46 |
+
pip3 install torch-2.1.0+cu121-cp311-cp311-linux_x86_64.whl && \
|
| 47 |
+
pip3 install torchvision-0.16.0+cu121-cp311-cp311-linux_x86_64.whl && \
|
| 48 |
+
rm torch-2.1.0+cu121-cp311-cp311-linux_x86_64.whl && \
|
| 49 |
+
rm torchvision-0.16.0+cu121-cp311-cp311-linux_x86_64.whl
|
| 50 |
+
|
| 51 |
+
RUN wget https://raw.githubusercontent.com/pytorch/pytorch/v$VERSION_PYTORCH/requirements.txt -P /home/unknownue/deps/ && \
|
| 52 |
+
echo "torch==$VERSION_PYTORCH" >> /home/unknownue/deps/requirements.txt && \
|
| 53 |
+
echo "torchvision==$VERSION_VISION" >> /home/unknownue/deps/requirements.txt && \
|
| 54 |
+
pip3 install --no-cache-dir --no-deps -r /home/unknownue/deps/requirements.txt
|
| 55 |
+
# pip3 install torch==$VERSION_PYTORCH torchvision==$VERSION_VISION --no-cache-dir
|
| 56 |
+
|
| 57 |
+
# install katex globally. See https://github.com/pytorch/pytorch/issues/27705
|
| 58 |
+
RUN apt install -y --no-install-recommends nodejs npm
|
| 59 |
+
RUN npm cache clear --force && \
|
| 60 |
+
npm config set registry https://registry.npmmirror.com && \
|
| 61 |
+
npm install -g katex
|
| 62 |
+
|
| 63 |
+
# clean up
|
| 64 |
+
RUN apt autoremove -y && apt clean && \
|
| 65 |
+
rm /usr/bin/python && ln -s /usr/bin/$VERSION_PYTHON /usr/bin/python
|
| 66 |
+
|
| 67 |
+
CMD ["bash"]
|
| 68 |
+
|
build/ubuntu-mirror-2204.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
| 2 |
+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
| 3 |
+
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
|
| 4 |
+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
|
| 5 |
+
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
|
| 6 |
+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
|
| 7 |
+
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
|
| 8 |
+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
|
| 9 |
+
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
| 10 |
+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
| 11 |
+
|