layer-lab / preload_models.py
IgorSlinko's picture
Publish Qwen and Gemma layer and attention explorer
1022407 verified
Raw History Blame Contribute Delete
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",
],
)