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

Problem Installing Responsilby #66

Open
BradleyMerrillT opened this issue May 16, 2023 · 3 comments
Open

Problem Installing Responsilby #66

BradleyMerrillT opened this issue May 16, 2023 · 3 comments

Comments

@BradleyMerrillT
Copy link

I am trying to use responsibly in google collaboratory, and each time I install it, when I go to use it, I get the following error: AttributeError: module 'gensim.models.keyedvectors' has no attribute 'BaseKeyedVectors'

During the install, this is what I get:

Screenshot 2023-05-16 131104

@austinhoag
Copy link

I am getting the same error on Mac M1 Ventura running Python 3.10 in a fresh conda environment. Bradley's screenshot does not contain the error message he mentioned in his comment, so here is a full traceback of the gensim error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 from responsibly.dataset import COMPASDataset

File ~/anaconda3/envs/seldo_responsibly/lib/python3.10/site-packages/responsibly/__init__.py:3
      1 # pylint: disable=line-too-long
----> 3 from responsibly import fairness, we
      6 __project__ = 'responsibly'
      7 __description__ = 'Toolkit for Auditing and Mitigating Bias and Fairness of Machine Learning Systems 🔎🤖🧰'

File ~/anaconda3/envs/seldo_responsibly/lib/python3.10/site-packages/responsibly/we/__init__.py:48
      1 """
      2 Metrics and debiasing for bias (such as gender and race) in word embedding.
      3 
   (...)
     45 
     46 """
---> 48 from responsibly.we.bias import BiasWordEmbedding, GenderBiasWE
     49 from responsibly.we.data import load_w2v_small
     50 from responsibly.we.utils import most_similar

File ~/anaconda3/envs/seldo_responsibly/lib/python3.10/site-packages/responsibly/we/bias.py:93
     91 from responsibly.we.benchmark import evaluate_word_embedding
     92 from responsibly.we.data import BOLUKBASI_DATA, OCCUPATION_FEMALE_PRECENTAGE
---> 93 from responsibly.we.utils import (
     94     assert_gensim_keyed_vectors, cosine_similarity, generate_one_word_forms,
     95     generate_words_forms, get_seed_vector, most_similar, normalize,
     96     plot_clustering_as_classification, project_params, project_reject_vector,
     97     project_vector, reject_vector, round_to_extreme,
     98     take_two_sides_extreme_sorted, update_word_vector,
     99 )
    102 DIRECTION_METHODS = ['single', 'sum', 'pca']
    103 DEBIAS_METHODS = ['neutralize', 'hard', 'soft']

File ~/anaconda3/envs/seldo_responsibly/lib/python3.10/site-packages/responsibly/we/utils.py:14
      9 from sklearn.manifold import TSNE
     10 from sklearn.metrics import accuracy_score
     13 WORD_EMBEDDING_MODEL_TYPES = (gensim.models.keyedvectors.KeyedVectors,
---> 14                               gensim.models.keyedvectors.BaseKeyedVectors,
     15                               gensim.models.fasttext.FastText,
     16                               gensim.models.word2vec.Word2Vec,
     17                               gensim.models.base_any2vec.BaseWordEmbeddingsModel,)  # pylint: disable=line-too-long
     20 def round_to_extreme(value, digits=2):
     21     place = 10**digits

AttributeError: module 'gensim.models.keyedvectors' has no attribute 'BaseKeyedVectors'

@tunde99
Copy link

tunde99 commented Nov 16, 2023

I forked the repo and made some edits to the gensim functions in the utils.py and bias.py files in the responsibly.we directory to work for my use case. You might want to skip pip installation for now and follow the direct source code installation guideline in the README file and clone my repo https://github.com/tunde99/responsibly.git instead to see if it works for you too. I should probably make a pull request.

@shlomihod
Copy link
Member

Hi @tunde99, amazing work, thank you so much for doing that! I'll have a deeper look into your edits and merge it in the next few days.

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

4 participants