char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
2758fa10d
char/aliceai-t5-moe
1#!/usr/bin/env python3 2 3from huggingface_hub import HfApi 4import argparse 5import os 6 7def upload_gguf_file (local_file_path ,repo_id ,filename_in_repo = None ): 8""" 9Upload a GGUF file to a Hugging Face model repository 10 11Args: 12local_file_path: Path to your local GGUF file 13repo_id: Your repository ID (e.g., "username/model-name") 14filename_in_repo: Optional custom name for the file in the repo 15""" 16 17if not os .path .exists (local_file_path ): 18f"❌ File not found: { local_file_path } " ) 19return False 20 21if filename_in_repo is None : 22filename_in_repo = os .path .basename (local_file_path ) 23 24if filename_in_repo is None or filename_in_repo == "" : 25filename_in_repo = os .path .basename (local_file_path ) 26 27f"📤 Uploading { local_file_path } to { repo_id } / { filename_in_repo } " ) 28 29api = HfApi () 30 31try : 32api .upload_file ( 33path_or_fileobj = local_file_path , 34path_in_repo = filename_in_repo , 35repo_id = repo_id , 36repo_type = "model" , 37commit_message = f"Upload { filename_in_repo } " 38 ) 39 40"✅ Upload successful!" ) 41f"🔗 File available at: https://huggingface.co/ { repo_id } /blob/main/ { filename_in_repo } " ) 42return True 43 44except Exception as e : 45f"❌ Upload failed: { e } " ) 46return False 47 48# This script requires that the environment variable HF_TOKEN is set with your 49# Hugging Face API token. 50api = HfApi () 51 52parser = argparse .ArgumentParser (description = 'Upload a GGUF model to a Huggingface model repository' ) 53parser .add_argument ('--gguf-model-path' ,'-m' ,help = 'The GGUF model file to upload' ,required = True ) 54parser .add_argument ('--repo-id' ,'-r' ,help = 'The repository to upload to' ,required = True ) 55parser .add_argument ('--name' ,'-o' ,help = 'The name in the model repository' ,required = False ) 56args = parser .parse_args () 57 58upload_gguf_file (args .gguf_model_path ,args .repo_id ,args .name )