Skip to content

Commit

Permalink
[Bug] Fix bugs when grad clip == 0 (#262)
Browse files Browse the repository at this point in the history
fix bugs when grad clip == 0
  • Loading branch information
HIT-cwh committed Dec 11, 2023
1 parent 1091e39 commit 3300b1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xtuner/tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def main():

ds_grad_clip = ds_cfg.get('gradient_clipping', 'auto')
clip_grad = cfg.optim_wrapper.get('clip_grad', None)
if clip_grad and clip_grad.get('max_norm'):
if clip_grad and clip_grad.get('max_norm', None) is not None:
mm_max_norm = cfg.optim_wrapper.clip_grad.max_norm
else:
mm_max_norm = 1.0
Expand Down

0 comments on commit 3300b1b

Please sign in to comment.