onnx导出报错 | IndexError: index_select(): Index is supposed to be a vector

解决方案:
在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

你可能感兴趣的:(ai,笔记)