mirror of
https://github.com/Nighthawk42/llm-tts-factory.git
synced 2026-08-30 07:22:27 +00:00
Major framework modernization and quality-of-life improvements: - Centralized Configuration: Replaced scattered, hardcoded hyperparameters and paths across all training/inference scripts with a single, documented `config.yaml` and `config_loader.py`. - OS-Aware Audio Pipeline: Introduced `utils/audio_utils.py` to handle cross-platform audio loading. Automatically routes Windows to a robust `ffmpeg` subprocess to bypass unstable Python audio bindings, while keeping `torchaudio` for Linux. - Dependency Management: Migrated from `requirements.txt` to `uv` with a fully configured `pyproject.toml`. Explicitly targets Python 3.12 and pulls PyTorch `cu128` wheels by default. - Dataset Fixes: Restored the missing `dataset_e2e.py` required for proper STFT/GAN decoder training and updated all dataloaders to utilize the new AudioPipeline. - Documentation & Housekeeping: Overhauled `README.md` with updated workflows, Windows instructions, and `uv` setup. Added a comprehensive `.gitignore` for virtual environments, model weights, and cache files.
21 lines
783 B
Python
21 lines
783 B
Python
import yaml
|
|
import os
|
|
from pathlib import Path
|
|
|
|
def load_config(config_path="config.yaml"):
|
|
"""Loads the YAML config and resolves paths to absolute paths."""
|
|
if not os.path.exists(config_path):
|
|
raise FileNotFoundError(f"Configuration file not found at {config_path}")
|
|
|
|
with open(config_path, "r", encoding="utf-8") as f:
|
|
config = yaml.safe_load(f)
|
|
|
|
# Resolve paths relative to the current working directory
|
|
if "paths" in config:
|
|
for key, val in config["paths"].items():
|
|
if val is not None and isinstance(val, str):
|
|
# Expand ~ for Linux/Mac and resolve to absolute paths
|
|
resolved_path = Path(val).expanduser().resolve()
|
|
config["paths"][key] = str(resolved_path)
|
|
|
|
return config |