Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
0be52c07
Unverified
Commit
0be52c07
authored
Nov 09, 2024
by
SahilCarterr
Committed by
GitHub
Nov 08, 2024
Browse files
[fix] Replaced shutil.copy with shutil.copyfile (#9885)
fix shutil.copy
parent
1b392544
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/diffusers/utils/dynamic_modules_utils.py
src/diffusers/utils/dynamic_modules_utils.py
+3
-3
No files found.
src/diffusers/utils/dynamic_modules_utils.py
View file @
0be52c07
...
@@ -325,7 +325,7 @@ def get_cached_module_file(
...
@@ -325,7 +325,7 @@ def get_cached_module_file(
# We always copy local files (we could hash the file to see if there was a change, and give them the name of
# We always copy local files (we could hash the file to see if there was a change, and give them the name of
# that hash, to only copy when there is a modification but it seems overkill for now).
# that hash, to only copy when there is a modification but it seems overkill for now).
# The only reason we do the copy is to avoid putting too many folders in sys.path.
# The only reason we do the copy is to avoid putting too many folders in sys.path.
shutil
.
copy
(
resolved_module_file
,
submodule_path
/
module_file
)
shutil
.
copy
file
(
resolved_module_file
,
submodule_path
/
module_file
)
for
module_needed
in
modules_needed
:
for
module_needed
in
modules_needed
:
if
len
(
module_needed
.
split
(
"."
))
==
2
:
if
len
(
module_needed
.
split
(
"."
))
==
2
:
module_needed
=
"/"
.
join
(
module_needed
.
split
(
"."
))
module_needed
=
"/"
.
join
(
module_needed
.
split
(
"."
))
...
@@ -333,7 +333,7 @@ def get_cached_module_file(
...
@@ -333,7 +333,7 @@ def get_cached_module_file(
if
not
os
.
path
.
exists
(
submodule_path
/
module_folder
):
if
not
os
.
path
.
exists
(
submodule_path
/
module_folder
):
os
.
makedirs
(
submodule_path
/
module_folder
)
os
.
makedirs
(
submodule_path
/
module_folder
)
module_needed
=
f
"
{
module_needed
}
.py"
module_needed
=
f
"
{
module_needed
}
.py"
shutil
.
copy
(
os
.
path
.
join
(
pretrained_model_name_or_path
,
module_needed
),
submodule_path
/
module_needed
)
shutil
.
copy
file
(
os
.
path
.
join
(
pretrained_model_name_or_path
,
module_needed
),
submodule_path
/
module_needed
)
else
:
else
:
# Get the commit hash
# Get the commit hash
# TODO: we will get this info in the etag soon, so retrieve it from there and not here.
# TODO: we will get this info in the etag soon, so retrieve it from there and not here.
...
@@ -350,7 +350,7 @@ def get_cached_module_file(
...
@@ -350,7 +350,7 @@ def get_cached_module_file(
module_folder
=
module_file
.
split
(
"/"
)[
0
]
module_folder
=
module_file
.
split
(
"/"
)[
0
]
if
not
os
.
path
.
exists
(
submodule_path
/
module_folder
):
if
not
os
.
path
.
exists
(
submodule_path
/
module_folder
):
os
.
makedirs
(
submodule_path
/
module_folder
)
os
.
makedirs
(
submodule_path
/
module_folder
)
shutil
.
copy
(
resolved_module_file
,
submodule_path
/
module_file
)
shutil
.
copy
file
(
resolved_module_file
,
submodule_path
/
module_file
)
# Make sure we also have every file with relative
# Make sure we also have every file with relative
for
module_needed
in
modules_needed
:
for
module_needed
in
modules_needed
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment