配置环境流程

1. 首先建立新环境 conda create -n ReID python=3.8

移植环境 :conda create -n BBB --clone 原名
进入环境:source activate ReID
退出环境:conda deactivate
问题1:
CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate’.
To initialize your shell, run

$ conda init <SHELL_NAME>

Currently supported shells are:

  • bash
  • fish
  • tcsh
  • xonsh
  • zsh
  • powershell

See ‘conda init --help’ for more information and options.

IMPORTANT: You may need to close and restart your shell after running ‘conda init’.

首先终端输入 source activate,再激活环境。(可以看到前面没有base)

2. 安装pytorch等

进入官网https://pytorch.org/get-started/locally/,按照要求选择后直接复制命令
比如
Ubuntu :pip3 install torch torchvision torchaudio

Windows:pip3 install torch1.8.1+cu102 torchvision0.9.1+cu102 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

Pip的命令后面都可以加上加速指令

安装CV2
pip install opencv-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

出现问题,版本太高,高出nVidia本身的驱动版本,nvidia-smi后右上角发现cuda10.1,而我下的是10.2,肯定不行
pip3 uninstall torch torchvision torchaudio后重新安装,https://pytorch.org/get-started/previous-versions/,寻找以前的版本

conda install pytorch1.7.1 torchvision0.8.2 torchaudio==0.7.2 cudatoolkit=10.1 -c pytorch

依然出现问题,包太大,下载起来太慢

后采用pip,用加速链接

pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

3. 安装完相关包之后退出环境

测试命令:
 进入python
 import torch
 print(torch.version)
 torch.cuda.is_available()
实验记录:
除了配置环境之外,其他改的地方有:数据集路径,预训练的模型
疑问:
之前配置的比较高的环境,在台式电脑anonaconda中创建,在spyder中运行,出现的问题:

  1. 路径指定错误,windows中copy的地址只需把斜杠反向就可以
  2. 多gpu参数模式在单GPU时遇到问题
  3. 内存过小,batchsize改小
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值