CODE 24

Assertion Error 와 Value Error 차이

📝 Summary ✔ assert → Debugging tool, removed in optimized mode.✔ ValueError → Handles invalid values properly at runtime.  ▷ 정리하면, 개발도중에 가볍게 변수 확인, 조건 확인 등으로 Assertion을 많이 사용하고, ▷ 공식적으로  코드 내에서 잘못된 변수/인자 전달을 다루고자 할 때는 raise value 를 사용하는 것 같다.  🔹 When to Use Each?FeatureassertValueErrorPurposeDebugging, quick checksHandling incorrect valuesRaisesAssertionErrorValueErrorUsageChecks assumptionsVa..

CODE/ERROR 2025.02.17

리눅스 아나콘다 설치 / Installing anaconda in linux , nvcc 설치

평소 윈도우나 맥에서 아나콘다 사용하다 linux에서는 conda 를 쓰기 위함.(진짜 개발하다보면 이것저것 다 쓰게 되는구나... 맥, 윈도우, 리눅스, 도커, slurm, pbsnode, 등등... ) #버전은 최신 버전에 따라 달라질 수 있음. apt install wget$ wget https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh 최신 주소는 항상 공식 사이트 확인https://docs.anaconda.com/anaconda/install/ Installing Anaconda Distribution — Anaconda documentation docs.anaconda.com 또는 wget 명령어가 아니라 shell 스크..

CODE/Linux 2025.02.06

이미지 크기 resize 하는 방법(PIL 이용)

각각 다른 크기의 이미지를 200x200 크기로 모두 동일하게 맞추고 싶을 때... from PIL import Image import os def resize_images_in_folder(source_folder, target_folder, size=(200,200)): if not os.path.exists(target_folder): os.makedirs(target_folder) for filename in os.listdir(source_folder): img_path = os.path.join(source_folder, filename) img = Image.open(img_path) img_resized = img.resize(size, Image.ANTIALIAS) save_path = ..

CODE 2024.03.27

[WANDB ERROR] FileNotFoundError: [Errno 2] No such file or directory: '/tmp/~~~'

잘만 돌아가던 코드를 다른 환경에서 옮겼을 때 File "/home/user/.conda/envs/MML/lib/python3.8/site-packages/pytorch_lightning/loggers/wandb.py", line 399, in experiment self._experiment = wandb.init(**self._wandb_init) . . . fd = _os.open(file, flags, 0o600) FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmprtptbknd/port-44142.txtednylxis' 갑자기 요런 에러가 발생한다. 1. 파일이나 데이터 폴더의 경로는 이미 다 바꿔줬는데 갑자기 no such fi..

CODE/ERROR 2024.01.18
728x90