From c19aed8ef59acafc8c146b50aed0ff3275ffcf01 Mon Sep 17 00:00:00 2001 From: Alexei Baevski Date: Tue, 13 Dec 2022 00:50:53 -0800 Subject: [PATCH] make apex optional (#4906) --- examples/data2vec/models/mae.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/data2vec/models/mae.py b/examples/data2vec/models/mae.py index 5101e070e..a3b5f72a4 100644 --- a/examples/data2vec/models/mae.py +++ b/examples/data2vec/models/mae.py @@ -21,7 +21,11 @@ from fairseq.dataclass import FairseqDataclass from fairseq.models import BaseFairseqModel, register_model from fairseq.models.wav2vec.wav2vec2 import TransformerSentenceEncoderLayer -from apex.normalization import FusedLayerNorm +try: + from apex.normalization import FusedLayerNorm +except: + FusedLayerNorm = nn.LayerNorm + import torch.nn.functional as F