graphvite
graphvite copied to clipboard
AttributeError: module 'graphvite' has no attribute 'dataset'
Hi @tangjianpku , thanks for your great work.
I have installed the module in Colab:
!wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!./Miniconda3-latest-Linux-x86_64.sh -b -p /usr/local -f
!conda install -y -c milagraph -c conda-forge graphvite-mini \
python=3.9 cudatoolkit=$(nvcc -V | grep -Po "(?<=V)\d+\.\d+")
!conda install -y wurlitzer ipykernel
import site
site.addsitedir("/usr/local/lib/python3.9/site-packages")
%reload_ext wurlitzer
and I run:
import pickle
with open("transe_wikidata5m.pkl", "rb") as fin:
model = pickle.load(fin)
entity2id = model.graph.entity2id
relation2id = model.graph.relation2id
entity_embeddings = model.solver.entity_embeddings
relation_embeddings = model.solver.relation_embeddings
import graphvite as gv
alias2entity = gv.dataset.wikidata5m.alias2entity
alias2relation = gv.dataset.wikidata5m.alias2relation
print(entity_embeddings[entity2id[alias2entity["machine learning"]]])
print(relation_embeddings[relation2id[alias2relation["field of work"]]])
I got the error:
AttributeError: module 'graphvite' has no attribute 'dataset'
Is it possible that you could help me to check out what happened?
Thanks!
Just check the name of your python script and it should not be named as graphvite.py
.