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
53f498d2
Unverified
Commit
53f498d2
authored
Jan 16, 2024
by
Charchit Sharma
Committed by
GitHub
Jan 16, 2024
Browse files
Use of Posix to better support Windows compatibility in testing_utils (#6587)
* changes in utils * removed loc
parent
99086091
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
src/diffusers/utils/testing_utils.py
src/diffusers/utils/testing_utils.py
+4
-5
No files found.
src/diffusers/utils/testing_utils.py
View file @
53f498d2
...
@@ -137,7 +137,7 @@ def get_tests_dir(append_path=None):
...
@@ -137,7 +137,7 @@ def get_tests_dir(append_path=None):
tests_dir
=
os
.
path
.
dirname
(
tests_dir
)
tests_dir
=
os
.
path
.
dirname
(
tests_dir
)
if
append_path
:
if
append_path
:
return
os
.
path
.
join
(
tests_dir
,
append_path
)
return
Path
(
tests_dir
,
append_path
)
.
as_posix
()
else
:
else
:
return
tests_dir
return
tests_dir
...
@@ -335,10 +335,9 @@ def require_python39_or_higher(test_case):
...
@@ -335,10 +335,9 @@ def require_python39_or_higher(test_case):
def
load_numpy
(
arry
:
Union
[
str
,
np
.
ndarray
],
local_path
:
Optional
[
str
]
=
None
)
->
np
.
ndarray
:
def
load_numpy
(
arry
:
Union
[
str
,
np
.
ndarray
],
local_path
:
Optional
[
str
]
=
None
)
->
np
.
ndarray
:
if
isinstance
(
arry
,
str
):
if
isinstance
(
arry
,
str
):
# local_path = "/home/patrick_huggingface_co/"
if
local_path
is
not
None
:
if
local_path
is
not
None
:
# local_path can be passed to correct images of tests
# local_path can be passed to correct images of tests
return
os
.
path
.
join
(
local_path
,
"/"
.
join
([
arry
.
split
(
"/"
)[
-
5
],
arry
.
split
(
"/"
)[
-
2
],
arry
.
split
(
"/"
)[
-
1
]
]
))
return
Path
(
local_path
,
arry
.
split
(
"/"
)[
-
5
],
arry
.
split
(
"/"
)[
-
2
],
arry
.
split
(
"/"
)[
-
1
])
.
as_posix
(
)
elif
arry
.
startswith
(
"http://"
)
or
arry
.
startswith
(
"https://"
):
elif
arry
.
startswith
(
"http://"
)
or
arry
.
startswith
(
"https://"
):
response
=
requests
.
get
(
arry
)
response
=
requests
.
get
(
arry
)
response
.
raise_for_status
()
response
.
raise_for_status
()
...
@@ -521,9 +520,9 @@ def export_to_video(video_frames: List[np.ndarray], output_video_path: str = Non
...
@@ -521,9 +520,9 @@ def export_to_video(video_frames: List[np.ndarray], output_video_path: str = Non
def
load_hf_numpy
(
path
)
->
np
.
ndarray
:
def
load_hf_numpy
(
path
)
->
np
.
ndarray
:
if
not
path
.
startswith
(
"http://"
)
or
path
.
startswith
(
"https://"
):
if
not
path
.
startswith
(
"http://"
)
or
path
.
startswith
(
"https://"
):
path
=
os
.
path
.
join
(
path
=
Path
(
"https://huggingface.co/datasets/fusing/diffusers-testing/resolve/main"
,
urllib
.
parse
.
quote
(
path
)
"https://huggingface.co/datasets/fusing/diffusers-testing/resolve/main"
,
urllib
.
parse
.
quote
(
path
)
)
)
.
as_posix
()
return
load_numpy
(
path
)
return
load_numpy
(
path
)
...
...
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