princeton-nlp / SimCSE

[EMNLP 2021] SimCSE: Simple Contrastive Learning of Sentence Embeddings https://arxiv.org/abs/2104.08821

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: object of type 'IndexFlatIP' has no len()

Maydaytyh opened this issue · comments

Hi, I trained roberta-large with my own data by using run_sup_example.sh. But when I build index for senteced and use model.search, I encountered the error. The building process has no problem, the error is in model.search.

/site-packages/simcse/tool.py", line 64, in encode
    total_batch = len(sentence) // batch_size + (1 if len(sentence) % batch_size > 0 else 0)
TypeError: object of type 'IndexFlatIP' has no len()

I modify the default value of use_faiss to True, then it works. Maybe something wrong

Hi Maydaytyh,

Thanks for spotting our the problem! I'll look into it

Stale issue message

Stale issue message