Download scripts/convert.py from jbilcke/timestral-coreai: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/jbilcke/timestral-coreai/resolve/main/scripts/convert.py
- Command line
-
hf download hf://jbilcke/timestral-coreai/scripts/convert.py
-
curl -L -o convert.py https://huggingface.co/jbilcke/timestral-coreai/resolve/main/scripts/convert.py
1.25 kB
| """Convert local Timestral MLX FP32 checkpoints to self-contained CoreAI bundles.""" | |
| import argparse | |
| import gc | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| sys.path.insert(0, str(ROOT)) | |
| VARIANTS = ("5M", "28M", "123M", "209M") | |
| def parse_args(argv=None): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("variants", nargs="*", metavar="VARIANT", | |
| help="5M, 28M, 123M, or 209M (default: all four)") | |
| parser.add_argument("--source", type=Path, default=ROOT.parent / "timestral-mlx") | |
| parser.add_argument("--output", type=Path, default=ROOT) | |
| parser.add_argument("--overwrite", action="store_true") | |
| args = parser.parse_args(argv) | |
| args.variants = args.variants or list(VARIANTS) | |
| if any(variant not in VARIANTS for variant in args.variants): | |
| parser.error(f"variants must be selected from {', '.join(VARIANTS)}") | |
| return args | |
| def main(): | |
| args = parse_args() | |
| from timestral_coreai.export import convert | |
| import torch | |
| torch.set_num_threads(1) | |
| for variant in args.variants: | |
| convert(variant, args.source, args.output, overwrite=args.overwrite) | |
| gc.collect() | |
| if __name__ == "__main__": | |
| main() | |