生成环境的requirements.txt,参考[1]
ty@ubuntu:~$ conda env list
ty@ubuntu:~$ source activate p36t14
(p36t14) ty@ubuntu:~$ pip3 freeze > requirements.txt
删除requirements.txt中无关的两行
olefile @ file:///Users/ktietz/demo/mc3/conda-bld/olefile_1629805411829/work
six @ file:///tmp/build/80754af9/six_1644875935023/work
安装tsne环境
conda create -n tsne python=3.6 -y
pip3 install -r requirements
tsne cuda的安装和使用,参考【2】
conda install -c CannyLab -c pytorch tsnecuda
tsne使用pytorch1.4.0,而模型生成使用pytorch1.6.0。修改保存模型的代码。参考[3]
torch.save(infos, la_file, _use_new_zipfile_serialization=False)
参考:
[1] python 虚拟环境创建和requirements的使用 https://www.cnblogs.com/dairuiquan/p/11981256.html
[2] tsne cuda项目地址 https://github.com/CannyLab/tsne-cuda
[3] 低版本torch加载高版本torch模型 https://blog.csdn.net/lbj1260200629/article/details/109848137
修改保存模型代码,或者取出模型重新保存,很麻烦。所以将torch1.4.0升级到1.6.0
conda create -n p36t16 --clone tsnecuda
pip uninstall torch
pip uninstall torchvision
pip install torch=1.6.0 torchvision=0.7.0 (1.6的torch需要0.7vision)