Make model autodownload if not found (safetensors only)

This commit is contained in:
kijai
2023-12-22 19:56:03 +02:00
parent 17f8db90a1
commit 7817260198
2 changed files with 9 additions and 3 deletions
+7 -2
View File
@@ -83,8 +83,13 @@ class MarigoldDepthEstimation:
break
if checkpoint_path is None:
raise FileNotFoundError("No checkpoint directory found.")
try:
from huggingface_hub import snapshot_download
checkpoint_path = os.path.join(script_directory, "../../models/diffusers/Marigold")
snapshot_download(repo_id="Bingxin/Marigold", ignore_patterns=["*.bin"], local_dir=checkpoint_path, local_dir_use_symlinks=False)
except:
raise FileNotFoundError("No checkpoint directory found.")
self.marigold_pipeline = MarigoldPipeline.from_pretrained(checkpoint_path, enable_xformers=False, empty_text_embed=empty_text_embed)
self.marigold_pipeline = self.marigold_pipeline.to(device).half() if use_fp16 else self.marigold_pipeline.to(device)
self.marigold_pipeline.unet.eval() # Set the model to evaluation mode
+2 -1
View File
@@ -3,4 +3,5 @@ diffusers>=0.20.1
matplotlib
scipy
torch>=2.0.1
transformers>=4.32.1
transformers>=4.32.1
huggingface-hub