Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- tril
- RNN
- ubuntu
- error
- 네이버 부스트캠프
- kernel density estimation
- pytorch
- triu
- Linux
- band_part
- forward
- tensorflow
- Chrome Remote Desktop
- Til
- kde
- 크롬 원격 데스크톱
- GRU
- nn.Sequential
- LSTM
- ai tech
Archives
- Today
- Total
무슨 생각을 해 그냥 하는거지
[학습정리] 2021-08-19 본문
※ 정보전달이 목적인 포스트가 아니라 개인 학습 기록 및 정리가 목적인 포스트입니다 ※
해당 포스트는 네이버 커넥트 재단의 부스트캠프 마스터님이신 최성철 교수님의 강의를 바탕으로 작성되었습니다.
1. 강의 복습 내용
[PyTorch 모델 불러오기]
torch.save( )
→ 모델 파라미터 or 모델 파라미터+모델 구조 저장
### 모델 파라미터를 저장 ###
torch.save(model.state_dict(),
'./your_model_path/model.pt') # state_dict: model parameter 표시
### 모델 파라미터와 모델(architecture)을 함께 저장 ###
torch.save(model, './your_model_path/model.pt')
torch.load( )
### 같은 모델 architecture에 파라미터만 불러오기 ###
new_model = TheModelClass()
new_model.load_state_dict(torch.load('./your_model_path/model.pt'))
### 모델 architecture + 파라미터 같이 불러오기 ###
model = torch.load('./your_model_path/model.pt')
checkpoints
- 학습 결과를 중간에 저장하는 것
- earlystopping 또는 resume에 사용할 수 있음
- epoch, loss, metric을 주로 함께 저장함
### checkpoint 저장 ###
torch.save({
'epoch': epoch,
'model_state_dict: model.state_dict(),
'optimizer_state_dict': optimizer.state_dict(),
'loss': epoch_loss,
},
'./your_checkpoint_folder/checkpoint_{}_{}.pt'.format(model_name,epoch_loss/len(dataloader)))
### checkpoint 불러오기 ###
checkpoint = torch.load(checkpoint_path)
model.load_state_dict(checkpoint['model_state_dict'])
optimizer.load_state_dict(checkpoint['optimizer_state_dict'])
epoch = checkpoint['epoch']
loss = checkpoint['loss']
[Monitoring tools for PyTorch]
Tensorboard
학습 그래프, metric, 학습 결과를 시각화 할 수 있는 도구
TensorFlow 프로젝트로 만들어졌지만 PyTorch도 연결 가능함
Weight & Biases
Developer tools for Machine Learning
다음주 P Stage에서 사용해봐야지....!!
2. 과제 수행 과정 / 결과물 정리
[필수과제 Custom Model 제작]
hook, apply가 이해가 잘 안되고 어렵다..
register_backward_hook은 grad_input[0]이 W.grad인 것 같고 (두 번째는 bias인가?)
register_full_backward_hook은 grad_input이 x1.grad와 x2.grad 이다.
partial function을 잘 쓰면 좋을 것 같다.
[필수과제 Custom Dataset 및 Custom DataLoader 생성]
DataLoader collate_fn 관련 참고
3. 피어세션 정리
- 다른 캠퍼님의 오늘자 강의 요약 발표 (감사합니다!)
- hook에 대해 질문하고 답변을 받았다.
- 멘토링 때 Attention is All You Need를 꼭 읽어보라는 조언을 들어서, 팀원분들과 다같이 Transformer 논문을 읽어보기로 했다.
- 멘토님께서 추천해주신 Transformer 관련 유튜브 강의
4. 학습 회고
- 바쁘다바빠 현대사회..... 과제 때문에 시간을 많이 뺏겼다. (자괴감 장난 아니다)
- 생소한 함수를 접했을 때 활용을 잘 못하는 나를 보면서 그동안 베끼기식 코딩(
과연 그걸 코딩이라 할 수 있을까)을 했다는 걸 다시 한번 더 깨닫는다.
'Naver AI Tech 2기 > Today I Learned' 카테고리의 다른 글
[학습정리] 2021-08-23 (0) | 2021.08.24 |
---|---|
[학습정리] 2021-08-20 (0) | 2021.08.20 |
[학습정리] 2021-08-18 (0) | 2021.08.20 |
[학습정리] 2021-08-17 (0) | 2021.08.17 |
[학습정리] 2021-08-13 (0) | 2021.08.13 |