conda換源安裝torch+vscode分布式訓練調試的實現(xiàn)
conda換源安裝torch(linux系統(tǒng)+anaconda)
1、找到.condarc文件
2、替換為一下內容:
channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ - defaults show_channel_urls: true default_channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r - 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
3、conda info 命令查看目前使用的源
4、通過nvidia-smi查看自己電腦支持的cuda最高版本
5、conda search pytorch 查看目前可用conda 安裝的pytorch版本,注意不僅查看版本號,還要看后面的release版本
6、安裝pytorch GPU版本:conda install pytorch=1.12.1=gpu_cuda113py38h19ae3d8_1
7、以上方案可以直接在虛擬環(huán)境執(zhí)行,不需要自己單獨安裝cuda與cudnn,但是還需要安裝torchvision,同樣conda search torchvision之后按照后面的release版本查看和自己cuda(113)相符合的版本,執(zhí)行安裝:conda install torchvision=0.13.1=py38_cu113
8、大工告成,這是目前嘗試過最簡單的安裝方法。
9、以往我們安裝的時候只注意版本號,比如1.12.1這些,但是一個版本號可能對應很多個release版本,直接安裝往往不匹配,因此后面需要把release版本加上做一個限制。
vscode分布式訓練調試
單卡訓練往往好調試,那么多卡怎們辦呢?很簡單,在launch.json中修改:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: 當前文件",
"type": "python",
"request": "launch",
"program": "/home/{你自己的用戶名}/.conda/envs/{虛擬環(huán)境名稱}/lib/python3.7/site-packages/torch/distributed/launch.py",
"console": "integratedTerminal",
"args": [
"--nproc_per_node=1",
"fixmatch.py",
],
"env": {"CUDA_VISIBLE_DEVICES":"0"},
}
]
}
總的來說就是找到你目前虛擬環(huán)境中l(wèi)aunch.py位置替換program以及將你執(zhí)行的主文件替換fixmatch.py。
到此這篇關于conda換源安裝torch+vscode分布式訓練調試的實現(xiàn)的文章就介紹到這了,更多相關conda換源安裝torch+vscode內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
Python+AutoIt實現(xiàn)界面工具開發(fā)過程詳解
這篇文章主要介紹了Python+AutoIt實現(xiàn)界面工具開發(fā)過程詳解,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下2019-08-08
一文帶你詳解Python中sys.executable函數(shù)的作用
sys.executable函數(shù)是用來獲取當前Python解釋器的完整路徑的,本文主要介紹了一文帶你詳解Python中sys.executable函數(shù)的作用,具有一定的參考價值,感興趣的可以了解一下2024-03-03
Python使用Paramiko庫實現(xiàn)SSH管理詳解
paramiko 是一個用于在Python中實現(xiàn)SSHv2協(xié)議的庫,它支持對遠程服務器進行加密的通信,本文主要介紹了如何使用Paramiko庫實現(xiàn)SSH管理,感興趣的小伙伴可以學習一下2023-11-11
pyhton中__pycache__文件夾的產(chǎn)生與作用詳解
這篇文章主要介紹了pyhton中__pycache__文件夾的產(chǎn)生與作用詳解,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-11-11

