Skip to content

Commit 6d202cb

Browse files
committed
Allow skipping non-critical files like results.csv or results.png
1 parent b8a4c85 commit 6d202cb

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

roboflow/core/version.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,19 @@ def deploy(self, model_type: str, model_path: str) -> None:
406406

407407
with zipfile.ZipFile(model_path + "roboflow_deploy.zip", "w") as zipMe:
408408
for file in lista_files:
409-
zipMe.write(
410-
model_path + file,
411-
arcname=file,
412-
compress_type=zipfile.ZIP_DEFLATED,
413-
)
409+
if os.path.exists(model_path + file):
410+
zipMe.write(
411+
model_path + file,
412+
arcname=file,
413+
compress_type=zipfile.ZIP_DEFLATED,
414+
)
415+
else:
416+
if file in ["model_artifacts.json", "state_dict.pt"]:
417+
raise (
418+
ValueError(
419+
f"File {file} not found. Please make sure to provide a valid model path."
420+
)
421+
)
414422

415423
res = requests.get(
416424
f"{API_URL}/{self.workspace}/{self.project}/{self.version}/uploadModel?api_key={self.__api_key}"

0 commit comments

Comments
 (0)