Spaces:
Running
on
Zero
Running
on
Zero
File size: 995 Bytes
507ffa3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import os
from huggingface_hub._snapshot_download import snapshot_download
HF_TOKEN = os.environ.get("HF_TOKEN", None)
SPACES_ZERO_GPU = os.environ.get("SPACES_ZERO_GPU", "").lower() == "true"
REPO = "Lykon/dreamshaper-8"
FILES = [
"feature_extractor/preprocessor_config.json",
"safety_checker/config.json",
"scheduler/scheduler_config.json",
"text_encoder/config.json",
"text_encoder/model.fp16.safetensors",
"tokenizer/merges.txt",
"tokenizer/special_tokens_map.json",
"tokenizer/tokenizer_config.json",
"tokenizer/vocab.json",
"unet/config.json",
"unet/diffusion_pytorch_model.fp16.safetensors",
"vae/config.json",
"vae/diffusion_pytorch_model.fp16.safetensors",
"model_index.json",
]
def download_repo_files():
global REPO, FILES
return snapshot_download(
repo_id=REPO,
repo_type="model",
revision="main",
token=HF_TOKEN,
allow_patterns=FILES,
ignore_patterns=None,
)
|