Skip to content

Commit

Permalink
Update to 1.2.3, use max_grad_norm with fp16
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanNaren committed Mar 15, 2021
1 parent 00c166b commit 967d33c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion aitextgen/aitextgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,12 +657,16 @@ def train(
if is_gpu_used and use_deepspeed:
deepspeed_plugin = DeepSpeedPlugin()
logger.info("Using DeepSpeed training.")
if not fp16:
logger.info("Setting FP16 to True for DeepSpeed ZeRO Training.")
fp16 = True


train_params = dict(
accumulate_grad_batches=gradient_accumulation_steps,
gpus=n_gpu,
max_steps=num_steps,
gradient_clip_val=max_grad_norm if not fp16 else 0,
gradient_clip_val=max_grad_norm,
checkpoint_callback=False,
logger=loggers if loggers else False,
weights_summary=None,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
install_requires=[
"transformers>=4.3.0",
"fire>=0.3.0",
"pytorch-lightning>=1.2.0",
"pytorch-lightning>=1.2.3",
"torch>=1.6.0",
],
)

0 comments on commit 967d33c

Please sign in to comment.