diff --git a/src/diffusers/utils/testing_utils.py b/src/diffusers/utils/testing_utils.py index df1a4fc420..f8aeed475a 100644 --- a/src/diffusers/utils/testing_utils.py +++ b/src/diffusers/utils/testing_utils.py @@ -137,7 +137,7 @@ def get_tests_dir(append_path=None): tests_dir = os.path.dirname(tests_dir) if append_path: - return os.path.join(tests_dir, append_path) + return Path(tests_dir, append_path).as_posix() else: return tests_dir @@ -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: if isinstance(arry, str): - # local_path = "/home/patrick_huggingface_co/" if local_path is not None: # 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://"): response = requests.get(arry) response.raise_for_status() @@ -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: 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) - ) + ).as_posix() return load_numpy(path)