CoolFace
Datasetpublic

echodict/llama.cpp

version https://git-lfs.github.com/spec/v1 oid sha256:cfc44b7ba25614df70e6b65e3341cae0310163bd32fd31a6b928a542df433faf size 30786

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes765downloads
hf-upload-gguf-model.py59 linesDownload Raw Back to utils
1#!/usr/bin/env python32 3from huggingface_hub import HfApi4import argparse5import os6 7def upload_gguf_file(local_file_path, repo_id, filename_in_repo=None):8    """9    Upload a GGUF file to a Hugging Face model repository10 11    Args:12        local_file_path: Path to your local GGUF file13        repo_id: Your repository ID (e.g., "username/model-name")14        filename_in_repo: Optional custom name for the file in the repo15    """16 17    if not os.path.exists(local_file_path):18        print(f"โŒ File not found: {local_file_path}")19        return False20 21    if filename_in_repo is None:22        filename_in_repo = os.path.basename(local_file_path)23 24    if filename_in_repo is None or filename_in_repo == "":25        filename_in_repo = os.path.basename(local_file_path)26 27    print(f"๐Ÿ“ค Uploading {local_file_path} to {repo_id}/{filename_in_repo}")28 29    api = HfApi()30 31    try:32        api.upload_file(33            path_or_fileobj=local_file_path,34            path_in_repo=filename_in_repo,35            repo_id=repo_id,36            repo_type="model",37            commit_message=f"Upload {filename_in_repo}"38        )39 40        print("โœ… Upload successful!")41        print(f"๐Ÿ”— File available at: https://huggingface.co/{repo_id}/blob/main/{filename_in_repo}")42        return True43 44    except Exception as e:45        print(f"โŒ Upload failed: {e}")46        return False47 48# This script requires that the environment variable HF_TOKEN is set with your49# 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)59