Skip to content

Commit

Permalink
Fixed custom module importing on Windows (huggingface#5891)
Browse files Browse the repository at this point in the history
* Fixed custom module importing on Windows

Windows use back slash and `os.path.join()` follows that convention.

* Apply suggestions from code review

Co-authored-by: Lucain <[email protected]>

* Update pipeline_utils.py

---------

Co-authored-by: Sayak Paul <[email protected]>
Co-authored-by: Lucain <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2023
1 parent 01782c2 commit d1b2a1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/diffusers/pipelines/pipeline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,8 @@ def download(cls, pretrained_model_name, **kwargs) -> Union[str, os.PathLike]:
if module_candidate is None or not isinstance(module_candidate, str):
continue

candidate_file = os.path.join(component, module_candidate + ".py")
# We compute candidate file path on the Hub. Do not use `os.path.join`.
candidate_file = f"{component}/{module_candidate}.py"

if candidate_file in filenames:
custom_components[component] = module_candidate
Expand Down

0 comments on commit d1b2a1a

Please sign in to comment.