mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
Update load_fsdp_to_hf.py
This commit is contained in:
parent
3393d22611
commit
62887ad1fc
1 changed files with 0 additions and 21 deletions
|
|
@ -32,27 +32,6 @@ def main(fsdp_checkpoint_path, huggingface_model_path, output_path, push_to_hub=
|
|||
tokenizer = AutoTokenizer.from_pretrained(huggingface_model_path)
|
||||
tokenizer.save_pretrained(output_path)
|
||||
|
||||
# Push to hub if requested
|
||||
if push_to_hub:
|
||||
if not output_path:
|
||||
raise ValueError("output path must be provided when push_to_hub=True")
|
||||
|
||||
print(f"Pushing model to Hugging Face Hub: {output_path}")
|
||||
|
||||
# Create repository if it doesn't exist
|
||||
api = HfApi(token=hub_token)
|
||||
try:
|
||||
create_repo(repo_id=output_path, private=private, exist_ok=True, token=hub_token)
|
||||
print(f"Repository {output_path} created or already exists")
|
||||
except Exception as e:
|
||||
print(f"Repository creation info: {e}")
|
||||
|
||||
# Push model and tokenizer to hub
|
||||
model.push_to_hub(output_path, token=hub_token, private=private)
|
||||
tokenizer.push_to_hub(output_path, token=hub_token, private=private)
|
||||
|
||||
print(f"✅ Model successfully pushed to https://huggingface.co/{output_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
fire.Fire(main)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue