Skip to content

Commit

Permalink
Add setting of env flag when apex is turned on
Browse files Browse the repository at this point in the history
  • Loading branch information
alugorey committed Sep 5, 2023
1 parent 8fc9b21 commit 9443e1a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apex/amp/frontend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import torch
import os
from ._initialize import _initialize
from ._amp_state import _amp_state, warn_or_err, maybe_print
from collections import OrderedDict
Expand Down Expand Up @@ -422,6 +423,11 @@ def initialize(
for k, v in _amp_state.opt_properties.options.items():
maybe_print("{:26} : {}".format(k, v), True)


# Set flag to tell others apex.amp is enabled
os.environ["APEX_AMP_ENABLED"] = "1"


return _initialize(models, optimizers, _amp_state.opt_properties, num_losses, cast_model_outputs)


Expand Down

0 comments on commit 9443e1a

Please sign in to comment.