Download fish_speech/utils/file.py from TaiYa1/Test: direct link, hf CLI and curl.
- Browser
- Download file 361 Bytes
-
https://huggingface.co/spaces/TaiYa1/Test/resolve/main/fish_speech/utils/file.py
- Command line
-
hf download hf://spaces/TaiYa1/Test/fish_speech/utils/file.py
-
curl -L -o file.py https://huggingface.co/spaces/TaiYa1/Test/resolve/main/fish_speech/utils/file.py
361 Bytes
| import os | |
| from pathlib import Path | |
| def get_latest_checkpoint(path: Path | str) -> Path | None: | |
| # Find the latest checkpoint | |
| ckpt_dir = Path(path) | |
| if ckpt_dir.exists() is False: | |
| return None | |
| ckpts = sorted(ckpt_dir.glob("*.ckpt"), key=os.path.getmtime) | |
| if len(ckpts) == 0: | |
| return None | |
| return ckpts[-1] | |