during migration do not overwrite symlinks

This commit is contained in:
Lincoln Stein 2023-03-05 08:40:03 -05:00
parent 114018e3e6
commit 81dee04dc9
2 changed files with 3 additions and 2 deletions

View File

@ -270,7 +270,6 @@ def _download_diffusion_weights(
path = download_from_hf(
model_class,
repo_id,
cache_subdir="diffusers",
safety_checker=None,
**extra_args,
)

View File

@ -955,7 +955,9 @@ class ModelManager(object):
continue
print(f"** {source} => {dest}")
if source.exists():
if dest.exists():
if dest.is_symlink():
print(f"** Found symlink at {dest.name}. Not migrating.")
elif dest.exists():
rmtree(source)
else:
move(source, dest)