@@ -148,7 +148,7 @@ def _load(self):
148148 tokenizer = self .load_tokenizer (
149149 tokenizer_class , self ._model_name_or_path , ** tokenizer_kwargs
150150 )
151- except :
151+ except Exception :
152152 tokenizer = None
153153 print ("Escape tokenizer, which does not exist." )
154154
@@ -1081,7 +1081,6 @@ def set_common_layers(self, spec, module):
10811081 self .set_layer_norm (spec .layer_norm , module .layer_norm )
10821082
10831083
1084-
10851084@register_loader ("WavLMConfig" )
10861085class WavLMLoader (BartLoader ):
10871086 @property
@@ -1119,7 +1118,7 @@ def set_vocabulary(self, spec, tokens):
11191118
11201119 def set_feature_extractor (self , spec , feature_extractor ):
11211120 spec .feat_layer0 .conv .weight = feature_extractor .conv_layers [0 ].conv .weight
1122- # spec.feat_layer0.conv.bias = feature_extractor.conv_layers[0].conv.bias // wavlm has no bias
1121+ # wavlm has no bias in conv
11231122 self .set_layer_norm (
11241123 spec .feat_layer0 .layer_norm , feature_extractor .conv_layers [0 ].layer_norm
11251124 )
@@ -1161,7 +1160,7 @@ def set_wavlm_encoder_layer(self, spec, encoder):
11611160 layer_spec .self_attention ,
11621161 layer .self_attn ,
11631162 self_attention = True ,
1164- has_rel_attn_embed = (layer_index == 0 ),
1163+ has_rel_attn_embed = (layer_index == 0 ),
11651164 )
11661165 self .set_layer_norm (
11671166 layer_spec .self_attention .layer_norm ,
@@ -1187,7 +1186,8 @@ def set_attention(self, spec, attention, self_attention=False, has_rel_attn_embe
11871186 self .set_linear (spec .linear [- 1 ], attention .out_proj )
11881187
11891188 self .set_linear (spec .gru_relative_position_linear , attention .gru_rel_pos_linear )
1190- spec .gru_relative_position_const = attention .gru_rel_pos_const .data # is torch.nn.parameter.Parameter
1189+ # which is torch.nn.parameter.Parameter
1190+ spec .gru_relative_position_const = attention .gru_rel_pos_const .data
11911191
11921192 if has_rel_attn_embed :
11931193 spec .relative_attention_bias = attention .rel_attn_embed .weight
0 commit comments