Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 509fa1a

Browse files
authored
Merge branch 'main' into analyze_cherry_picks
2 parents 08f94c4 + a00ca1e commit 509fa1a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/sparsezoo/utils/onnx/external_data.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ def split_external_data(
300300
# WRITE - ONNX model with updated tensor external data info
301301
onnx.save(model, model_path)
302302

303+
# RENAME - if as a result of splitting we end up with a single file, rename it to
304+
# the original external data file name
305+
if current_external_data_file_number == 1:
306+
os.rename(
307+
os.path.join(base_dir, updated_file_name),
308+
os.path.join(base_dir, external_data_file),
309+
)
310+
303311

304312
def _write_external_data_file_from_base_bytes(
305313
new_file_name, original_byte_ranges, original_file_bytes_reader

0 commit comments

Comments
 (0)