pull/2212/head
Hui Zhang 2 years ago
parent d638325c46
commit a7c6c54e75

@ -80,9 +80,6 @@ class PaddleASRConnectionHanddler:
self.init_decoder()
self.reset()
from paddle.jit.layer import Layer
self.jit_layer = Layer()
self.jit_layer.load('/workspace/conformer/PaddleSpeech-conformer/conformer/conformer', paddle.CUDAPlace(1))
def init_decoder(self):
if "deepspeech2" in self.model_type:
@ -478,15 +475,9 @@ class PaddleASRConnectionHanddler:
# cur chunk
chunk_xs = self.cached_feat[:, cur:end, :]
# forward chunk
# (y, self.att_cache, self.cnn_cache) = self.model.encoder.forward_chunk(
# chunk_xs, self.offset, required_cache_size,
# self.att_cache, self.cnn_cache)
(y, self.att_cache, self.cnn_cache) = self.jit_layer.forward_encoder_chunk(
chunk_xs,
paddle.to_tensor([self.offset], dtype='int32'),
self.att_cache,
self.cnn_cache)
(y, self.att_cache, self.cnn_cache) = self.model.encoder.forward_chunk(
chunk_xs, self.offset, required_cache_size,
self.att_cache, self.cnn_cache)
outputs.append(y)

Loading…
Cancel
Save