解决方案:
在torch.onnx.export钟添加do_constant_folding=False,如下
torch.onnx.export(model,
(None, text),
text_fp32_onnx_path,
input_names=['text'],
output_names=['unnorm_text_features'],
export_params=True,
opset_version=13,
verbose=True,
do_constant_folding=False
)
https://github.com/UKPLab/sentence-transformers/issues/1296