Skip to content

Commit 6c8a1de

Browse files
authored
Merge pull request #93 from intel/model_download_bug_fix
bug fix for sd-1.5 square model download
2 parents 97ba876 + 2425341 commit 6c8a1de

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

model_setup.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,11 @@ def download_quantized_models(repo_id, model_fp16, model_int8):
7474
#print("download_folder", download_folder)
7575

7676
FP16_model = os.path.join(download_folder, "FP16")
77-
shutil.copytree(download_folder, SD_path_FP16, ignore=shutil.ignore_patterns('FP16', 'INT8'))
77+
shutil.copytree(download_folder, SD_path_FP16, ignore=shutil.ignore_patterns('FP16', 'INT8'))
78+
shutil.copytree(FP16_model, SD_path_FP16, dirs_exist_ok=True)
79+
7880

7981

80-
files = glob(os.path.join(FP16_model, '**'), recursive=True)
81-
82-
for f in files:
83-
if os.path.isfile(f):
84-
base = os.path.basename(f)
85-
shutil.copy(f, os.path.join(SD_path_FP16, base))
8682

8783
if model_int8:
8884
SD_path_INT8 = os.path.join(install_location, model_int8)
@@ -91,15 +87,8 @@ def download_quantized_models(repo_id, model_fp16, model_int8):
9187
shutil.rmtree(SD_path_INT8)
9288

9389
INT8_model = os.path.join(download_folder, "INT8")
94-
shutil.copytree(download_folder, SD_path_INT8, ignore=shutil.ignore_patterns('FP16', 'INT8'))
95-
#shutil.copy(INT8_model, SD_path_INT8)
96-
97-
files = glob(os.path.join(INT8_model, '**'), recursive=True)
98-
99-
for f in files:
100-
if os.path.isfile(f):
101-
base = os.path.basename(f)
102-
shutil.copy(f, os.path.join(SD_path_INT8, base))
90+
shutil.copytree(download_folder, SD_path_INT8, ignore=shutil.ignore_patterns('FP16', 'INT8'))
91+
shutil.copytree(INT8_model, SD_path_INT8, dirs_exist_ok=True)
10392

10493

10594
delete_folder=os.path.join(download_folder, "..", "..", "..")

0 commit comments

Comments
 (0)