Config
config
¶
Defines helpers for environment and capability detection
The capability helpers let the Processor route per capability by checking
which optional dependencies are installed (via importlib.util.find_spec)
and which environment variables are configured, without importing the heavy
packages themselves
Settings
dataclass
¶
Resolved, environment-dependent server configuration
Attributes:
| Name | Type | Description |
|---|---|---|
logging_level |
str
|
Python logging level name |
modal_gpu |
str
|
GPU type requested for Modal jobs |
modal_image |
str
|
Docker image used for Modal containers |
srt_sys_msg |
str
|
System message for SRT-fixing |
breakdown_sys_msg |
str
|
System message for word-nuance breakdowns |
env_present(*keys)
¶
get_settings()
cached
¶
Resolves environment-dependent settings once, after loading .env
Reads the environment lazily (not at import) so that values reflect a
.env loaded at startup + variables that the launcher sets before the
process starts. Cached for the process lifetime
Returns:
| Type | Description |
|---|---|
Settings
|
The resolved |
get_system_info()
¶
gpu_available()
¶
Checks whether a CUDA GPU is available to the local transcription engine
(CTranslate2, which powers faster-whisper)
Return Values
This function returns a dictionary with the following keys
-
available (bool)→Trueifctranslate2is installed and reports at least one usable CUDA device,Falseotherwise -
name (str)→ the device name fromnvidia-smiwhen it can be queried,''otherwise
Returns:
| Type | Description |
|---|---|
dict[str, bool | str]
|
dict with keys "available" and "name" |
has_module(name)
¶
nvenc_available(ffmpeg_path)
¶
Checks whether the NVIDIA NVENC H.264 encoder is actually usable by the
given FFMPEG build on the current machine
Why A Real Probe
-
A CUDA device being present (
gpu_available) does not mean an encoder exists. The data center compute GPUs (A100,H100,Bx00) exposeNVDECfor decoding but have noNVENCencoder at all -
This runs a tiny synthetic encode and checks the exit code, so it reports the true capability of whatever GPU and
FFMPEGbuild are present instead of guessing from a hard-coded GPU list
Where To Call It
-
Run this in the same process that runs the conversion, since that is where
FFMPEGactually executes -
For the
localbackend that is the host, for themodalbackend that is the GPU container
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ffmpeg_path
|
str
|
Path to the system's FFMPEG executable |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
transcribe_backend()
¶
Resolves which transcription backend the server should use
Transcribe Backend
-
Reads
MIRUMOJI_TRANSCRIBE_BACKEND(auto|local|modal) -
autoor unset picksmodalwhen Modal tokens are configured, orlocalwhen faster-whisper is installed, otherwisenone -
Explicit
localormodaloverrides are validated and raise when that backend isn't available
Returns:
| Type | Description |
|---|---|
Literal['local', 'modal', 'none']
|
The resolved backend identifier |
Raises:
| Type | Description |
|---|---|
WhisperUnavailableError
|
If |
ModalError
|
If |
ValueError
|
If the variable holds an unrecognised value |