diff --git a/src/diffusers/onnx_utils.py b/src/diffusers/onnx_utils.py index 2282f411aed8..142174f6e101 100644 --- a/src/diffusers/onnx_utils.py +++ b/src/diffusers/onnx_utils.py @@ -79,8 +79,10 @@ def _save_pretrained(self, save_directory: Union[str, Path], file_name: Optional src_path = self.model_save_dir.joinpath(self.latest_model_name) dst_path = Path(save_directory).joinpath(model_file_name) - if not src_path.samefile(dst_path): + try: shutil.copyfile(src_path, dst_path) + except shutil.SameFileError: + pass def save_pretrained( self,