File size: 667 Bytes
03505fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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