Update custom model files, README, and requirements
Browse files- asr_pipeline.py +4 -0
asr_pipeline.py
CHANGED
|
@@ -60,6 +60,10 @@ class ASRPipeline(transformers.AutomaticSpeechRecognitionPipeline):
|
|
| 60 |
return {"tokens": generated_ids, "is_last": is_last}
|
| 61 |
|
| 62 |
def postprocess(self, model_outputs, **kwargs) -> dict[str, str]:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
tokens = model_outputs.get("tokens")
|
| 64 |
if tokens is None:
|
| 65 |
return super().postprocess(model_outputs, **kwargs)
|
|
|
|
| 60 |
return {"tokens": generated_ids, "is_last": is_last}
|
| 61 |
|
| 62 |
def postprocess(self, model_outputs, **kwargs) -> dict[str, str]:
|
| 63 |
+
# Handle list of outputs (from chunking)
|
| 64 |
+
if isinstance(model_outputs, list):
|
| 65 |
+
model_outputs = model_outputs[0] if model_outputs else {}
|
| 66 |
+
|
| 67 |
tokens = model_outputs.get("tokens")
|
| 68 |
if tokens is None:
|
| 69 |
return super().postprocess(model_outputs, **kwargs)
|