Push To Hub (Cloud Train) not working!

I am trying to finetune a small language model on A10 Small and directly push it to hub. Now, the actual finetuning takes place in the custom space created by HF but it FAILS to push the model to the hub.

After some debugging, I noticed that it creates the model repo as soon as the finetune job is created and tries to make it once again when it pushes it to the repo leading to a 409. I’ve attached the exact code below.

import os

from autotrain.params import LLMTrainingParams
from autotrain.project import AutoTrainProject

from dotenv import load_dotenv


load_dotenv()
print(f"HF_USERNAME: {os.environ.get('HF_USERNAME')}")
print(f"HF_TOKEN: {os.environ.get('HF_TOKEN')}")

params = LLMTrainingParams(
    model="microsoft/Phi-4-mini-instruct",
    data_path="HuggingFaceH4/no_robots",
    chat_template="tokenizer",
    text_column="messages",
    train_split="train",
    trainer="sft",
    epochs=1,
    batch_size=1,
    lr=1e-5,
    peft=True,
    quantization="int4",
    target_modules="all-linear",
    padding="right",
    optimizer="paged_adamw_8bit",
    scheduler="cosine",
    gradient_accumulation=8,
    mixed_precision="bf16",
    merge_adapter=True,
    project_name="test-train-3-v3",
    push_to_hub=True,
    username=os.environ.get("HF_USERNAME"),
    token=os.environ.get("HF_TOKEN"),
)


backend = "spaces-a10g-small"
project = AutoTrainProject(params=params, backend=backend, process=True)
project.create()

It would be of great help if someone can guide me with this!

1 Like

If updating the library does not fix the problem, it may be a recurrence of a past bug.

pip install --upgrade autotrain-advanced

Thank you. Note that I train the slm on their cloud gpu not locally.

Not sure if that might have anything to do. Will try it out!

1 Like