1f8ddd6d1c71fc2d08999e0e49193ffc269c86d7,python/baseline/pytorch/tagger/train.py,TaggerTrainerPyTorch,_train,#TaggerTrainerPyTorch#Any#,123
Before Change
self.optimizer.zero_grad()
loss = self.model.compute_loss(inputs)
loss.backward()
torch.nn.utils.clip_grad_norm_(self.model.parameters(), self.clip)
self.optimizer.step()
bsz = self._get_batchsz(batch_dict)
report_loss = loss.item() * bsz
epoch_loss += report_loss
After Change
loss = self.model.compute_loss(inputs)
loss.backward()
if (i+1) % self.grad_accum == 0 or (i+1) == steps:
torch.nn.utils.clip_grad_norm_(self.model.parameters(), self.clip)
self.optimizer.step()
self.optimizer.zero_grad()
bsz = self._get_batchsz(batch_dict)
report_loss = loss.item() * bsz
epoch_loss += report_loss
epoch_norm += bsz
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: dpressel/mead-baseline
Commit Name: 1f8ddd6d1c71fc2d08999e0e49193ffc269c86d7
Time: 2019-10-25
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/tagger/train.py
Class Name: TaggerTrainerPyTorch
Method Name: _train
Project Name: open-mmlab/mmcv
Commit Name: 9895a1af805452d091c74ef14275e62d2b6dd4b8
Time: 2020-04-02
Author: innerlee@users.noreply.github.com
File Name: mmcv/runner/hooks/optimizer.py
Class Name: OptimizerHook
Method Name: clip_grads
Project Name: deepinsight/insightface
Commit Name: d8738240cac8d92436f39a359ad3e21688e8917d
Time: 2021-03-10
Author: anxiangsir@outlook.com
File Name: recognition/arcface_torch/train.py
Class Name:
Method Name: main