File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -2898,9 +2898,10 @@ def pad(
2898
2898
)
2899
2899
2900
2900
required_input = encoded_inputs [self .model_input_names [0 ]]
2901
+ support_padding_side = "padding_side" in set (inspect .signature (self ._pad ).parameters .keys ())
2901
2902
if required_input and not isinstance (required_input [0 ], (list , tuple )):
2902
2903
# some tokenizers might not have the padding_side attribute
2903
- if "padding_side" in set ( inspect . signature ( self . _pad ). parameters . keys ()) :
2904
+ if support_padding_side :
2904
2905
encoded_inputs = self ._pad (
2905
2906
encoded_inputs ,
2906
2907
max_length = max_length ,
@@ -2937,7 +2938,7 @@ def pad(
2937
2938
batch_outputs = {}
2938
2939
for i in range (batch_size ):
2939
2940
inputs = dict ((k , v [i ]) for k , v in encoded_inputs .items ())
2940
- if "padding_side" in set ( inspect . signature ( self . _pad ). parameters . keys ()) :
2941
+ if support_padding_side :
2941
2942
outputs = self ._pad (
2942
2943
inputs ,
2943
2944
max_length = max_length ,
You can’t perform that action at this time.
0 commit comments