Here are some scripts to initialize your python environment to mirror your repo.
For Anaconda:
[bash]
cat > HOME/.condarc << 'EOF'
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
EOF
conda clean -i
[/bash]
## For PIP
[bash]
pip config set global.index-url http://pypi.doubanio.com/simple
pip config set global.trusted-host pypi.doubanio.com
[/bash]
## For PyTorch
[bash]
export TORCH_VERSION=1.12.0+cu116
export TORCH_AUDIO_VERSION=0.12.0+cu116
export TORCH_VISION_VERSION=0.13.0+cu116
export TORCH_TEXT_VERSION=0.13.0
export TORCH_MIRROR=https://mirror.sjtu.edu.cn/pytorch-wheels/torch_stable.html
pip install --no-cache-dir \
torch==TORCH_VERSION
torchaudio==TORCH_VISION_VERSION
torchtext==$TORCH_TEXT_VERSION
-f $TORCH_MIRROR
[/bash]
Torch in Dockerfile
ARG TORCH_VERSION=1.12.0+cu116
ARG TORCH_AUDIO_VERSION=0.12.0+cu116
ARG TORCH_VISION_VERSION=0.13.0+cu116
ARG TORCH_TEXT_VERSION=0.13.0
ARG TORCH_MIRROR=https://mirror.sjtu.edu.cn/pytorch-wheels/torch_stable.html
# ARG TORCH_MIRROR=https://download.pytorch.org/whl/torch_stable.html
# Install torch packages
RUN pip install --no-cache-dir \
torch==$TORCH_VERSION \
torchaudio==$TORCH_AUDIO_VERSION \
torchvision==$TORCH_VISION_VERSION \
torchtext==$TORCH_TEXT_VERSION \
-f $TORCH_MIRROR
Comments
No comments yet — be the first to write one.