Fix wav2vec error in Demos/ssl (#3872)

* Update infer.py

* Update wav2vec2_ASR.py

* Apply suggestions from code review

* Apply suggestions from code review

* Update infer.py

* Update wav2vec2_ASR.py

* Apply suggestions from code review
pull/3877/head
张春乔 10 months ago committed by GitHub
parent 8279539978
commit 5f40262a96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -119,6 +119,7 @@ class SSLExecutor(BaseExecutor):
'--verbose',
action='store_true',
help='Increase logger verbosity of current task.')
self.last_call_params = None
def _init_from_path(self,
model_type: str=None,
@ -453,6 +454,23 @@ class SSLExecutor(BaseExecutor):
Python API to call an executor.
"""
current_call_params = {
"model": model,
"task": task,
"lang": lang,
"sample_rate": sample_rate,
"config": config,
"ckpt_path": ckpt_path,
"decode_method": decode_method,
"force_yes": force_yes,
"rtf": rtf,
"device": device
}
if self.last_call_params is not None and self.last_call_params != current_call_params and hasattr(
self, 'model'):
del self.model
self.last_call_params = current_call_params
audio_file = os.path.abspath(audio_file)
paddle.set_device(device)
self._init_from_path(model, task, lang, sample_rate, config,

Loading…
Cancel
Save