DBMe's picture
Add files using upload-large-folder tool
7f77f88 verified
from huggingface_hub import HfApi
from pathlib import Path
# Define the parameters for uploading
repo_id = "DBMe/Mistral-Large-Instruct-2407-2.85bpw-h6-exl2" # Replace with your actual repo ID
folder_path = "/home/asusws-x570-ace/programs/tabbyAPI-new/models/Mistral-Large-Instruct-2407_exl2_2.85bpw/" # 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 = 4 # 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()