diff --git a/onnx/export/tar.bz2.py b/onnx/export/tar.bz2.py index 896b2cbc..d71ebddf 100755 --- a/onnx/export/tar.bz2.py +++ b/onnx/export/tar.bz2.py @@ -7,15 +7,12 @@ def txz(folder_path, output_path): - # 创建.tar文件流 - tar_stream = bz2.BZ2File(output_path, 'w') + stream = bz2.BZ2File(output_path, 'w') - # 将文件夹压缩为.tar文件流 - with tarfile.TarFile(fileobj=tar_stream, mode='w') as tar: - tar.add(folder_path, arcname='') + with tarfile.TarFile(fileobj=stream, mode='w') as tar: + tar.add(folder_path, arcname='') - # 关闭.tar文件流 - tar_stream.close() + stream.close() txz(ONNX_DIR, ONNX_DIR + '.tar.bz2')