在编译BIT_CD项目中需要用到的一些笔记

python设置默认镜像源:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

在cmd中运行以上命令,即可直接设置成功

附上其他国内镜像源:

清华:https://pypi.tuna.tsinghua.edu.cn/simple

阿里云:http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

华中理工大学:http://pypi.hustunique.com/

山东理工大学:http://pypi.sdutlinux.org/

豆瓣:http://pypi.douban.com/simple/

 

当前:
cuda 11.1.105 (nvcc -V)
cudnn 8.2.0 (cudnn_version.h)

目标:
Python 3.6
pytorch 1.6.0
torchvision 0.7.0
einops  0.3.0


test:
conda install pytorch=1.6 torchvision=0.7 cudatoolkit=10.1
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
conda install tifffile -c conda-forge

python .\demo.py

import torch
torch.cuda.is_available()

train:
conda install git
pip install matplotlib

sh scripts/run_cd.sh

卸载 安装:
3.1 用pip卸载PyTorch
pip uninstall torch
3.2 用conda卸载PyTorch
conda uninstall pytorch
conda uninstall libtorch

测试:
import torch
torch.cuda.is_available()

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

离线下载:
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/

离线安装:
https://blog.csdn.net/weixin_44455154/article/details/105322330

from torchvision.models.utils import load_state_dict_from_url
改为
from torch.hub import load_state_dict_from_url

假设我们需要将自己用Anaconda新建的虚拟环境迁移到别的电脑,有一个很简单的方法:

1-先激活当前环境(假设环境名为tf)

conda activate pytorch.yaml

2-开始导出:env.yaml为导出的文件

conda env export > pytorch.yaml

3-导入到另一个电脑

conda env create -f pytorch.yaml

posted @ 2023-03-15 14:11  秋月的私语  阅读(40)  评论(0编辑  收藏  举报