@@ -64,10 +64,10 @@ def predict(self, identifiers, input_data):
64
64
outputs , raw_outputs = outputs
65
65
else :
66
66
raw_outputs = outputs
67
- encoder_output = np . array ( outputs [self .encoder_out ]). squeeze ()
67
+ encoder_output = outputs [self .encoder_out ]
68
68
self .h0 = outputs [self .h0_out ]
69
69
self .c0 = outputs [self .c0_out ]
70
- return encoder_output , raw_outputs
70
+ return encoder_output . squeeze () , raw_outputs
71
71
72
72
def fit_to_input (self , input_data ):
73
73
return {self .input : input_data , self .h0_input : self .h0 , self .c0_input : self .c0 }
@@ -127,7 +127,7 @@ def predict(self, identifiers, input_data, hidden=None):
127
127
raw_outputs = outputs
128
128
self .h0 = outputs [self .h0_out ]
129
129
self .c0 = outputs [self .c0_out ]
130
- return np . array ( outputs [self .decoder_out ]) .squeeze (), (self .h0 , self .c0 ), raw_outputs
130
+ return outputs [self .decoder_out ].squeeze (), (self .h0 , self .c0 ), raw_outputs
131
131
132
132
def fit_to_input (self , token_id , hidden ):
133
133
if hidden is None :
@@ -189,7 +189,7 @@ def predict(self, identifiers, input_data):
189
189
else :
190
190
raw_outputs = outputs
191
191
joint_out = outputs [self .output ]
192
- return log_softmax (np . array ( joint_out ). squeeze () ), raw_outputs
192
+ return log_softmax (joint_out ), raw_outputs
193
193
194
194
def fit_to_input (self , encoder_out , predictor_out ):
195
195
return {self .input1 : encoder_out , self .input2 : predictor_out }
@@ -339,7 +339,7 @@ def __init__(self, network_info, launcher, suffix=None, delayed_model_loading=Fa
339
339
class OVJoint (Joint , CommonOpenVINOModel ):
340
340
def __init__ (self , network_info , launcher , suffix = None , delayed_model_loading = False ):
341
341
self .default_inputs = ['0' , '1' ]
342
- self .default_outputs = ['8/sink_port ' ]
342
+ self .default_outputs = ['8/sink_port_0 ' ]
343
343
super ().__init__ (network_info , launcher , suffix , delayed_model_loading )
344
344
345
345
@@ -353,25 +353,22 @@ def infer(self, input_data):
353
353
results = self .inference_session .run (self .output_names , input_data )
354
354
return dict (zip (self .output_names , results ))
355
355
356
- def select_inputs_outputs (self , network_info ):
357
- pass
358
-
359
356
360
- class ONNXEncoder (CommonONNXModel , Encoder ):
357
+ class ONNXEncoder (Encoder , CommonONNXModel ):
361
358
def __init__ (self , network_info , launcher , suffix = None , delayed_model_loading = False ):
362
359
self .default_inputs = ['input_0' , 'input_1' , 'input_2' ]
363
360
self .default_outputs = ['output_0' , 'output_1' , 'output_2' ]
364
361
super ().__init__ (network_info , launcher , suffix , delayed_model_loading )
365
362
366
363
367
- class ONNXDecoder (CommonONNXModel , Decoder ):
364
+ class ONNXDecoder (Decoder , CommonONNXModel ):
368
365
def __init__ (self , network_info , launcher , suffix = None , delayed_model_loading = False ):
369
366
self .default_inputs = ['input_0' , 'input_1' , 'input_2' ]
370
367
self .default_outputs = ['output_0' , 'output_1' , 'output_2' ]
371
368
super ().__init__ (network_info , launcher , suffix , delayed_model_loading )
372
369
373
370
374
- class ONNXJoint (CommonONNXModel , Joint ):
371
+ class ONNXJoint (Joint , CommonONNXModel ):
375
372
def __init__ (self , network_info , launcher , suffix = None , delayed_model_loading = False ):
376
373
self .default_inputs = ['0' , '1' ]
377
374
self .default_outputs = ['8' ]
@@ -454,7 +451,7 @@ def predict(self, identifiers, input_data, encoder_callback=None):
454
451
if len (B ) >= self .beam_width and yb .log_prob >= y_hat .log_prob :
455
452
break
456
453
B = heapq .nlargest (self .beam_width , B )
457
- return self .adapter .process ([B [0 ].sequence ], identifiers , [{}]), {}
454
+ return [{}], self .adapter .process ([B [0 ].sequence ], identifiers , [{}])
458
455
459
456
@staticmethod
460
457
def prepare_records (features ):
0 commit comments