TypeError: Repository.__init__() got an unexpected keyword argument 'token'

Hi, I want to train a model for speech classification. I run my code many times on colab and it was okay, but this time I want to run it on my laptop. When I want to define trainer I got this error.

trainer = Trainer(model=model,
TypeError                                 Traceback (most recent call last)
Cell In[42], line 1
----> 1 trainer = Trainer(model=model,
      2                 args=training_args,
      3                 train_dataset=encoded_iemocap_audio["train"],
      4                 eval_dataset=encoded_iemocap_audio["valid"],
      5                 tokenizer=feature_extractor,
      6                 compute_metrics=compute_metrics)

File ~/opt/anaconda3/envs/myenv/lib/python3.10/site-packages/transformers/trainer.py:497, in Trainer.__init__(self, model, args, data_collator, train_dataset, eval_dataset, tokenizer, model_init, compute_metrics, callbacks, optimizers, preprocess_logits_for_metrics)
    495 # Create clone of distant repo and output directory if needed
    496 if self.args.push_to_hub:
--> 497     self.init_git_repo(at_init=True)
    498     # In case of pull, we need to make sure every process has the latest.
    499     if is_torch_tpu_available():

File ~/opt/anaconda3/envs/myenv/lib/python3.10/site-packages/transformers/trainer.py:3332, in Trainer.init_git_repo(self, at_init)
   3330 create_repo(repo_name, token=self.args.hub_token, private=self.args.hub_private_repo, exist_ok=True)
   3331 try:
-> 3332     self.repo = Repository(self.args.output_dir, clone_from=repo_name, token=self.args.hub_token)
   3333 except EnvironmentError:
   3334     if self.args.overwrite_output_dir and at_init:
   3335         # Try again after wiping output_dir

File ~/opt/anaconda3/envs/myenv/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py:98, in _deprecate_arguments.<locals>._inner_deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
     96         message += "\n\n" + custom_message
     97     warnings.warn(message, FutureWarning)
---> 98 return f(*args, **kwargs)

TypeError: Repository.__init__() got an unexpected keyword argument 'token'

Framework versions:

  • Transformers 4.26.1
  • Pytorch 1.13.1+cu116
  • Datasets 2.10.1
  • Tokenizers 0.13.2
  • Mac os 13.2.1

Also I tried to upgrade transformers but it didn’t changed the result.

I appreciate any help :pray:

You need the latest of huggingface_hub to fix this error: pip install --upgrade huggingface_hub.

1 Like

Thank you so much :blush: