make apex optional (#4906)

This commit is contained in:
Alexei Baevski 2022-12-13 00:50:53 -08:00 committed by GitHub
parent 902f4aa5e8
commit c19aed8ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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