From 70d0bd5b0792fd43e530ae5faabedae636e01e5d Mon Sep 17 00:00:00 2001 From: Kaloyan Fachikov Date: Mon, 22 Jun 2026 13:03:07 +0000 Subject: [PATCH] fix: file exists on consecutive metric evaluations This change resolves a FileExistsError caused by shutil.copytree when the destination directory already exists. --- src/pruna/engine/save.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pruna/engine/save.py b/src/pruna/engine/save.py index 94ec3628..e065ca42 100644 --- a/src/pruna/engine/save.py +++ b/src/pruna/engine/save.py @@ -309,7 +309,7 @@ def save_before_apply(model: Any, model_path: str | Path, smash_config: SmashCon if file.is_file(): shutil.copy(file, target_path) else: - shutil.copytree(file, target_path) + shutil.copytree(file, target_path, dirs_exist_ok=True) def save_pickled(model: Any, model_path: str | Path, smash_config: SmashConfig) -> None: