Download Model Checkpoints
This script downloads model checkpoints from the Hugging Face Hub based on configurations specified in a YAML file.
Functionality
- Load Configuration: Reads a YAML configuration file to get model details.
- Download Model: Downloads files for specified models from the Hugging Face Hub to a local directory.
- Checks for a valid
local_dirin the configuration; skips download iflocal_diris null. - Creates the local directory if it doesn't exist.
- Supports
allowanddenypatterns to filter files:- If
allowpatterns are specified, only those files are downloaded. - If no
allowpatterns are provided, all files are downloaded except those matchingdenypatterns.
- If
- Uses
hf_hub_downloadfrom thehuggingface_hublibrary with symlinks disabled.
- Checks for a valid
Command-Line Arguments
--config_path: Path to the YAML configuration file (defaults toconfigs/model_ckpts.yaml).
Dependencies
argparse: For parsing command-line arguments.os: For directory creation.yaml: For reading the configuration file.huggingface_hub: For downloading files from the Hugging Face Hub.
Usage
Run the script with:
python scripts/download_ckpts.py --config_path <path_to_yaml>
The script processes each model in the configuration file, printing the model ID and local directory for each.