如何知道一个词是否属于变压器模型?
我使用模型 roberta 和 flaubert ,我使用python库 ston_transformer 。 我使用余弦分数来计算相似性,但对某些话来说效果不佳。 这些单词似乎是模型中“已知”单词的一部分(我猜我猜没有在训练集中的单词),例如:“ WCFS”,“ SARS”,“ OSGI”
是有一种方法可以检查字符串是否通过模型“知道”?(使用此库或任何其他能够加载这些变压器模型的人)
非常感谢。
I use the python library sentence_transformers with the models RoBERTa and FlauBERT.
I use cosine scores to compute similarity but for some words it doesn't work well.
Those words seems to be the one that are not part of the "known" words from the model (words that weren't on the training set I guess) like : "WCFs", "SARs", "OSGi"
Is there a way to check if a string is "known" by a model ? (with this library or any other one able to load those Transformers model)
Thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于Roberta和Flaubert模型,您可以使用
get_vocab()
方法获取具有令牌及其ID的字典。词汇中的100个令牌的示例:产量:
然后,您可以在python中使用 operator中的
检查令牌是否属于词汇:
For RoBERTa and FlauBERT models, you can use
get_vocab()
method to get a dictionary with the tokens and theirs ids. Example of 100 tokens in vocab:Yields:
Then, you can use
in
operator in Python to check if a token belongs in the vocabulary: