코랩 사용 모음

·2022년 12월 30일
0

코랩에서 .py 실행

1. 구글 드라이브 연동
from google.colab import drive
drive.mount('/content/gdrive/')

2.
import os
os.chdir('/content/gdrive/My Drive/경로')

%run test.py

코랩 구독 최대한 활용

1. 더 빠른 GPU
런타임 유형 변경 후 다음 코드 실행

gpu_info = !nvidia-smi
gpu_info = '\n'.join(gpu_info)
if gpu_info.find('failed') >= 0:
  print('Not connected to a GPU')
else:
  print(gpu_info)
  
2. 추가 메모리
고용량 RAM 사용 설정 후 다음 코드 실행

from psutil import virtual_memory
ram_gb = virtual_memory().total / 1e9
print('Your runtime has {:.1f} gigabytes of available RAM\n'.format(ram_gb))

if ram_gb < 20:
  print('Not using a high-RAM runtime')
else:
  print('You are using a high-RAM runtime!')

0개의 댓글