Gradient clipping
- 개념적으로는 gradient clipping은 알고 있었다.
- 하지만 직접적으로 코드를 짜보면서 어케 쓰는지 찾아보았다.
- https://dhhwang89.tistory.com/90
- https://kh-kim.gitbook.io/natural-language-processing-with-pytorch/00-cover-6/05-gradient-clipping
- torch_utils.clip_grad_norm_(model.parameters(), max_grad_norm)
- 꼭 grad norm이 아니라 찾아보면 grad value로 할 수도 있다.
- RNN 계열에선 gradient exploding 때문에 써주는게 좋다고 한다.
댓글
댓글 쓰기