GithubHelp home page GithubHelp logo

Comments (6)

sebastianruder avatar sebastianruder commented on July 30, 2024

Hi @vrmer, we used transformers==2.3.0 as far as I am aware. Did you try running the install_tools.sh script? This should install the correct transformer version (see this line).

from xtreme.

vrmer avatar vrmer commented on July 30, 2024

Thanks for the response! I ran into issues running the install_tools.sh script when I first started using the library but I don't have the output for that at the moment.

Nevertheless, I followed the lines you pointed at and install transformers==2.3.0. However, I still get the following errors:

Traceback (most recent call last): File "/Users/marcellfekete/PycharmProjects/xtreme/third_party/evaluate_retrieval.py", line 57, in <module> "xlmr": (XLMRobertaConfig, XLMRobertaModel, XLMRobertaTokenizer), NameError: name 'XLMRobertaTokenizer' is not defined

from xtreme.

sebastianruder avatar sebastianruder commented on July 30, 2024

Hmm, that's strange. I just checked the HuggingFace Transformers repo and XLMRobertaTokenizer should be available in v2.3.0 (see here)? Could you double check that you have the correct version and if the file tokenization_xlm_roberta.py is available in the transformers version you are using?

from xtreme.

vrmer avatar vrmer commented on July 30, 2024

Apologies, apparently I uncommented the import statement when I was trying to make the code run and forgot to put it back!

Now the code starts running with this message:

03/16/2022 15:57:00 - INFO - root -   Input args: Namespace(batch_size=100, cache_dir='', candidate_prefix='candidates', concate_layers=False, config_name='', data_dir='/Users/marcellfekete/PycharmProjects/xtreme/download//tatoeba/', dist='cosine', do_lower_case=False, embed_size=768, encoding='utf-8', extract_embeds=False, gold=None, init_checkpoint=None, local_rank=-1, log_file='embed-cosine', max_answer_length=92, max_query_length=64, max_seq_length=512, mine_bitext=False, model_name_or_path='/mnt/disk-1/models/squad/xlm-roberta-large_LR3e-5_EPOCH2.0_maxlen384_batchsize2_gradacc16', model_type='bert', no_cuda=False, num_layers=12, output_dir='/Users/marcellfekete/PycharmProjects/xtreme/outputs-temp//tatoeba//mnt/disk-1/models/squad/xlm-roberta-large_LR3e-5_EPOCH2.0_maxlen384_batchsize2_gradacc16_512/', overwrite_cache=False, overwrite_output_dir=False, pool_skip_special_token=False, pool_type='mean', predict_dir=None, specific_layer=7, split='training', src_embed_file=None, src_file=None, src_id_file=None, src_language='ar', src_text_file=None, src_tok_file=None, task_name='tatoeba', tgt_embed_file=None, tgt_file=None, tgt_id_file=None, tgt_language='en', tgt_text_file=None, tgt_tok_file=None, threshold=-1, tokenizer_name='', unify=False, use_shift_embeds=False)

But then it gives me this error message:

Traceback (most recent call last):
  File "/Users/marcellfekete/miniforge3/envs/rosetta/lib/python3.8/site-packages/transformers/configuration_utils.py", line 204, in get_config_dict
    raise EnvironmentError
OSError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/marcellfekete/PycharmProjects/xtreme/third_party/evaluate_retrieval.py", line 748, in <module>
    main()
  File "/Users/marcellfekete/PycharmProjects/xtreme/third_party/evaluate_retrieval.py", line 733, in main
    all_src_embeds = extract_embeddings(args, src_text_file, src_tok_file, None, lang=src_lang2, pool_type=args.pool_type)
  File "/Users/marcellfekete/PycharmProjects/xtreme/third_party/evaluate_retrieval.py", line 173, in extract_embeddings
    config, model, tokenizer, langid = load_model(args, lang,
  File "/Users/marcellfekete/PycharmProjects/xtreme/third_party/evaluate_retrieval.py", line 150, in load_model
    config = config_class.from_pretrained(args.model_name_or_path)
  File "/Users/marcellfekete/miniforge3/envs/rosetta/lib/python3.8/site-packages/transformers/configuration_utils.py", line 160, in from_pretrained
    config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/Users/marcellfekete/miniforge3/envs/rosetta/lib/python3.8/site-packages/transformers/configuration_utils.py", line 220, in get_config_dict
    raise EnvironmentError(msg)
OSError: Model name '/mnt/disk-1/models/squad/xlm-roberta-large_LR3e-5_EPOCH2.0_maxlen384_batchsize2_gradacc16' was not found in model name list. We assumed 'https://s3.amazonaws.com/models.huggingface.co/bert//mnt/disk-1/models/squad/xlm-roberta-large_LR3e-5_EPOCH2.0_maxlen384_batchsize2_gradacc16/config.json' was a path, a model identifier, or url to a configuration file named config.json or a directory containing such a file but couldn't find any such file at this path or url.

I'm not even sure why it is trying to use XLM-RoBERTa when I explicitly tried using multilingual BERT.

from xtreme.

sebastianruder avatar sebastianruder commented on July 30, 2024

I assume you're running the run_tatoeba.sh script? We are now recommending to use a model fine-tuned on SQuAD for retrieval, rather than using the representations of the pre-trained model directly.
In the run_tatoeba.sh script, you can replace the path to the fine-tuned model here. If you prefer not to use a fine-tuned model, you can simply uncomment that line and things should run as expected.

Edit: Running scripts/train.sh "bert-base-multilingual-cased" tatoeba calls the run_tatoeba.sh script.

from xtreme.

vrmer avatar vrmer commented on July 30, 2024

Oh thank you, that was actually really helpful! Now the code seems to be running without issues.

I am closing the issue because it has been sorted.

from xtreme.

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.