DeepGraphLearning / graphvite

GraphVite: A General and High-performance Graph Embedding System
https://graphvite.io
Apache License 2.0
1.23k stars 154 forks source link

AttributeError: module 'graphvite' has no attribute 'dataset' #97

Open dxlong2000 opened 2 years ago

dxlong2000 commented 2 years ago

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!

wywy136 commented 2 years ago

Just check the name of your python script and it should not be named as graphvite.py.