Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'WordEmbeddingsCentroidSimilarity' object has no attribute 'binary' #41

Closed
rsimd opened this issue Nov 16, 2021 · 2 comments

Comments

@rsimd
Copy link

rsimd commented Nov 16, 2021

  • OCTIS version: 1.9.0
  • Python version :3.9.7
  • Operating System:
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=20.04
    DISTRIB_CODENAME=focal
    DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"

Description

I'm not familiar with Github, so I may be rude.
Thank you for publishing such a great works.

It seems that the constructors of WardEmbeddingsPairwiseSimilarity and WardEmbeddingsCentroidSimilarity did not have self.binary.
Therefore, I could not use any pretrained word embeddings other than the default.

What I Did

In [2]: from octis.evaluation_metrics import similarity_metrics

In [3]: dummy_kv_path = "/workdir/dummy_kv.txt"

In [4]: similarity_metrics.WordEmbeddingsPairwiseSimilarity(word2vec_path=dummy_kv_path)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-c02dac4f77ab> in <module>
----> 1 similarity_metrics.WordEmbeddingsPairwiseSimilarity(word2vec_path=dummy_kv_path)

~/.cache/pypoetry/virtualenvs/sktopic-L2WRRFYm-py3.9/lib/python3.9/site-packages/octis/evaluation_metrics/similarity_metrics.py in __init__(self, word2vec_path, topk)
     71             self.wv = api.load('word2vec-google-news-300')
     72         else:
---> 73             self.wv = KeyedVectors.load_word2vec_format( word2vec_path, binary=self.binary)
     74 
     75         self.topk = topk

AttributeError: 'WordEmbeddingsPairwiseSimilarity' object has no attribute 'binary'

In [5]: similarity_metrics.WordEmbeddingsCentroidSimilarity(word2vec_path=dummy_kv_path)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-1f1c772b67de> in <module>
----> 1 similarity_metrics.WordEmbeddingsCentroidSimilarity(word2vec_path=dummy_kv_path)

~/.cache/pypoetry/virtualenvs/sktopic-L2WRRFYm-py3.9/lib/python3.9/site-packages/octis/evaluation_metrics/similarity_metrics.py in __init__(self, word2vec_path, topk)
    115             self.wv = api.load('word2vec-google-news-300')
    116         else:
--> 117             self.wv = KeyedVectors.load_word2vec_format(word2vec_path, binary=self.binary)
    118         self.topk = topk
    119 

AttributeError: 'WordEmbeddingsCentroidSimilarity' object has no attribute 'binary'
@silviatti
Copy link
Collaborator

Hi! Thanks for reporting the issue.

I have just released a new version of OCTIS that handles this problem (v 1.10.0). You can run pip install -U octis to download the latest version. Feel free to reopen the issue if you still have problems.

Silvia

@rsimd
Copy link
Author

rsimd commented Nov 22, 2021

Thank you. I'll try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants