get_precision_context#

composer.core.get_precision_context(precision, precision_config=None, fp8_autocast_enabled=True)[source]#

Returns a context manager to automatically cast to a specific precision.

Parameters
  • precision (str | Precision) โ€“ Precision for the context

  • precision_config (Optional[dict[str, Any]]) โ€“ Config for FP8 scaling strategy. See parameters for DelayedScaling.

  • fp8_autocast_enabled (bool) โ€“ Whether to enable FP8 autocast. Defaults to True.