Can not push model to hub with push_to_hub=True?

Hello
Today, I try code from this documentation about question answering model Question answering

When I executed the code with push_to_hub=True, I got this error

RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-65682648-0f6437ef1e8f448c2d462727;31099e2d-8d6a-43e7-8d76-dd21ca982590)

Repository Not Found for url: https://huggingface.co/api/models/my_awesome_qa_model.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.

Here is my training args

training_args = TrainingArguments(
    output_dir="./my_awesome_qa_model",
    overwrite_output_dir=True,
    evaluation_strategy="epoch",
    logging_strategy="epoch",
    save_strategy="epoch",
    save_total_limit=5,
    learning_rate=2e-5,
    per_device_train_batch_size=16,
    per_device_eval_batch_size=16,
    num_train_epochs=10,
    weight_decay=0.01,
    push_to_hub=True,
    report_to="wandb",
    load_best_model_at_end=True,
)

Except for some args That I manually added, everything else is the exact same as in the doc.
Why do I get this error?

I never used push_to_hub before. But I think you don’t have a repository.

Make a new one for model.

:wink:

Sadly, I have already done that but no luck. What is the method you normally do??

I just save my model in my local server.
when I use pytorch way, use this one. torch.save(model.state_dict(), self.path)
when I use huggingface api, just model.save_pretrained(self.path)

push_to_hub argument is for sharing.

Maybe this issue?
Seems very similar.

1 Like

Thanks for the information