Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedir Zadniprovskyi committed Nov 1, 2024
1 parent e59ebf5 commit 98ddafa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 1 addition & 7 deletions src/faster_whisper_server/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@
from typing import TYPE_CHECKING

from faster_whisper import WhisperModel
from piper.voice import PiperVoice

from faster_whisper_server.hf_utils import get_piper_voice_model_file

if TYPE_CHECKING:
from collections.abc import Callable

from piper.voice import PiperVoice

from faster_whisper_server.config import (
WhisperConfig,
)

logger = logging.getLogger(__name__)


# TODO: enable concurrent model downloads


Expand Down Expand Up @@ -149,8 +147,6 @@ def __init__(self, ttl: int) -> None:
self._lock = threading.Lock()

def _load_fn(self, model_id: str) -> PiperVoice:
from piper.voice import PiperVoice

model_path = get_piper_voice_model_file(model_id)
return PiperVoice.load(model_path)

Expand All @@ -167,8 +163,6 @@ def unload_model(self, model_name: str) -> None:
self.loaded_models[model_name].unload()

def load_model(self, model_name: str) -> SelfDisposingModel[PiperVoice]:
from piper.voice import PiperVoice

with self._lock:
if model_name in self.loaded_models:
logger.debug(f"{model_name} model already loaded")
Expand Down
2 changes: 2 additions & 0 deletions tests/speech_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
DEFAULT_INPUT = "Hello, world!"

platform_machine = platform.machine()
if platform_machine != "x86_64":
pytest.skip("Only supported on x86_64", allow_module_level=True)


@pytest.mark.asyncio
Expand Down

0 comments on commit 98ddafa

Please sign in to comment.