Fine-tune a model on translation:

when passing all along with datasets to the Seq2SeqTrainercall I got :
HTTPError: 400 Client Error: Bad Request for url: https://huggingface.co/api/repos/create - Only regular characters and ‘-’, ‘_’, ‘.’ accepted

You should post relevant code when asking for help, otherwise no one can really understand what’s going on. In this instance, the problem is very likely when your define your Seq2SeqTrainingArguments, so please share how you defined those, or if you used your code as a script, what arguments you passed to it,

1 Like

Hi sgugger, Thanks for the advice, I just tried the same code from How to fine-tune a model on translation

model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)

batch_size = 16

args = Seq2SeqTrainingArguments(

    "test-translation",

    evaluation_strategy = "epoch",

    learning_rate=2e-5,

    per_device_train_batch_size=batch_size,

    per_device_eval_batch_size=batch_size,

    weight_decay=0.01,

    save_total_limit=3,

    num_train_epochs=1,

    predict_with_generate=True,

    fp16=True,

    push_to_hub=True,

    push_to_hub_model_id=f"{model_checkpoint}-finetuned-{source_lang}-to-{target_lang}",

)
data_collator = DataCollatorForSeq2Seq(tokenizer, model=model)

trainer = Seq2SeqTrainer(

    model,

    args,

    train_dataset=tokenized_datasets["train"],

    eval_dataset=tokenized_datasets["validation"],

    data_collator=data_collator,

    tokenizer=tokenizer,

    compute_metrics=compute_metrics

)

Once interpreted, what is the value of f"{model_checkpoint}-finetuned-{source_lang}-to-{target_lang}"? Apparently since there is some special character in it according to the error message.

The value is:
Helsinki-NLP/opus-mt-en-ro-finetuned-en-to-ro

Ah yes, the / is not going to work. You should remove it or replace it by a /. Will adapt the notebooks next week!

Thanks a lot :bouquet: :bouquet: :bouquet: