Skip to content

Commit

Permalink
build: add numpy to server dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Jun 18, 2024
1 parent 61e4a5d commit 7e51866
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions capgen/transcriber/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Transcriber:
Methods
-------
transcribe(file: str | BinaryIO, caption_format: str) -> str | None:
converts transcription segments into a SRT file
converts transcription segments into a specific caption format
"""

__slots__ = ('model',)
Expand All @@ -47,7 +47,11 @@ def __init__(
'num_workers': number_of_workers,
}

self.model = WhisperModel(**model_parameters)
try:
self.model = WhisperModel(**model_parameters, flash_attention=True)

except ValueError:
self.model = WhisperModel(**model_parameters)

async def transcribe(self, file: str | BinaryIO, caption_format: str) -> str | None:
"""
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.12"
faster-whisper = "^1.0.2"
numpy = "<2.0.0"
nvidia-cudnn-cu12 = { version = "8.9.7.29", optional = true }
nvidia-cublas-cu12 = { version = "^12.5.2.13", optional = true }

Expand All @@ -49,6 +48,7 @@ gunicorn = "^22.0.0"
uvicorn = "^0.30.0"
httptools = "^0.6.1"
uvloop = "^0.19.0"
numpy = "<2.0.0"

[tool.poetry.group.dev.dependencies]
pyright = "^1.1.367"
Expand Down

0 comments on commit 7e51866

Please sign in to comment.