File tree Expand file tree Collapse file tree 1 file changed +19
-41
lines changed Expand file tree Collapse file tree 1 file changed +19
-41
lines changed Original file line number Diff line number Diff line change 7
7
from mmf .utils .patch import restore_saved_modules , safecopy_modules
8
8
from torch import nn , Tensor
9
9
10
- try :
11
- from transformers3 .modeling_bert import (
12
- BertAttention ,
13
- BertEmbeddings ,
14
- BertEncoder ,
15
- BertLayer ,
16
- BertModel ,
17
- BertPooler ,
18
- BertSelfAttention ,
19
- BertSelfOutput ,
20
- )
21
- from transformers3 .modeling_roberta import (
22
- RobertaAttention ,
23
- RobertaEmbeddings ,
24
- RobertaEncoder ,
25
- RobertaLayer ,
26
- RobertaModel ,
27
- RobertaSelfAttention ,
28
- )
29
- from transformers3 .modeling_utils import PreTrainedModel
30
- except ImportError :
31
- from transformers .modeling_bert import (
32
- BertAttention ,
33
- BertEmbeddings ,
34
- BertEncoder ,
35
- BertLayer ,
36
- BertModel ,
37
- BertPooler ,
38
- BertSelfAttention ,
39
- BertSelfOutput ,
40
- )
41
- from transformers .modeling_roberta import (
42
- RobertaAttention ,
43
- RobertaEmbeddings ,
44
- RobertaEncoder ,
45
- RobertaLayer ,
46
- RobertaModel ,
47
- RobertaSelfAttention ,
48
- )
49
- from transformers .modeling_utils import PreTrainedModel
50
-
10
+ from transformers .modeling_utils import PreTrainedModel
11
+ from transformers .models .bert .modeling_bert import (
12
+ BertAttention ,
13
+ BertEmbeddings ,
14
+ BertEncoder ,
15
+ BertLayer ,
16
+ BertModel ,
17
+ BertPooler ,
18
+ BertSelfAttention ,
19
+ BertSelfOutput ,
20
+ )
21
+ from transformers .models .roberta .modeling_roberta import (
22
+ RobertaAttention ,
23
+ RobertaEmbeddings ,
24
+ RobertaEncoder ,
25
+ RobertaLayer ,
26
+ RobertaModel ,
27
+ RobertaSelfAttention ,
28
+ )
51
29
52
30
patch_functions = [
53
31
"BertEmbeddings.forward" ,
You can’t perform that action at this time.
0 commit comments