본문 바로가기

전체 글

(38)
DeepMC_2 / Multi-Scale Deep Learning 목차 Introduction 저번 C)WPD에 이어서 다음 단계인 D)Multi-Scale Deep Learning 부분이다. DeepMC 논문에서 설명하고 있는 모델의 추론 방식은 C)WPD(Wavelet Packet Decomposition)을 5 levels로 분리해 기상 데이터를 다양한 scale관점에서 encoding하고 attention을 이용해 분리한 다양한 scale의 데이터중에 예측에 어떤 데이터를 사용할지 가중치를 이용해 결정한다. D)Multi-Scale Deep Learning은 전체 모델에서 Encoder 부분으로 CNN stack과 CNN-LSTM스택으로 구분된다. 각각을 코드로 구현해 동작이 잘 되는지 확인해본다. Material & Method CNN stack과 CNN-LS..
pytorch_lightning.utilities.exceptions.MisconfigurationException: to use manual_backward, please disable automatic optimization: set model property automatic_optimization as False 에러 해결 @property def automatic_optimization(self) -> bool: return False 목차 Problem 다른 에러를 해결하기 위해 manual_backward를 추가를 해서 발생한 에러이다. pytorch_lightning.utilities.exceptions.MisconfigurationException: to use manual_backward, please disable automatic optimization: set model property `automatic_optimization` as False Solution 에러에서 설명한대로 automatic_optimization을 False로 바꿔주면 해결되는 문제이다. LightningModule 클래스 안에 넣..
RuntimeError: Trying to backward through the graph a second time, but the saved intermediate results have already been freed. Specify retain_graph=True when calling .backward() or autograd.grad() the first time. 에러해결 목차 Problem Pytorch lightning으로 DeepMC 모델을 training하려고 시도하던중에 만난 에러이다. RuntimeError: Trying to backward through the graph a second time, but the saved intermediate results have already been freed. Specify retain_graph=True when calling .backward() or autograd.grad() the first time. optimizer를 호출하기 전에 backward를 2번 호출하면 발생하는 에러라고 말한다. https://github.com/PyTorchLightning/pytorch-lightning/discussion..
Python 그래프 부드럽게 그리기 (Python plot line smooth) Problem matplotlib.pyplot을 이용해 plot을 그리려고하는데 time scale이 달라서 모양이 이쁘지 않게 나오는 경우가 있다. 아래 plot에서 origin은 time step interval이 1이고, wavelet_n 은 time step interval이 2**n으로 나오게 된다. 즉 wavelet_5는 두 값간의 time step interval이 32로 나오게 되서 굉장히 딱딱한 모양이 나오게 되며, 경향성을 알기도 어렵다. Solution scipy의 make_interp_spline함수를 이용해 해결했다. 예시 코드는 다음과 같다. # example origin_y = [10,5,2,6,20,30] origin_x = [0,4,8,12,16,20] # time step..
DeepMC_1 / Wavelet Packet Decomposition (WPD) 목차 Introduction DeepMC(Kumar, Peeyush, et al. "Micro-climate Prediction-Multi Scale Encoder-decoder based Deep Learning Framework." Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining. 2021.) 논문의 모델을 구현을 시도했다. 전처리에 WPD(Wavelet Packet Decomposition)을 이용해 time siries data를 time scale별로 분해하여 multi-scale deeplearning을 하는 프로세스가 있다. 그림 1의 C부분에 해당하는 내용을 실제 데이터를 이용해서 WPD를 ..
nvidia-smi ; Failed to initialize NVML: Driver/library version mismatch 에러 해결 Problem jini1114@user1:~/git/data/mp4$ nvidia-smi Failed to initialize NVML: Driver/library version mismatch 어제까지만해도 잘 실행되던 nvidia-smi가 갑자기 아침부터 안되기 시작했다. 뭐가 원인인지는 모르겠지만 예전에 해결해본적이 있어서 간단하게 해결한 방법을 정리하겠다. Solution nvidia 관련 모듈을 전부 지워준 뒤, nvidia-smi를 실행하면 된다. 우선 nvidia 관련 모듈을 확인해준다. jini1114@user1:~/git/data/mp4$ lsmod | grep nvidia nvidia_uvm 995328 0 nvidia_drm 57344 3 drm_kms_helper 188416 1 n..
Multi-GPU Deep Learning_2 (using DDP, MaskRCNN) 목차 Introduction 이세돌 Image segmentation에 사용하던 MaskRCNN을 기존 pytorch에서 pytorch lightning으로 옮기는 동시에 DDP도 적용하여 Multi-GPU Deep Learning을 시도했다. Method & Material torchvision의 maskrcnn모델을 학습에 사용했다. 모델의 구조는 다음과 같다. 더보기 MaskRCNN( (transform): GeneralizedRCNNTransform( Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) Resize(min_size=(800,), max_size=1333, mode='bilinear') ) (backbone): Back..
RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment 해결 Problem Multi-GPU DDP Deep Learning 중에 loss를 copy하는 부분에서 문제가 발생했다.(고 생각된다..) 에러 전문은 다음과 같다. 더보기 Traceback (most recent call last): File "/home/ubuntu/jini1114/ddp_test/maskrcnn_trainer.py", line 54, in trainer.fit(ddpmaskrcnn, datamodule=dl) File "/home/ubuntu/anaconda3/envs/pytorch/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 460, in fit Traceback (most recent call la..