Upload folder using huggingface_hub
Browse files- embedders/chinese-hubert-base/hifigan-nsf/f0D48k.pth +3 -0
- embedders/chinese-hubert-base/hifigan-nsf/f0G48k.pth +3 -0
- embedders/contentvec/sifigan/f0D48k.pth +3 -0
- embedders/contentvec/sifigan/f0G48k.pth +3 -0
- embedders/spin/sifigan/f0D48k.pth +3 -0
- embedders/spin/sifigan/f0G48k.pth +3 -0
- upload.py +131 -0
embedders/chinese-hubert-base/hifigan-nsf/f0D48k.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2a9410083f8dbab4d886f4aaaaf09db0cfa069009b008d15fbb83c2d4c9bfb01
|
| 3 |
+
size 285696040
|
embedders/chinese-hubert-base/hifigan-nsf/f0G48k.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9534f60010c4db7ceb9d3f02ea1c065d2101bfed6c830be633114a8794aa5916
|
| 3 |
+
size 150735634
|
embedders/contentvec/sifigan/f0D48k.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:112782860a879cfa859e3ac44c0c6edead7f338bc2890d96e90270103032b65c
|
| 3 |
+
size 285691018
|
embedders/contentvec/sifigan/f0G48k.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2fe340981cbd32ab1a95d395bd9a0c3c16887bb525c84120f0993de3c817bb80
|
| 3 |
+
size 171331737
|
embedders/spin/sifigan/f0D48k.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6bbc8d5cf0f682c62f276cd921946d05493af13b49c51a0a4e6c4df075eaf85c
|
| 3 |
+
size 285690687
|
embedders/spin/sifigan/f0G48k.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d93e3661ba24da0a18ce080de09b8bc59d856aab4875021be51f50bbc33a0562
|
| 3 |
+
size 171331342
|
upload.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import time
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
# 如果使用本地HF镜像,取消注释下面这行
|
| 6 |
+
# os.environ["HF_ENDPOINT"] = "http://localhost:5564"
|
| 7 |
+
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
| 8 |
+
|
| 9 |
+
from huggingface_hub import HfApi, logging
|
| 10 |
+
|
| 11 |
+
# 配置
|
| 12 |
+
REPO_ID = "PluginsKers/Convbased-Studio" # 请修改为您的仓库ID
|
| 13 |
+
REPO_TYPE = "model"
|
| 14 |
+
COMMIT_MESSAGE = "Upload Convbased Studio models and assets"
|
| 15 |
+
|
| 16 |
+
# 设置日志级别
|
| 17 |
+
logging.set_verbosity_info()
|
| 18 |
+
hf = HfApi()
|
| 19 |
+
|
| 20 |
+
def upload_file_with_retry(file_path, repo_path, max_retries=3):
|
| 21 |
+
"""带重试功能的文件上传"""
|
| 22 |
+
for attempt in range(max_retries):
|
| 23 |
+
try:
|
| 24 |
+
print(f"上传文件 {file_path} -> {repo_path} (尝试 {attempt + 1}/{max_retries})")
|
| 25 |
+
result = hf.upload_file(
|
| 26 |
+
path_or_fileobj=str(file_path),
|
| 27 |
+
path_in_repo=repo_path,
|
| 28 |
+
repo_id=REPO_ID,
|
| 29 |
+
repo_type=REPO_TYPE,
|
| 30 |
+
commit_message=f"{COMMIT_MESSAGE}: {repo_path}"
|
| 31 |
+
)
|
| 32 |
+
print(f"✅ 成功上传: {repo_path}")
|
| 33 |
+
return result
|
| 34 |
+
except Exception as e:
|
| 35 |
+
print(f"❌ 上传失败 (尝试 {attempt + 1}): {e}")
|
| 36 |
+
if attempt < max_retries - 1:
|
| 37 |
+
time.sleep(5) # 等待5秒后重试
|
| 38 |
+
else:
|
| 39 |
+
print(f"❌ 文件 {file_path} 上传最终失败")
|
| 40 |
+
raise e
|
| 41 |
+
|
| 42 |
+
def main():
|
| 43 |
+
"""主上传函数"""
|
| 44 |
+
project_root = Path(".")
|
| 45 |
+
|
| 46 |
+
print("🚀 开始上传 Convbased Studio 项目到 HuggingFace Hub")
|
| 47 |
+
print(f"📁 项目目录: {project_root.absolute()}")
|
| 48 |
+
print(f"🎯 目标仓库: {REPO_ID}")
|
| 49 |
+
print("-" * 50)
|
| 50 |
+
|
| 51 |
+
# 要上传的文件列表
|
| 52 |
+
files_to_upload = []
|
| 53 |
+
|
| 54 |
+
# 1. 添加 README.md
|
| 55 |
+
readme_path = project_root / "README.md"
|
| 56 |
+
if readme_path.exists():
|
| 57 |
+
files_to_upload.append((readme_path, "README.md"))
|
| 58 |
+
|
| 59 |
+
# 2. 添加主模型压缩包
|
| 60 |
+
archive_path = project_root / "RVC1006Nvidia_Convbased_0611.7z"
|
| 61 |
+
if archive_path.exists():
|
| 62 |
+
files_to_upload.append((archive_path, "RVC1006Nvidia_Convbased_0611.7z"))
|
| 63 |
+
|
| 64 |
+
# 3. 递归添加 embedders 目录下的所有文件
|
| 65 |
+
embedders_dir = project_root / "embedders"
|
| 66 |
+
if embedders_dir.exists():
|
| 67 |
+
for file_path in embedders_dir.rglob("*"):
|
| 68 |
+
if file_path.is_file():
|
| 69 |
+
# 计算相对路径
|
| 70 |
+
relative_path = file_path.relative_to(project_root)
|
| 71 |
+
files_to_upload.append((file_path, str(relative_path).replace("\\", "/")))
|
| 72 |
+
|
| 73 |
+
# 4. 添加 assets 目录下的文件(如果存在)
|
| 74 |
+
assets_dir = project_root / "assets"
|
| 75 |
+
if assets_dir.exists():
|
| 76 |
+
for file_path in assets_dir.rglob("*"):
|
| 77 |
+
if file_path.is_file():
|
| 78 |
+
relative_path = file_path.relative_to(project_root)
|
| 79 |
+
files_to_upload.append((file_path, str(relative_path).replace("\\", "/")))
|
| 80 |
+
|
| 81 |
+
print(f"📋 发现 {len(files_to_upload)} 个文件待上传:")
|
| 82 |
+
for i, (file_path, repo_path) in enumerate(files_to_upload, 1):
|
| 83 |
+
file_size = file_path.stat().st_size / (1024 * 1024) # MB
|
| 84 |
+
print(f" {i:2d}. {repo_path} ({file_size:.1f} MB)")
|
| 85 |
+
|
| 86 |
+
print("-" * 50)
|
| 87 |
+
|
| 88 |
+
# 按文件大小排序,先上传小文件
|
| 89 |
+
files_to_upload.sort(key=lambda x: x[0].stat().st_size)
|
| 90 |
+
|
| 91 |
+
success_count = 0
|
| 92 |
+
failed_files = []
|
| 93 |
+
|
| 94 |
+
for i, (file_path, repo_path) in enumerate(files_to_upload, 1):
|
| 95 |
+
try:
|
| 96 |
+
print(f"\n📤 [{i}/{len(files_to_upload)}] 上传文件...")
|
| 97 |
+
upload_file_with_retry(file_path, repo_path)
|
| 98 |
+
success_count += 1
|
| 99 |
+
except Exception as e:
|
| 100 |
+
failed_files.append((file_path, repo_path, str(e)))
|
| 101 |
+
print(f"❌ 跳过文件: {repo_path}")
|
| 102 |
+
|
| 103 |
+
# 上传结果统计
|
| 104 |
+
print("\n" + "=" * 50)
|
| 105 |
+
print("📊 上传结果统计:")
|
| 106 |
+
print(f"✅ 成功上传: {success_count} 个文件")
|
| 107 |
+
print(f"❌ 失败文件: {len(failed_files)} 个文件")
|
| 108 |
+
|
| 109 |
+
if failed_files:
|
| 110 |
+
print("\n❌ 失败文件列表:")
|
| 111 |
+
for file_path, repo_path, error in failed_files:
|
| 112 |
+
print(f" - {repo_path}: {error}")
|
| 113 |
+
|
| 114 |
+
if success_count > 0:
|
| 115 |
+
print(f"\n🎉 项目已成功上传到: https://huggingface.co/{REPO_ID}")
|
| 116 |
+
|
| 117 |
+
print("=" * 50)
|
| 118 |
+
|
| 119 |
+
if __name__ == "__main__":
|
| 120 |
+
# 检查是否需要修改仓库ID
|
| 121 |
+
if REPO_ID == "your-username/convbased-studio":
|
| 122 |
+
print("⚠️ 请先修改脚本中的 REPO_ID 变量为您的实际仓库ID")
|
| 123 |
+
print(" 例如: 'your-username/convbased-studio'")
|
| 124 |
+
input(" 修改完成后按回车键继续...")
|
| 125 |
+
|
| 126 |
+
try:
|
| 127 |
+
main()
|
| 128 |
+
except KeyboardInterrupt:
|
| 129 |
+
print("\n\n⏹️ 用户中断上传")
|
| 130 |
+
except Exception as e:
|
| 131 |
+
print(f"\n\n💥 发生未预期的错误: {e}")
|