File size: 1,143 Bytes
acd2c36 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
from huggingface_hub import HfApi, HfFolder
import os
# Save your token
HfFolder.save_token('...')
api = HfApi()
# Local path of the folder containing the model files
local_folder_path = "./Dockerfiles"
# Define the destination path in the repository
repo_id = "NoQuest/LLmSave"
repo_type = "model"
print(f"Uploading {local_folder_path} to {repo_id}...")
# Get a list of files and their sizes
file_sizes = []
for root, _, files in os.walk(local_folder_path):
for file in files:
file_path = os.path.join(root, file)
file_sizes.append((file_path, os.path.getsize(file_path)))
# Sort files by size (smallest to largest)
file_sizes.sort(key=lambda item: item[1])
# Upload files in order of size
for file_path, size in file_sizes:
print(f"Adding file: {file_path} (Size: {size} bytes)")
api.upload_file(
path_or_fileobj=file_path,
path_in_repo=os.path.relpath(file_path, local_folder_path),
repo_id=repo_id,
repo_type=repo_type,
)
print("Upload complete!")
#user@r-noquest-qp-anmixtao-5pisb5tc-14d83-d7h2k:/data$ ls LLmSave/
#Dockerfiles README.md models on_startup.sh
|