Update custom model files, README, and requirements
Browse files- asr_modeling.py +8 -0
asr_modeling.py
CHANGED
|
@@ -781,6 +781,14 @@ class ASRModel(PreTrainedModel):
|
|
| 781 |
if chunk:
|
| 782 |
output_token_count += 1
|
| 783 |
yield StreamChunk(chunk)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 784 |
finally:
|
| 785 |
# Wait for generation to complete
|
| 786 |
thread.join()
|
|
|
|
| 781 |
if chunk:
|
| 782 |
output_token_count += 1
|
| 783 |
yield StreamChunk(chunk)
|
| 784 |
+
except Exception as e:
|
| 785 |
+
# Check if it's the Empty exception from queue
|
| 786 |
+
if e.__class__.__name__ == "Empty":
|
| 787 |
+
# This is expected when streaming completes quickly
|
| 788 |
+
pass
|
| 789 |
+
else:
|
| 790 |
+
# Re-raise other exceptions
|
| 791 |
+
raise
|
| 792 |
finally:
|
| 793 |
# Wait for generation to complete
|
| 794 |
thread.join()
|