Create config.py
Browse files
config.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
|
| 3 |
+
from pydantic import BaseModel
|
| 4 |
+
from pydantic_settings import BaseSettings
|
| 5 |
+
from typing import Optional, Literal
|
| 6 |
+
|
| 7 |
+
logger = logging.getLogger(__name__)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class ModelSettings(BaseSettings):
|
| 11 |
+
asr_model: str
|
| 12 |
+
assistant_model: Optional[str]
|
| 13 |
+
diarization_model: Optional[str]
|
| 14 |
+
hf_token: Optional[str]
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class InferenceConfig(BaseModel):
|
| 18 |
+
task: Literal["transcribe", "translate"] = "transcribe"
|
| 19 |
+
batch_size: int = 24
|
| 20 |
+
assisted: bool = False
|
| 21 |
+
chunk_length_s: int = 30
|
| 22 |
+
sampling_rate: int = 16000
|
| 23 |
+
language: Optional[str] = None
|
| 24 |
+
num_speakers: Optional[int] = None
|
| 25 |
+
min_speakers: Optional[int] = None
|
| 26 |
+
max_speakers: Optional[int] = None
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
model_settings = ModelSettings()
|
| 30 |
+
|
| 31 |
+
logger.info(f"asr model: {model_settings.asr_model}")
|
| 32 |
+
logger.info(f"assist model: {model_settings.assistant_model}")
|
| 33 |
+
logger.info(f"diar model: {model_settings.diarization_model}")
|