Giter Club home page Giter Club logo

Comments (9)

viking-sudo-rm avatar viking-sudo-rm commented on July 20, 2024 1

I was able to figure out how to resolve #40 by looking at src/evaluate/evaluator.py. Might prove helpful to you as well.

from muse.

DavidGOrtega avatar DavidGOrtega commented on July 20, 2024 1

@viking-sudo-rm In my case just because my target corpus is barely 67 words I had to change also the line 136 of evaluation/word_translation.py

top_matches = scores.topk(100, 1, True)[1]

I changed the top 100 to 10

top_matches = scores.topk(10, 1, True)[1]

from muse.

glample avatar glample commented on July 20, 2024 1

Thank you @DavidGOrtega , you are right, topk(10, ...) is enough since we only report precision at 1, 5, 10. This is fixed in 0546ef8

from muse.

DavidGOrtega avatar DavidGOrtega commented on July 20, 2024

To clarify the issue a bit:

python supervised.py --src_lang en --tgt_lang en --src_emb ./../x/embeddings/wiki.en.vec --tgt_emb ./../x/embeddings/car_brands.vec --n_refinement 5 --dico_train identical_char --max_vocab -1
INFO - 04/17/18 19:20:43 - 0:04:50 - Starting iteration 0...
Traceback (most recent call last):
  File "supervised.py", line 96, in <module>
    evaluator.all_eval(to_log)
  File "/mnt/dgortega/MUSE/src/evaluation/evaluator.py", line 190, in all_eval
    self.word_translation(to_log)
  File "/mnt/dgortega/MUSE/src/evaluation/evaluator.py", line 94, in word_translation
    method=method
  File "/mnt/dgortega/MUSE/src/evaluation/word_translation.py", line 89, in get_word_translation_accuracy
    dico = load_dictionary(path, word2id1, word2id2)
  File "/mnt/dgortega/MUSE/src/evaluation/word_translation.py", line 49, in load_dictionary
    assert os.path.isfile(path)
AssertionError

from muse.

aconneau avatar aconneau commented on July 20, 2024

Hi, when using identical_char, the training dictionary will indeed be a dictionary made of words that appear in both src and tgt word dictionary.

The issue that you're getting is not linked to the training dictionary but to the validation dictionary, which is used to evaluate how well the alignment model is doing after each Procrustes iteration.

By default, MUSE uses the dictionary located at : data/crosslingual/dictionaries/$src_lang-$tgt_lang.5000-6500.txt . Since you're using "en" for both src and tgt, there is no such evaluation dictionary. But you can simply manually create one by taking the English words that appear in data/crosslingual/dictionaries/en-fr.5000-6500.txt and duplicating the first column. This is actually what we did for the English-English experiments in the Appendix of our paper.

Thanks

from muse.

DavidGOrtega avatar DavidGOrtega commented on July 20, 2024

Hi, I tried after creating my issue exactly that but:

  1. using the dictionary en-en.5000-6500.txt
  2. using a custom dictionary with the words that appears in target embeddings

Both experiments fail; I even followed the given solutions in #40

My target embeddings are indeed a very small embeddings based just on car brands. My hope was that MUSE would be able to align such a small embeddings, in fact, 62 out of 67 words in the car brands corpus are present in the source.

Would MUSE be able to work in those circumstances? Im doing this experiment since teorically there is no minimum corpus size to create a embedding and I was intenrested to see if MUSE would align the words...

from muse.

DavidGOrtega avatar DavidGOrtega commented on July 20, 2024

when I try to run with my small dictionary which is in fact the words of the embeddings I find:

Traceback (most recent call last):
  File "supervised.py", line 96, in <module>
    evaluator.all_eval(to_log)
  File "/mnt/dgortega/MUSE/src/evaluation/evaluator.py", line 192, in all_eval
    self.dist_mean_cosine(to_log)
  File "/mnt/dgortega/MUSE/src/evaluation/evaluator.py", line 157, in dist_mean_cosine
    src_emb = src_emb / src_emb.norm(2, 1, keepdim=True).expand_as(src_emb)
TypeError: norm received an invalid combination of arguments - got (int, int, keepdim=bool), but expected one of:
 * no arguments
 * (float p)
 * (float p, int dim)

from muse.

DavidGOrtega avatar DavidGOrtega commented on July 20, 2024

Hi, previous issue was a pythorch error. After reinstallation it continued to go. However I have an issue

scores = emb2.mm(emb1[i:min(n_src, i + bs)].transpose(0, 1)).transpose(0, 1)
ValueError: result of slicing is an empty tensor

which is related to #39 and #31 I have changed my --dico-max-rank as stated and still same error.
My target embedding corpus is just 67 words as stated before...

from muse.

viking-sudo-rm avatar viking-sudo-rm commented on July 20, 2024

This is also the same error I am getting in #40. Based on #39, it seems to come from having a small number of words in the vocabulary, but I'm still not sure how to address it.

from muse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.