AI 활용 소프트웨어 개발/AI, 머신러닝, 딥러닝

Local GPU (Vscode) 환경 설정 및 사용하기

ha2yong 2025. 8. 13. 00:44

nvidia-smi


# (선택) 새 가상환경 권장
python -m venv venv
.\venv\Scripts\activate

# PyTorch(GPU) 설치

pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu118



# 설치 검증

import torch
print("torch:", torch.__version__)
print("cuda available:", torch.cuda.is_available())
print(torch.version.cuda)   # 빌드된 CUDA 버전
print(torch.backends.cudnn.version())  # cuDNN 버전
if torch.cuda.is_available():
    print("device:", torch.cuda.get_device_name(0))

 


# gpu 가속
torch.backends.cudnn.benchmark = True
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True

 


# 최신 Ultralytics
pip install -U ultralytics opencv-python tqdm matplotlib pyyaml

 


# paddle ocr
python -m pip install paddlepaddle-gpu==3.0.0rc0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/