Problem Installing Responsilby
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:
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'
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.
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.