Skip to content

Commit 7ba3130

Browse files
upload & fix
1 parent 2fa1d64 commit 7ba3130

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

src/diffusers/dynamic_modules_utils.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -209,21 +209,24 @@ def get_cached_module_file(
209209
module_file_or_url = os.path.join(pretrained_model_name_or_path, module_file)
210210
submodule = "local"
211211

212-
try:
213-
# Load from URL or cache if already cached
214-
resolved_module_file = cached_download(
215-
module_file_or_url,
216-
cache_dir=cache_dir,
217-
force_download=force_download,
218-
proxies=proxies,
219-
resume_download=resume_download,
220-
local_files_only=local_files_only,
221-
use_auth_token=use_auth_token,
222-
)
223-
224-
except EnvironmentError:
225-
logger.error(f"Could not locate the {module_file} inside {pretrained_model_name_or_path}.")
226-
raise
212+
if os.path.isfile(module_file_or_url):
213+
resolved_module_file = module_file_or_url
214+
else:
215+
try:
216+
# Load from URL or cache if already cached
217+
resolved_module_file = cached_download(
218+
module_file_or_url,
219+
cache_dir=cache_dir,
220+
force_download=force_download,
221+
proxies=proxies,
222+
resume_download=resume_download,
223+
local_files_only=local_files_only,
224+
use_auth_token=use_auth_token,
225+
)
226+
227+
except EnvironmentError:
228+
logger.error(f"Could not locate the {module_file} inside {pretrained_model_name_or_path}.")
229+
raise
227230

228231
# Check we have all the requirements in our environment
229232
modules_needed = check_imports(resolved_module_file)

0 commit comments

Comments
 (0)