Closed flydsc closed 1 year ago
可以onnx。
感谢回复!想请教一下目前保存成sbert的格式的话,有没有成熟的转onnx来做的方案呢?
有 https://github.com/yuanzhoulvpi2017/quick_sentence_transformers ,用的onnx, 你可以借鉴。
找到一个即插即用的库,供后来大家参考
实测量化效果会有影响,供大家参考:
https://github.com/Pandora-Intelligence/fast-sentence-transformers
用例:
from fast_sentence_transformers import FastSentenceTransformer as SentenceTransformer
# use any sentence-transformer
encoder = SentenceTransformer("all-MiniLM-L6-v2", device="cpu", quantize=True)
encoder.encode("Hello hello, hey, hello hello")
encoder.encode(["Life is too short to eat bad food!"] * 2)
请教目前是否可以支持模型加速部署的链路?或者可以用hugging face的API来做ONNX部署?