본문 바로가기
서버,아나콘다,vscode

vscode 주피터 커널 등록 / CUDA에 맞는 torch 설치

by 고경수 2023. 4. 21.

VScode 주피터 커널 등록

가상환경 생성 후 vscode 주피터에서 쓰고 싶으면 커널에 등록해줘야함.

$ conda create -n [가상환경이름] python=3.8

 

$ pip install ipykernel

 

$ python -m ipykernel install --user --name [가상환경이름] --display-name [가상환경이름]

 

+ 터미널에서 가상환경이 안뜨는 경우

 ctrl + shift + p → Python: select interpreter -> 가상환경 선택!


CUDA에 맞는 torch 설치

$ nvcc --version

으로 쿠다 버전 확인 후, torch, torchvision 해당 쿠다에 맞게 install

 

이전버전

https://pytorch.org/get-started/previous-versions/

 

PyTorch

An open source machine learning framework that accelerates the path from research prototyping to production deployment.

pytorch.org

ex) CUDA 11.3

$ conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch

 

최신버전(CUDA 11.7 ↑ ?)

https://pytorch.org/get-started/locally/

 

PyTorch

An open source machine learning framework that accelerates the path from research prototyping to production deployment.

pytorch.org

ex) CUDA 11.8

$ pip3 install numpy --pre torch torchvision torchaudio --force-reinstall --index-url https://download.pytorch.org/whl/nightly/cu118