Skip to content

Commit

Permalink
try that?
Browse files Browse the repository at this point in the history
  • Loading branch information
philwinder committed Nov 23, 2024
1 parent 7b96c9f commit d82073f
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions runner/helix-diffusers/pull.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse
import os

from diffusers import FluxPipeline, StableDiffusionPipeline
from huggingface_hub import snapshot_download


def download_model(model_name: str, save_path: str, pipeline_type: str = "sd"):
Expand All @@ -13,20 +13,16 @@ def download_model(model_name: str, save_path: str, pipeline_type: str = "sd"):
save_path (str): Local directory path to save the model
pipeline_type (str): Type of pipeline to use ('sd' for StableDiffusion or 'flux' for Flux)
"""
print(f"Downloading model: {model_name} using {pipeline_type} pipeline")
print(f"Downloading model: {model_name}")

os.makedirs(save_path, exist_ok=True)

# Select appropriate pipeline based on type
pipeline_class = FluxPipeline if pipeline_type == "flux" else StableDiffusionPipeline

pipeline_class.from_pretrained(
model_name,
# Download all model files directly without pipeline initialization
snapshot_download(
repo_id=model_name,
cache_dir=save_path,
safety_checker=None,
feature_extractor=None,
requires_safety_checker=False,
low_cpu_mem_usage=True,
local_dir=save_path,
ignore_patterns=["*.md", "*.txt"],
)

print(f"Model successfully downloaded to: {save_path}")
Expand Down

0 comments on commit d82073f

Please sign in to comment.