SeanLee97 / AnglE

Train and Infer Powerful Sentence Embeddings with AnglE | 🔥 SOTA on STS and MTEB Leaderboard
https://arxiv.org/abs/2309.12871
MIT License
397 stars 30 forks source link

AttributeError: 'AnglE' object has no attribute 'set_prompt' #79

Closed HungryFour closed 3 weeks ago

HungryFour commented 3 weeks ago

Mac mini 14.2.1 (23C71) angle-emb==0.4.5

from angle_emb import AnglE, Prompts
print('All predefined prompts:', Prompts.list_prompts())
angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls')
print("angle:", angle)
angle.set_prompt(prompt=Prompts.C)

get error

angle: <angle_emb.angle.AnglE object at 0x152515d30>
Traceback (most recent call last):
  File "/Volumes/NBDATA/JobProjects/Tsinghua/Data-chat/text_splitter/article_partition_splitter.py", line 19, in <module>
    angle.set_prompt(prompt=Prompts.C)
AttributeError: 'AnglE' object has no attribute 'set_prompt'
SeanLee97 commented 3 weeks ago

hi @HungryFour , set_prompt() has been removed in the latest version. You can specify a prompt in the encode(..., prompt=Prompts.C) function.

Here is an example: https://angle.readthedocs.io/en/latest/notes/quickstart.html#infer-bert-based-model

For more arguments of encode() function, please refer to: https://angle.readthedocs.io/en/latest/autoapi/angle_emb/index.html#angle_emb.AnglE.encode

HungryFour commented 3 weeks ago

Thank you so much for addressing my issue! I really appreciate the quick response and resolution. Your help has made a significant difference, and I'm grateful for the support. Keep up the great work!

Best regards,