Skip to content

Commit

Permalink
Fix FP8 checkpoint resumption with onnx export flag (mosaicml#2907)
Browse files Browse the repository at this point in the history
  • Loading branch information
j316chuck authored and ShashankMosaicML committed Feb 3, 2024
1 parent 3076517 commit b27d67a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion composer/core/precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ def get_precision_context(precision: Union[str, Precision],
}
fp8_recipe = DelayedScaling(**precision_config)
with te.fp8_autocast(enabled=True, fp8_recipe=fp8_recipe):
yield
# The te.onnx_export flag ensures that we save all fp8 buffers
# as tensors instead of bytes. This is necessary for proper
# saving and resumption of checkpoints.
with te.onnx_export(enabled=True):
yield
else:
if te_installed:
raise RuntimeError('AMP_FP8 precision is used but current device does not support it.')
Expand Down

0 comments on commit b27d67a

Please sign in to comment.