File size: 966 Bytes
036ce9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""将本目录模型上传到 Hugging Face(需已 huggingface-cli login 或设置 HF_TOKEN)。"""
from pathlib import Path

from huggingface_hub import HfApi

REPO_ID = "WhateverBlue/Qwen2.5-VL-3B-remember"
LOCAL_DIR = Path(__file__).resolve().parent

# 本地上传工具残留,不必进仓库
IGNORE = [
    "upload_to_hf_hub.py",
    ".msc",
    ".mv",
    "._____temp",
    "._____temp/**",
    "**/.git/**",
]


def main() -> None:
    api = HfApi()
    api.create_repo(repo_id=REPO_ID, repo_type="model", exist_ok=True)
    print(f"Uploading {LOCAL_DIR} -> {REPO_ID} (model repo, ~7GB, 请耐心等待)…")
    api.upload_folder(
        folder_path=str(LOCAL_DIR),
        repo_id=REPO_ID,
        repo_type="model",
        ignore_patterns=IGNORE,
        commit_message="Upload Qwen2.5-VL-3B-remember weights and tokenizer",
    )
    print(f"完成: https://huggingface.co/{REPO_ID}")


if __name__ == "__main__":
    main()