Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Felix Marty
commited on
Commit
·
3166d00
1
Parent(s):
5fc4052
add subfolder
Browse files- onnx_export.py +8 -3
onnx_export.py
CHANGED
@@ -71,9 +71,14 @@ def convert_onnx(model_id: str, task: str, folder: str) -> List:
|
|
71 |
|
72 |
validate_model_outputs(onnx_config, model, output, onnx_outputs, atol)
|
73 |
print(f"All good, model saved at: {output}")
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
77 |
return operations
|
78 |
|
79 |
|
|
|
71 |
|
72 |
validate_model_outputs(onnx_config, model, output, onnx_outputs, atol)
|
73 |
print(f"All good, model saved at: {output}")
|
74 |
+
|
75 |
+
n_files = len([name for name in os.listdir(folder) if os.path.isfile(os.path.join(folder, name)) and not name.startswith(".")])
|
76 |
+
|
77 |
+
if n_files == 1:
|
78 |
+
operations = [CommitOperationAdd(path_in_repo=file_name, path_or_fileobj=os.path.join(folder, file_name)) for file_name in os.listdir(folder)]
|
79 |
+
else:
|
80 |
+
operations = [CommitOperationAdd(path_in_repo=os.path.join("onnx", file_name), path_or_fileobj=os.path.join(folder, file_name)) for file_name in os.listdir(folder)]
|
81 |
+
|
82 |
return operations
|
83 |
|
84 |
|