Skip to content

Commit 5f40262

Browse files
authored
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
1 parent 8279539 commit 5f40262

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

paddlespeech/cli/ssl/infer.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def __init__(self):
119119
'--verbose',
120120
action='store_true',
121121
help='Increase logger verbosity of current task.')
122+
self.last_call_params = None
122123

123124
def _init_from_path(self,
124125
model_type: str=None,
@@ -453,6 +454,23 @@ def __call__(self,
453454
Python API to call an executor.
454455
"""
455456

457+
current_call_params = {
458+
"model": model,
459+
"task": task,
460+
"lang": lang,
461+
"sample_rate": sample_rate,
462+
"config": config,
463+
"ckpt_path": ckpt_path,
464+
"decode_method": decode_method,
465+
"force_yes": force_yes,
466+
"rtf": rtf,
467+
"device": device
468+
}
469+
if self.last_call_params is not None and self.last_call_params != current_call_params and hasattr(
470+
self, 'model'):
471+
del self.model
472+
self.last_call_params = current_call_params
473+
456474
audio_file = os.path.abspath(audio_file)
457475
paddle.set_device(device)
458476
self._init_from_path(model, task, lang, sample_rate, config,

0 commit comments

Comments
 (0)