Skip to content

Fix upload_checkpoint.py: explicit HF token and repo_type for upload_folder - #87

Draft
ervinwang-jpg with Copilot wants to merge 6 commits into
qwen80bfrom
copilot/sub-pr-86
Draft

Fix upload_checkpoint.py: explicit HF token and repo_type for upload_folder#87
ervinwang-jpg with Copilot wants to merge 6 commits into
qwen80bfrom
copilot/sub-pr-86

Conversation

Copilot AI commented Mar 11, 2026

Copy link
Copy Markdown

upload_folder was missing repo_type="model" and HfApi was initialized without a token, making the script's behavior dependent on whatever token happened to be cached on disk.

Changes

  • Explicit token resolution: reads from HF_TOKENHUGGING_FACE_HUB_TOKENHUGGINGFACE_HUB_TOKEN and passes it directly to HfApi(token=token)
  • repo_type="model": added to upload_folder to match the existing create_repo call and be consistent with other scripts in the repo
token = (
    os.environ.get("HF_TOKEN")
    or os.environ.get("HUGGING_FACE_HUB_TOKEN")
    or os.environ.get("HUGGINGFACE_HUB_TOKEN")
)
api = HfApi(token=token)
api.create_repo(args.repo_id, repo_type="model", private=True, exist_ok=True)
api.upload_folder(
    repo_id=args.repo_id,
    folder_path=args.checkpoint_dir,
    repo_type="model",
    commit_message=f"Checkpoint {datetime.datetime.utcnow().isoformat()}Z",
)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

pat-baseten and others added 5 commits March 10, 2026 09:09
Fine-tunes Qwen3-4B on pirate-ultrachat-10k using TRL SFTTrainer
with LoRA on a single H100. Matches the getting-started tutorial
at docs.baseten.co/training/getting-started.
…en explicitly to HfApi

Co-authored-by: ervinwang-jpg <241853031+ervinwang-jpg@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback from PR #86 for Qwen80b changes Fix upload_checkpoint.py: explicit HF token and repo_type for upload_folder Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants