lightseq icon indicating copy to clipboard operation
lightseq copied to clipboard

use lightseq to export XLMRobertaModel,the precision of the output embeddings loss a lot

Open dengli1234 opened this issue 3 years ago • 2 comments

I use huggingface sentence-transformers/paraphrase-multilingual-mpnet-base-v2(https://huggingface.co/sentence-transformers/paraphrase-multilingual-mpnet-base-v2), this is a xlm-roberta model. This model is used to calculate sentence embedding similarity. Then I use lightseq huggingface hf_bert_export.py to export. the exported model and the origin model generate different embeddings of the same sentence.

sentences : "Hello, my dog is cute", "Hey, how are you", "This is a test", "Testing the model again",

and the embedding is below Uploading 截屏2021-11-11 下午3.09.54.png…

dengli1234 avatar Nov 11 '21 07:11 dengli1234

截屏2021-11-11 下午3 09 54

这个是产出的句子embedding向量,精度损失还是挺大的,导出后没法做句子相似度计算和文本检索了

dengli1234 avatar Nov 11 '21 07:11 dengli1234

This may not be a loss of accuracy. Maybe you need to check if your model structure is the same as bert. Also, check some options like pre-ln or post-ln during exporting your model.

neopro12 avatar Nov 15 '21 02:11 neopro12