Skip to content

Commit

Permalink
chore: add a more descriptive assert error message (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedir Zadniprovskyi authored and fedirz committed Aug 27, 2024
1 parent ad4e94d commit ed6da33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion faster_whisper_server/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class Word(BaseModel):
def from_segments(cls, segments: Iterable[Segment]) -> list[Word]:
words: list[Word] = []
for segment in segments:
assert segment.words is not None
# NOTE: a temporary "fix" for https://github.com/fedirz/faster-whisper-server/issues/58.
# TODO: properly address the issue
assert (
segment.words is not None
), "Segment must have words. If you are using an API ensure `timestamp_granularities[]=word` is set"
words.extend(segment.words)
return words

Expand Down

0 comments on commit ed6da33

Please sign in to comment.