This commit is contained in:
wudong 2022-11-08 14:37:21 +08:00
commit 74c5733a38

View File

@ -301,9 +301,11 @@ def Export_model_RODY(params_str):
params = TrainParams() params = TrainParams()
params.read_from_str(params_str) params.read_from_str(params_str)
exp_inputPath = params.get('exp_inputPath').value # 模型路径 exp_inputPath = params.get('exp_inputPath').value # 模型路径
print('输入模型:', exp_inputPath)
exp_device = params.get('device').value exp_device = params.get('device').value
modellist = Start_Model_Export(exp_inputPath, exp_device) modellist = Start_Model_Export(exp_inputPath, exp_device)
exp_outputPath = exp_inputPath.replace('pt', 'zip') # 压缩文件 exp_outputPath = exp_inputPath.replace('pt', 'zip') # 压缩文件
print('模型路径:',exp_outputPath)
zipf = zipfile.ZipFile(exp_outputPath, 'w') zipf = zipfile.ZipFile(exp_outputPath, 'w')
for file in modellist: for file in modellist:
zipf.write(file, arcname=Path(file).name) # 将torchscript和onnx模型压缩 zipf.write(file, arcname=Path(file).name) # 将torchscript和onnx模型压缩