dmlc / dgl

Python package built to ease deep learning on graph, on top of existing DL frameworks.
http://dgl.ai
Apache License 2.0
13.51k stars 3.02k forks source link

completed train. when I use command dglke_predict, dglke remind me that dglke_predict: command not found #1651

Closed Igoslow closed 4 years ago

Igoslow commented 4 years ago

please help me. I want to use command that dglke_predict --data_path data/wn18/ --model_path ckpts/TransE_l2_wn18_0/ --format 'h_r_t' --data_files head.list rel.list tail.list --score_func logsigmoid --topK 5 --exec_mode 'batch_head'

classicsong commented 4 years ago

Hi, the dglke_predict is in https://github.com/awslabs/dgl-ke repo. And you need to install from source other than pip install

Igoslow commented 4 years ago

I use to pip uninstall dglke and complete to remove it. But, when I use dglke_train and dglke_predict, it also appear this problem that -bash: dglke_predict: command not found .

Igoslow commented 4 years ago

I use to pip uninstall dglke and complete to remove it. But, when I use dglke_train and dglke_predict, it also appear this problem that -bash: dglke_train : command not found .

classicsong commented 4 years ago

Did you try:

git clone https://github.com/awslabs/dgl-ke.git
cd dgl-ke/python
sudo python3 setup.py install

Note: dgl-ke only work with python3

Igoslow commented 4 years ago

I have a try. Thank you very much

Igoslow commented 4 years ago

Thank you again. However, it accurs the following problem. please help me

File "/usr/local/bin/dglke_predict", line 11, in load_entry_point('dglke==0.1.0.dev0', 'console_scripts', 'dglke_predict')() File "/usr/local/lib/python3.6/site-packages/dglke-0.1.0.dev0-py3.6.egg/dglke/infer_score.py", line 88, in main KeyError: 'emap_file'

Igoslow commented 4 years ago

when I use this command dglke_predict --data_path data/wn18/ --model_path ckpts/TransE_l2_wn18_0/ --format 'h_r_t' --data_files head.list rel.list tail.list --score_func logsigmoid --topK 5 --exec_mode 'batch_head', it accurs the following problem.

File "/usr/local/bin/dglke_predict", line 11, in load_entry_point('dglke==0.1.0.dev0', 'console_scripts', 'dglke_predict')() File "/usr/local/lib/python3.6/site-packages/dglke-0.1.0.dev0-py3.6.egg/dglke/infer_score.py", line 88, in main KeyError: 'emap_file'

classicsong commented 4 years ago

when I use this command dglke_predict --data_path data/wn18/ --model_path ckpts/TransE_l2_wn18_0/ --format 'h_r_t' --data_files head.list rel.list tail.list --score_func logsigmoid --topK 5 --exec_mode 'batch_head', it accurs the following problem.

File "/usr/local/bin/dglke_predict", line 11, in load_entry_point('dglke==0.1.0.dev0', 'console_scripts', 'dglke_predict')() File "/usr/local/lib/python3.6/site-packages/dglke-0.1.0.dev0-py3.6.egg/dglke/infer_score.py", line 88, in main KeyError: 'emap_file'

Maybe you trained the model using old code. You can provide --entity_mfile and --rel_mfile for entity mapping file and relation mapping file. There are also under data/wn18/

Igoslow commented 4 years ago

could you give me a new command with dglke_predict? when I use new command that dglke_predict --entity_mfile ~/experiments/dgl-ke-master/my_task/data/wn18/entities.dict --rel_mfile ~/experiments/dgl-ke-master/my_task/data/wn18/relations.dict --data_path data/wn18/ --model_path /tianze/experiments/dgl-ke-master/my_task/ckpts/TransE_l2_wn18_1/ --format 'h_r_t' --data_files head.list rel.list tail.list --score_func logsigmoid --topK 5 --exec_mode 'batch_head' , I find a new problem that FileNotFoundError: [Errno 2] No such file or directory: 'head.list'. Thank you very much

classicsong commented 4 years ago

Do you have head.list rel.list tail.list under data/wn18/ ? You need to create them.

classicsong commented 4 years ago

You can goto https://aws-dglke.readthedocs.io/en/latest/inference.html for more details.

Igoslow commented 4 years ago

Do you have head.list rel.list tail.list under data/wn18/ ? You need to create them.

I don't see it in directory data/wn18/. Could you say how to generate files of head.list rel.list tail.list?

Igoslow commented 4 years ago

You can goto https://aws-dglke.readthedocs.io/en/latest/inference.html for more details.

I have seen it you say. And I have generated these files of head.list rel.list tail.list. But I am not sure the format of these files,so I have this issue that ValueError: invalid literal for int() with base 10: '/m/01qscs\n'.

classicsong commented 4 years ago

You can goto https://aws-dglke.readthedocs.io/en/latest/inference.html for more details.

I have seen it you say. And I have generated these files of head.list rel.list tail.list. But I am not sure the format of these files,so I have this issue that ValueError: invalid literal for int() with base 10: '/m/01qscs\n'.

It seems you are using raw id (strings). So you should turn on --raw_data flag. Also for head.list, rel.list and tail.list, one line for one record. For example head.list:

02553196
13068917
00083809
02757462
02321009

rel.list:

_derivationally_related_form
_hyponym

And make sure they are in the entity mapping file (entities.dict for wn18) and relation mapping file (relations.dict for wn18)

Igoslow commented 4 years ago

You can goto https://aws-dglke.readthedocs.io/en/latest/inference.html for more details.

