()
| 239 | |
| 240 | |
| 241 | def main(): |
| 242 | parser = argparse.ArgumentParser( |
| 243 | description="Extract MOSS-TTS-Delay weights for llama.cpp backend" |
| 244 | ) |
| 245 | parser.add_argument( |
| 246 | "--model", type=str, default="OpenMOSS-Team/MOSS-TTS", |
| 247 | help="HuggingFace model ID or local path", |
| 248 | ) |
| 249 | parser.add_argument( |
| 250 | "--output", type=str, default="weights/extracted", |
| 251 | help="Output directory for extracted weights", |
| 252 | ) |
| 253 | parser.add_argument( |
| 254 | "--cache-dir", type=str, default=None, |
| 255 | help="HuggingFace cache directory for model download", |
| 256 | ) |
| 257 | args = parser.parse_args() |
| 258 | |
| 259 | model_path = Path(args.model) |
| 260 | if model_path.is_dir() and (model_path / "config.json").exists(): |
| 261 | model_dir = model_path |
| 262 | log.info("Using local model directory: %s", model_dir) |
| 263 | else: |
| 264 | log.info("Downloading model from HuggingFace: %s", args.model) |
| 265 | model_dir = Path(snapshot_download( |
| 266 | args.model, |
| 267 | cache_dir=args.cache_dir, |
| 268 | ignore_patterns=["*.md", "*.py", "*.jinja", "__pycache__"], |
| 269 | )) |
| 270 | log.info("Model downloaded to: %s", model_dir) |
| 271 | |
| 272 | extract(model_dir, Path(args.output)) |
| 273 | |
| 274 | |
| 275 | if __name__ == "__main__": |
no test coverage detected