Skip to content

Commit

Permalink
Changed faster-whisper dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
movchan74 committed May 22, 2024
1 parent f0c2856 commit 100ab34
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 63 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry install
chmod +x install.sh
./install.sh
sudo apt-get update
sudo apt-get install ffmpeg
- name: Test with pytest
Expand Down
7 changes: 5 additions & 2 deletions aana/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ def deploy(app_path: str, host: str, port: int, show_logs: bool, ray_address: st
@cli.command()
@click.argument("app_path", type=str)
@click.option(
"--host", default="0.0.0.0", type=str, help="Host address (default: 0.0.0.0)"
) # noqa: S104
"--host",
default="0.0.0.0", # noqa: S104
type=str,
help="Host address (default: 0.0.0.0)",
)
@click.option(
"--port", default=8000, type=int, help="Port to run the application (default: 8000)"
)
Expand Down
10 changes: 9 additions & 1 deletion aana/deployments/whisper_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any, cast

import torch
from faster_whisper import BatchedInferencePipeline, WhisperModel
from faster_whisper import WhisperModel
from faster_whisper.tokenizer import Tokenizer
from pydantic import BaseModel, Field
from ray import serve
Expand Down Expand Up @@ -296,6 +296,14 @@ async def transcribe_in_chunks(
Raises:
InferenceException: If the inference fails.
"""
try:
from faster_whisper import BatchedInferencePipeline
except ImportError as e:
raise ImportError( # noqa: TRY003
"Batched version of whisper is not available. "
"Install faster-whisper from https://github.com/mobiusml/faster-whisper"
) from e

if not params:
params = BatchedWhisperParams()

Expand Down
4 changes: 0 additions & 4 deletions aana/utils/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
from functools import wraps
from importlib import resources
from pathlib import Path
from typing import TYPE_CHECKING

import rapidfuzz

from aana.configs.settings import settings
from aana.utils.general import get_object_hash
from aana.utils.json import jsonify

if TYPE_CHECKING:
from aana.deployments.base_deployment import BaseDeployment


def test_cache(func): # noqa: C901
"""Decorator for caching and loading the results of a deployment function in testing mode.
Expand Down
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/sh
poetry install $1
poetry run pip install git+https://github.com/mobiusml/[email protected]_mobiusml_v1.1
68 changes: 14 additions & 54 deletions 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 @@ -30,7 +30,7 @@ decord = "^0.6.0"
deepdiff = "^6.7.0"
diffusers = "^0.23.1"
fastapi = "^0.104.0"
faster-whisper = { git = "https://github.com/mobiusml/faster-whisper.git", tag = "v1.0.1_mobiusml_v1.1" }
faster-whisper = ">=1.0.1"
hf-transfer = "^0.1.6"
onnxruntime = "1.16.1"
opencv-python = "^4.8.1.78"
Expand Down

0 comments on commit 100ab34

Please sign in to comment.