I have seen it you say. And I have generated these files of head.list rel.list tail.list. But I am not sure the format of these files,so I have this issue that ValueError: invalid literal for int() with base 10: '/m/01qscs\n'.

It seems you are using raw id (strings). So you should turn on --raw_data flag. Also for head.list, rel.list and tail.list, one line for one record. For example head.list:

02553196
13068917
00083809
02757462
02321009

rel.list:

_derivationally_related_form
_hyponym

And make sure they are in the entity mapping file (entities.dict for wn18) and relation mapping file (relations.dict for wn18)

I have a try. But I have a bug that ValueError: invalid literal for int() with base 10: '/award/award_nominee/award_nominations./award/award_nomination/award\n'. Could you give me a advice?

classicsong commented 4 years ago

where does '/award/award_nominee/award_nominations./award/award_nomination/award\n' come from? Are you using your own dataset or the builtin wn18

Igoslow commented 4 years ago

where does '/award/award_nominee/award_nominations./award/award_nomination/award\n' come from? Are you using your own dataset or the builtin wn18

I just use FB15k dataset. These details are as follows.

File "/usr/local/bin/dglke_predict", line 11, in load_entry_point('dglke==0.1.0.dev0', 'console_scripts', 'dglke_predict')() File "/usr/local/lib/python3.6/site-packages/dglke-0.1.0.dev0-py3.6.egg/dglke/infer_score.py", line 118, in main File "/usr/local/lib/python3.6/site-packages/dglke-0.1.0.dev0-py3.6.egg/dglke/utils.py", line 142, in load_triplet_data

Igoslow commented 4 years ago

ckpts/TransE_l2_FB15k_0/config.json {'dataset': 'FB15k', 'model': 'TransE_l2', 'emb_size': 400, 'max_train_step': 3000, 'batch_size': 1000, 'neg_sample_size': 200, 'lr': 0.25, 'gamma': 19.9, 'double_ent': False, 'double_rel': False, 'neg_adversarial_sampling': True, 'adversarial_temperature': 1.0, 'regularization_coef': 1e-09, 'regularization_norm': 3, 'emap_file': 'entities.dict', 'rmap_file': 'relations.dict'} Traceback (most recent call last): File "/usr/local/bin/dglke_predict", line 11, in load_entry_point('dglke==0.1.0.dev0', 'console_scripts', 'dglke_predict')() File "/usr/local/lib/python3.6/site-packages/dglke-0.1.0.dev0-py3.6.egg/dglke/infer_score.py", line 118, in main File "/usr/local/lib/python3.6/site-packages/dglke-0.1.0.dev0-py3.6.egg/dglke/utils.py", line 142, in load_triplet_data ValueError: invalid literal for int() with base 10: '/award/award_nominee/award_nominations./award/award_nomination/award\n'

classicsong commented 4 years ago

Can you provide the cmd args? Did you use --raw_data ?

Igoslow commented 4 years ago

I use the following command. Please give me advice. [root@aoto-ecs-0003 ~]# whereis dglke_train dglke_train: /usr/local/bin/dglke_train

[root@aoto-ecs-0003 ~]# wheris dglke_predict -bash: wheris: command not found

Igoslow commented 4 years ago

Can you provide the cmd args? Did you use --raw_data ? Hello, could you give me advice?

classicsong commented 4 years ago

There are some example scripts and input files under https://github.com/awslabs/dgl-ke/tree/master/examples/wn18. Though they are using wn18, but it is similar to FB15k

Igoslow commented 4 years ago

There are some example scripts and input files under https://github.com/awslabs/dgl-ke/tree/master/examples/wn18. Though they are using wn18, but it is similar to FB15k

Thank you, sir. I have done some experiments on these two datasets. I use dglke_train command but I can't use dglke_predict command. The directory of dglke_train is /usr/local/bin/dglke_train and dglke_predict is not found.

classicsong commented 4 years ago

There are some example scripts and input files under https://github.com/awslabs/dgl-ke/tree/master/examples/wn18. Though they are using wn18, but it is similar to FB15k

Thank you, sir. I have done some experiments on these two datasets. I use dglke_train command but I can't use dglke_predict command. The directory of dglke_train is /usr/local/bin/dglke_train and dglke_predict is not found.

Did you do the following steps to build dgl_ke from source?

git clone https://github.com/awslabs/dgl-ke.git
cd dgl-ke/python
sudo python3 setup.py install

BTW, are you using conda or use plain python?

classicsong commented 4 years ago

There are some example scripts and input files under https://github.com/awslabs/dgl-ke/tree/master/examples/wn18. Though they are using wn18, but it is similar to FB15k

Thank you, sir. I have done some experiments on these two datasets. I use dglke_train command but I can't use dglke_predict command. The directory of dglke_train is /usr/local/bin/dglke_train and dglke_predict is not found.

BTW, you can add into our slack through this link https://join.slack.com/t/deep-graph-library/shared_invite/zt-eb4ict1g-xcg3PhZAFAB8p6dtKuP6xQ and we can chat there.

Igoslow commented 4 years ago

There are some example scripts and input files under https://github.com/awslabs/dgl-ke/tree/master/examples/wn18. Though they are using wn18, but it is similar to FB15k

Thank you, sir. I have done some experiments on these two datasets. I use dglke_train command but I can't use dglke_predict command. The directory of dglke_train is /usr/local/bin/dglke_train and dglke_predict is not found.

BTW, you can add into our slack through this link https://join.slack.com/t/deep-graph-library/shared_invite/zt-eb4ict1g-xcg3PhZAFAB8p6dtKuP6xQ and we can chat there.

Okay, Thank you