from huggingface_hub import HfApi from pathlib import Path # Define the parameters for uploading repo_id = "DBMe/Llama-3.1-Nemotron-70B-Instruct-HF-4.6bpw-h6-exl2" # Replace with your actual repo ID folder_path = "/home/asusws-x570-ace/programs/tabbyAPI/models/Llama-3.1-Nemotron-70B-Instruct-HF_exl2_4.6bpw/" # Replace with your folder path repo_type = "model" # Change to "model" or "space" if applicable revision = "main" # Optional: specify the branch or use "main" private = False # Set to True if the repository should be private allow_patterns = None # Optional: specify patterns of files to include ignore_patterns = None # Optional: specify patterns of files to exclude num_workers = 1 # Set based on your system; lower if your internet is unstable print_report = True # Enable progress reporting print_report_every = 60 # Report frequency in seconds # Initialize the Hugging Face API client api = HfApi() # Function to upload the folder in a resumable manner def upload_resumable(): try: print("Starting upload process...") # Perform the upload with the provided parameters api.upload_large_folder( repo_id=repo_id, folder_path=Path(folder_path), repo_type=repo_type, revision=revision, private=private, allow_patterns=allow_patterns, ignore_patterns=ignore_patterns, num_workers=num_workers, print_report=print_report, print_report_every=print_report_every, ) print("Upload completed successfully!") except Exception as e: print(f"Upload interrupted due to error: {e}") print("You can resume the upload by running the script again.") # Call the function to start the upload upload_resumable()