|
|
|
""" |
|
Script to upload HarpoonNet 1.2 model to Hugging Face Hub |
|
""" |
|
|
|
import os |
|
from huggingface_hub import HfApi, login |
|
import getpass |
|
|
|
def upload_model(): |
|
"""Upload the model to Hugging Face Hub""" |
|
|
|
|
|
print("π Please enter your Hugging Face token:") |
|
print(" (Get it from: https://huggingface.co/settings/tokens)") |
|
token = getpass.getpass("Token: ") |
|
|
|
|
|
try: |
|
login(token=token) |
|
print("β
Successfully logged in to Hugging Face!") |
|
except Exception as e: |
|
print(f"β Login failed: {e}") |
|
return False |
|
|
|
|
|
api = HfApi() |
|
|
|
|
|
repo_id = "christiankhoury05/harpoon-1-2" |
|
|
|
try: |
|
print(f"π Uploading model to {repo_id}...") |
|
|
|
|
|
api.upload_folder( |
|
folder_path=".", |
|
repo_id=repo_id, |
|
repo_type="model", |
|
commit_message="HarpoonNet 1.2 - ConvNeXt-Small Architecture (~50M params) - Fixed Model Upload" |
|
) |
|
|
|
print("β
Model uploaded successfully!") |
|
print(f"π View your model at: https://huggingface.co/{repo_id}") |
|
return True |
|
|
|
except Exception as e: |
|
print(f"β Upload failed: {e}") |
|
return False |
|
|
|
if __name__ == "__main__": |
|
print("π― HarpoonNet 1.2 - Hugging Face Upload Script") |
|
print("=" * 50) |
|
|
|
|
|
if not os.path.exists("pytorch_model.pth"): |
|
print("β Error: pytorch_model.pth not found in current directory") |
|
print(" Please run this script from the hf_upload directory") |
|
exit(1) |
|
|
|
|
|
success = upload_model() |
|
|
|
if success: |
|
print("\nπ Upload completed successfully!") |
|
print("Your HarpoonNet 1.2 model with non-commercial license is now available on Hugging Face!") |
|
print("π Users will see the licensing requirements clearly in the README") |
|
print("π§ Commercial inquiries will be directed to: [email protected]") |
|
else: |
|
print("\nβ Upload failed. Please check your token and try again.") |