Skip to content

Chapter 4 (04_multilingual-ner.ipynb), Trainer() reported KeyError: 'email' #142

@shandong1970

Description

@shandong1970

Information

The problem arises in chapter:

  • Introduction
  • [*] Text Classification
  • Transformer Anatomy
  • Multilingual Named Entity Recognition
  • Text Generation
  • Summarization
  • Question Answering
  • Making Transformers Efficient in Production
  • Dealing with Few to No Labels
  • Training Transformers from Scratch
  • Future Directions

Describe the bug

To Reproduce

Steps to reproduce the behavior:

  1. one by one to run the code of <04_multilingual-ner.ipynb>.
  2. when you call Trainer, you will meet the error.

The code snippets are below:

from transformers import Trainer

trainer = Trainer(model_init=model_init, args=training_args, 
                  data_collator=data_collator, compute_metrics=compute_metrics,
                  train_dataset=panx_de_encoded["train"],
                  eval_dataset=panx_de_encoded["validation"], 
                  tokenizer=xlmr_tokenizer)

The error messages are below:

/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_deprecation.py:131: FutureWarning: 'Repository' (from 'huggingface_hub.repository') is deprecated and will be removed from version '1.0'. Please prefer the http-based alternatives instead. Given its large adoption in legacy code, the complete removal is only planned on next major release.
For more details, please read https://huggingface.co/docs/huggingface_hub/concepts/git_vs_http.
  warnings.warn(warning_message, FutureWarning)
/content/notebooks/xlm-roberta-base-finetuned-panx-de is already a clone of https://huggingface.co/shandong1970/xlm-roberta-base-finetuned-panx-de. Make sure you pull the latest changes with `repo.git_pull()`.
WARNING:huggingface_hub.repository:/content/notebooks/xlm-roberta-base-finetuned-panx-de is already a clone of https://huggingface.co/shandong1970/xlm-roberta-base-finetuned-panx-de. Make sure you pull the latest changes with `repo.git_pull()`.
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[<ipython-input-54-ef227f75390c>](https://localhost:8080/#) in <cell line: 4>()
      2 from transformers import Trainer
      3 
----> 4 trainer = Trainer(model_init=model_init, args=training_args, 
      5                   data_collator=data_collator, compute_metrics=compute_metrics,
      6                   train_dataset=panx_de_encoded["train"],

4 frames
[/usr/local/lib/python3.10/dist-packages/huggingface_hub/repository.py](https://localhost:8080/#) in __init__(self, local_dir, clone_from, repo_type, token, git_user, git_email, revision, skip_lfs_files, client)
    543 
    544             if git_email is None:
--> 545                 git_email = user["email"]
    546 
    547             if git_user is None:

KeyError: 'email'

Expected behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions