Download TTS_Code/final_model/load_model.py from Maisha0055/Menstrual_files: direct link, hf CLI and curl.
- Browser
- Download file 667 Bytes
-
https://huggingface.co/datasets/Maisha0055/Menstrual_files/resolve/main/TTS_Code/final_model/load_model.py
- Command line
-
hf download hf://datasets/Maisha0055/Menstrual_files/TTS_Code/final_model/load_model.py
-
curl -L -o load_model.py https://huggingface.co/datasets/Maisha0055/Menstrual_files/resolve/main/TTS_Code/final_model/load_model.py
667 Bytes
| import sys | |
| import json | |
| from pathlib import Path | |
| ROOT = Path(__file__).parent | |
| # Add local VoxCPM src directory to sys.path | |
| sys.path.insert(0, str(ROOT / "VoxCPM" / "src")) | |
| from voxcpm.core import VoxCPM | |
| from voxcpm.model.voxcpm import LoRAConfig | |
| def load_menstrual_bangla_tts(local_path: str): | |
| root = Path(local_path) | |
| with open(root / "lora" / "lora_config.json") as f: | |
| lora_info = json.load(f) | |
| lora_cfg = LoRAConfig(**lora_info["lora_config"]) | |
| model = VoxCPM.from_pretrained( | |
| hf_model_id=str(root), | |
| lora_config=lora_cfg, | |
| lora_weights_path=str(root / "lora"), | |
| load_denoiser=False, | |
| ) | |
| return model | |