mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
+11
-25
@@ -84,32 +84,18 @@ def download_diffusers_model(hub_id: str, cache_dir: str = None, download_config
|
||||
if token is not None and len(token) > 2:
|
||||
hf_login(token)
|
||||
pipeline_dir = None
|
||||
|
||||
ok = False
|
||||
err = None
|
||||
"""
|
||||
if not ok:
|
||||
try:
|
||||
pipeline_dir = DiffusionPipeline.download(hub_id, **download_config)
|
||||
ok = True
|
||||
except Exception as e:
|
||||
err = e
|
||||
ok = False
|
||||
debug(f'HF download error: id="{hub_id}" {e}')
|
||||
"""
|
||||
if not ok and 'Repository Not Found' not in str(err):
|
||||
try:
|
||||
download_config.pop('load_connected_pipeline', None)
|
||||
download_config.pop('variant', None)
|
||||
pipeline_dir = hf.snapshot_download(hub_id, **download_config)
|
||||
except Exception as e:
|
||||
debug(f'HF download error: id="{hub_id}" {e}')
|
||||
if 'gated' in str(e):
|
||||
shared.log.error(f'HF download error: id="{hub_id}" model access requires login')
|
||||
shared.state.end(jobid)
|
||||
return None
|
||||
try:
|
||||
download_config.pop('load_connected_pipeline', None)
|
||||
download_config.pop('variant', None)
|
||||
pipeline_dir = hf.snapshot_download(hub_id, **download_config)
|
||||
except Exception as e:
|
||||
debug(f'HF download error: id="{hub_id}" {e}')
|
||||
if 'gated' in str(e):
|
||||
shared.log.error(f'HF download error: id="{hub_id}" model access requires login')
|
||||
shared.state.end(jobid)
|
||||
return None
|
||||
if pipeline_dir is None:
|
||||
shared.log.error(f'HF download error: id="{hub_id}" {err}')
|
||||
shared.log.error(f'HF download error: id="{hub_id}" no data')
|
||||
shared.state.end(jobid)
|
||||
return None
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user