Skip to content

chore: add a more descriptive assert error message (#58) #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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