Skip to content

Commit

Permalink
Prepare release v0.5.0 (#229)
Browse files Browse the repository at this point in the history
* fix default version

* move deps to runtime

* create an inference deps section

* fix deps

* fix tests
  • Loading branch information
Thomas Chaigneau authored Sep 1, 2023
1 parent 631e078 commit 7e08cc9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 deletions.
45 changes: 22 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,11 @@ classifiers = [
dependencies = [
"aiohttp>=3.8.4",
"aiofiles>=23.1.0",
"argon2-cffi>=21.3.0",
"ctranslate2>=3.18.0",
"fastapi>=0.96.0",
"faster-whisper @ git+https://github.com/Wordcab/faster-whisper@master",
"ffmpeg-python>=0.2.0",
"librosa>=0.9.0",
"loguru>=0.6.0",
"numpy==1.23.1",
"onnxruntime>=1.15.0",
"pydantic>=1.10.9",
"python-dotenv>=1.0.0",
"python-jose[cryptography]>=3.3.0",
"python-multipart>=0.0.6",
"shortuuid>=1.0.0",
"svix>=0.85.1",
"torch>=2.0.0",
"torchaudio>=2.0.1",
"yt-dlp>=2023.3.4",
"wget>=3.2.0",
]

[project.urls]
Expand All @@ -62,7 +48,26 @@ path = "src/wordcab_transcribe/__init__.py"
allow-direct-references = true

[project.optional-dependencies]
runtime = ["uvicorn>=0.21.1"]
inference = [
"ctranslate2>=3.18.0",
"faster-whisper @ git+https://github.com/Wordcab/faster-whisper@master",
"librosa>=0.9.0",
"numpy==1.23.1",
"onnxruntime>=1.15.0",
"torch>=2.0.0",
"torchaudio>=2.0.1",
"wget>=3.2.0",
]
runtime = [
"argon2-cffi>=21.3.0",
"fastapi>=0.96.0",
"python-jose[cryptography]>=3.3.0",
"python-multipart>=0.0.6",
"shortuuid>=1.0.0",
"svix>=0.85.1",
"uvicorn>=0.21.1",
"wordcab_transcribe[inference]",
]
quality = [
"black>=22.10.0",
"ruff>=0.0.263",
Expand All @@ -73,15 +78,9 @@ tests = [
"pytest>=7.4",
"pytest-asyncio>=0.21.1",
"pytest-cov>=4.1",
"wordcab_transcribe[inference]",
]
dev = [
"black>=22.10.0",
"httpx>=0.23.3",
"pre-commit>=2.20.0",
"pytest>=7.4",
"pytest-cov>=4.1",
"ruff>=0.0.263",
]
dev = ["wordcab_transcribe[quality,inference,runtime,tests]"]

[tool.hatch.envs.runtime]
features = [
Expand Down
6 changes: 4 additions & 2 deletions src/wordcab_transcribe/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from pydantic import field_validator
from pydantic.dataclasses import dataclass

from wordcab_transcribe import __version__


@dataclass
class Settings:
Expand Down Expand Up @@ -253,7 +255,7 @@ def __post_init__(self):
settings = Settings(
# General configuration
project_name=getenv("PROJECT_NAME", "Wordcab Transcribe"),
version=getenv("VERSION", "0.3.0"),
version=getenv("VERSION", __version__),
description=getenv(
"DESCRIPTION",
"💬 ASR FastAPI server using faster-whisper and Auto-Tuning Spectral Clustering"
Expand All @@ -264,7 +266,7 @@ def __post_init__(self):
# Models configuration
# Transcription
whisper_model=getenv("WHISPER_MODEL", "large-v2"),
compute_type=getenv("COMPUTE_TYPE", "int8_float16"),
compute_type=getenv("COMPUTE_TYPE", "float16"),
extra_languages=extra_languages,
extra_languages_model_paths={lang: "" for lang in extra_languages},
# Diarization
Expand Down
8 changes: 5 additions & 3 deletions src/wordcab_transcribe/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@
import subprocess # noqa: S404
import sys
from pathlib import Path
from typing import Awaitable, Dict, List, Optional, Tuple, Union
from typing import TYPE_CHECKING, Awaitable, Dict, List, Optional, Tuple, Union

import aiofiles
import aiohttp
import huggingface_hub
import torch
import torchaudio
from fastapi import UploadFile
from loguru import logger
from yt_dlp import YoutubeDL

if TYPE_CHECKING:
from fastapi import UploadFile


# pragma: no cover
async def async_run_subprocess(command: List[str]) -> tuple:
Expand Down Expand Up @@ -534,7 +536,7 @@ def retrieve_user_platform() -> str:
return sys.platform


async def save_file_locally(filename: str, file: UploadFile) -> bool:
async def save_file_locally(filename: str, file: "UploadFile") -> bool:
"""
Save a file locally from an UploadFile object.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def test_config() -> None:

assert settings.whisper_model == "large-v2"
assert settings.compute_type == "float16"
assert settings.extra_languages == [""]
assert settings.extra_languages_model_paths == {"": ""}
assert settings.extra_languages == []
assert settings.extra_languages_model_paths == {}

assert settings.window_lengths == [1.5, 1.25, 1.0, 0.75, 0.5]
assert settings.shift_lengths == [0.75, 0.625, 0.5, 0.375, 0.25]
Expand Down

0 comments on commit 7e08cc9

Please sign in to comment.