Spaces:
Running
Running
Download preload_models.py from JetBrains-Research/layer-lab: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/spaces/JetBrains-Research/layer-lab/resolve/main/preload_models.py
- Command line
-
hf download hf://spaces/JetBrains-Research/layer-lab/preload_models.py
-
curl -L -o preload_models.py https://huggingface.co/spaces/JetBrains-Research/layer-lab/resolve/main/preload_models.py
672 Bytes
| """Cache pinned inference files in the Space image before serving requests.""" | |
| from huggingface_hub import snapshot_download | |
| from runtime import MODELS | |
| if __name__ == "__main__": | |
| for model_id, spec in MODELS.items(): | |
| snapshot_download( | |
| repo_id=model_id, | |
| revision=spec["revision"], | |
| allow_patterns=[ | |
| "config.json", "generation_config.json", "model.safetensors", | |
| "tokenizer.json", "tokenizer_config.json", "tokenizer.model", | |
| "special_tokens_map.json", "added_tokens.json", "chat_template.jinja", | |
| "merges.txt", "vocab.json", "LICENSE", | |
| ], | |
| ) | |