i started code with colab.research.google
first step is install requerment
!pip install -q ipdb
!pip install -q tqdm
!pip install -q sentencepiece
!pip install -q wandb
and also pytorch, but this library is already istalled if we use Colab.
after we installed requirments, we need change runtime setting in colab. change from CPU to T4GPU
and open new notebook and import necessary library
#import library
import os, sys
import ipdb
import tqdm
from datetime import datetime
import platform, shutil
import requests, zipfile, io
#pytorch
import torch
import torch.nn as nn
from torch.nn import functional as F
#tokenizer
import sentencepiece as spm
#these improve performance for Ampere architecture
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
#empty GPU cache memeory
torch.cuda.empty_cache()