[Pytorch] Seed 고정 torch.manual_seed(seed) np.random.seed(seed) random.seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False Code/Pytorch 2023.05.09
[Linux] GPU서버에 dataset 다운로드 (wget, Google Drive, scp) 1. 링크로 바로 다운 받는 경우cd data/dataset/wget $url 1-1. wget 링크로 다운받을 때 로그인이 필요한 경우 가끔 로그인이 필요한 dataset 제공 사이트가 있음 (NTU RGB+D, ...) 이런 경우 그냥 wget 으로 진행하면 제대로 다운로드가 되지 않음 따라서 웹에서 로그인한 상태로 쿠키정보를 복사해서 wget 옵션에 넣어주면 됨 쿠키 복사하는법더보기해당 데이터셋 홈페이지에서 F12 로 개발자모드 진입Network 탭에서 Preserve log 체크다운받고자 하는 파일 링크 클릭하면 해당 이름으로 발생한 요청 항목 선택Headers 탭에서 Request headers 확인그 안에 'Cookie:' 의 내용을 아래 예시와 같이 통째로 복사wget --header $쿠키.. Code/Linux Conda 2023.04.18
[Pytorch] GPU에 맞는 CUDA version 설치 아래 링크를 통해 본인 GPU 에 맞는 CUDA 버전 확인 https://www.wikiwand.com/en/CUDA#GPUs_supported Wikiwand - CUDACUDA is a proprietary and closed source parallel computing platform and application programming interface that allows software to use certain types of graphics processing units for general purpose processing, an approach called general-purpose computing onwww.wikiwand.com아래 링크를 통해 특정 CUDA 버전의 pytorch .. Code/Pytorch 2023.04.14
[Pytorch] pytorch version 확인 터미널 열고 아래 명령어 입력python -m torch.utils.collect_env 아래와 같이 출력됨Versions of relevant libraries:[pip3] numpy==1.24.4[pip3] torch==2.4.1[pip3] torchvision==0.19.1[pip3] triton==3.0.0[conda] numpy 1.24.4 pypi_0 pypi[conda] torch 2.4.1 pypi_0 pypi[conda] torchvision 0.19.1 pypi_0 pypi[co.. Code/Pytorch 2023.04.14
[Pytorch] Tensor 에서 특정 index 의 값을 뽑아 새로운 tensor 정의 torch.where torch.index_select #class_value 라는 label을 가지는 값들의 index 뽑기 target_indexes = torch.where(target_tensor == class_value)[0] #뽑은 index의 값을 가지는 새로운 tensor 정의 input_with_class_value = torch.index_select(input_tensor, 0, target_indexes) Code/Pytorch 2023.04.12
Git push Terminal 에서 git 처음 사용하는 경우 git config --global user.name "Github USERNAME" git config --global user.email "Github USEREMAIL" 올리고자 하는 디렉토리로 cd example git init : git 초기화, 맨 처음 프로젝트 올릴 때 git add . : 모든 파일을 올리겠다 git add example git status git commit -m “first commit” “” 안에 수정한 내용, description git remote add origin https://github.com/Ethan-Lee-Sunghoon/**example** git remote -v : 연결 내용 확인 git push o.. Code/Git SVN 2023.03.27
[Conda] python 위치 /data/sunghoon/anaconda3/envs/가상환경 이름/bin/python3 conda activate 가상환경 이름 Code/Linux Conda 2023.03.27
[Slurm] sbatch srun sbatch: 긴 job 돌릴 때, out file 로 확인 train.sh 파일을 다음과 같이 작성 #SBATCH --job-name=job 이름 #SBATCH --nodes=1 #SBATCH --gres=gpu:1 #SBATCH -p batch #SBATCH -w agi1 #SBATCH --cpus-per-gpu=4 #SBATCH --mem-per-gpu=20G #SBATCH --time=14-0 #SBATCH -o %N_%x_%j.out #SBTACH -e %N_%x_%j.err source /data/sunghoon/init.sh conda activate 가상환경이름 python -m torch.distributed.launch \ --nproc_per_node=1 \ --use_env main.. Code/Linux Conda 2023.03.27