YovaKem / generalized-procrustes-MUSE

Other
7 stars 2 forks source link

Assertion error when running supervised.py #1

Open goodbai-nlp opened 5 years ago

goodbai-nlp commented 5 years ago

Hi, I'm trying to reproduce the result reported in your paper. However, when I tried python supervised.py --src_lang $src --tgt_lang "de $tgt" --src_emb /data/embeddings/$src.emb.txt --tgt_emb "/data/embeddings/de.emb.txt /data/embeddings/$tgt.emb.txt" - -exp_id $src-$tgt --n_refinement 15 --dico_train default --generalized True , the following error occurred: INFO - 01/24/19 13:27:42 - 0:00:00 - ============ Initialized logger ============ INFO - 01/24/19 13:27:42 - 0:00:00 - cuda: True dico_build: S2T&T2S dico_eval: default dico_max_rank: 10000 dico_max_size: 0 dico_method: csls_knn_10 dico_min_size: 0 dico_threshold: 0 dico_train: default emb_dim: 300 exp_id: it-en exp_name: debug exp_path: /home/xfbai/mywork/GPA/dumped/debug/it-en export: txt fine_tuning: 0 generalized: True map_id_init: True max_vocab: 200000 n_refinement: 15 normalize_embeddings: seed: -1 src_emb: /data/embeddings/it.emb.txt src_lang: it tgt_emb: ['/data/embeddings/de.emb.txt', '/data/embeddings/en.emb.txt'] tgt_lang: ['de', 'en'] verbose: 2 INFO - 01/24/19 13:27:42 - 0:00:00 - The experiment will be stored in /home/xfbai/mywork/GPA/dumped/debug/it-en INFO - 01/24/19 13:27:42 - 0:00:00 - Loading embeddings for language it INFO - 01/24/19 13:28:16 - 0:00:35 - Loaded 199851 pre-trained word embeddings. INFO - 01/24/19 13:28:32 - 0:00:50 - Loading embeddings for language de INFO - 01/24/19 13:28:46 - 0:01:05 - Loaded 200000 pre-trained word embeddings. INFO - 01/24/19 13:28:58 - 0:01:16 - Loading embeddings for language en INFO - 01/24/19 13:29:42 - 0:02:00 - Loaded 199958 pre-trained word embeddings. data/crosslingual/dictionaries/it-['de', 'en'].0-5000.txt Traceback (most recent call last): File "supervised.py", line 90, in trainer.load_training_dico(params.dico_train, support) File "/home/xfbai/mywork/GPA/src/trainer.py", line 158, in load_training_dico word2id1, word2id2, True File "/home/xfbai/mywork/GPA/src/evaluation/word_translation.py", line 74, in load_dictionary assert os.path.isfile(path) AssertionError

I will be great appreciated that if you can tell me how to solve this problem.

kadarakos commented 5 years ago

I have the same issue

I was trying to run

python supervised.py --src_lang de --tgt_lang "en es" --src_emb ../FastText_embeddings/wiki.de.vec --tgt_emb "../FastText_embeddings/wiki.en.vec ../FastText_embeddings/wiki.es.vec" --generalized True --n_refinement 5 --dico_train default

which gives error

Traceback (most recent call last):
  File "supervised.py", line 90, in <module>
    trainer.load_training_dico(params.dico_train, support)
  File "/home/ubuntu/generalized-procrustes-MUSE/src/trainer.py", line 158, in load_training_dico
    word2id1, word2id2, True
  File "/home/ubuntu/generalized-procrustes-MUSE/src/evaluation/word_translation.py", line 74, in load_dictionary
    assert os.path.isfile(path)
AssertionError

This fails because of line: https://github.com/YovaKem/generalized-procrustes-MUSE/blob/master/src/trainer.py#L154

it is trying to find:

/dictionaries/de-['en', 'es'].0-5000.txt
kadarakos commented 5 years ago

After fixing that line I've got to:

Traceback (most recent call last):
  File "supervised.py", line 90, in <module>
    trainer.load_training_dico(params.dico_train, support)
  File "/home/ubuntu/generalized-procrustes-MUSE/src/trainer.py", line 166, in load_training_dico
    self.dico = cross_match_dictionary(self.params.tgt_lang, dico, dico_inbn, self.params)
  File "/home/ubuntu/generalized-procrustes-MUSE/src/dico_builder.py", line 190, in cross_match_dictionary
    if all([src_word in dico[lang][:,0] for lang in lang_list]):
  File "/home/ubuntu/generalized-procrustes-MUSE/src/dico_builder.py", line 190, in <listcomp>
    if all([src_word in dico[lang][:,0] for lang in lang_list]):
TypeError: tuple indices must be integers or slices, not tuple
YovaKem commented 5 years ago

I'll look into these and get back to you by the end of the week.