Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files- rewrite_yamls.py +41 -0
rewrite_yamls.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import glob
|
| 3 |
+
|
| 4 |
+
# The valid template for our models
|
| 5 |
+
template = """name: {name}
|
| 6 |
+
label: {label}
|
| 7 |
+
status: active
|
| 8 |
+
input_types:
|
| 9 |
+
- text/plain
|
| 10 |
+
output_types:
|
| 11 |
+
- text/plain
|
| 12 |
+
context_size: {context_size}
|
| 13 |
+
output_size: 4096
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
# define context sizes we researched
|
| 17 |
+
model_info = {
|
| 18 |
+
"llama3-70b.yaml": ("llama3-70b", "Llama 3 70B", 8192),
|
| 19 |
+
"claude-3-haiku.yaml": ("anthropic/claude-3-haiku", "Claude 3 Haiku", 200000),
|
| 20 |
+
"meta-llama3-70b-instruct.yaml": ("meta/llama3-70b-instruct", "Llama 3 70B Instruct", 8192),
|
| 21 |
+
"minimaxai-minimax-m3.yaml": ("minimaxai/minimax-m3", "Minimax M3", 1000000),
|
| 22 |
+
"deepseek-ai-deepseek-v4-flash.yaml": ("deepseek-ai/deepseek-v4-flash", "DeepSeek v4 Flash", 1000000),
|
| 23 |
+
"deepseek-ai-deepseek-v4-pro.yaml": ("deepseek-ai/deepseek-v4-pro", "DeepSeek v4 Pro", 1000000),
|
| 24 |
+
"minimaxai-minimax-m2.7.yaml": ("minimaxai/minimax-m2.7", "Minimax M2.7", 204800),
|
| 25 |
+
"nvidia-nemotron-3-ultra-550b-a55b.yaml": ("nvidia/nemotron-3-ultra-550b-a55b", "Nemotron-3 Ultra 550B", 1000000),
|
| 26 |
+
"stepfun-ai-step-3.7-flash.yaml": ("stepfun-ai/step-3.7-flash", "Step-3.7 Flash", 256000),
|
| 27 |
+
"qwen-qwen3.5-397b-a17b.yaml": ("qwen/qwen3.5-397b-a17b", "Qwen 3.5 397B", 262144),
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
base_path = "c:/Users/LOQ/OneDrive/Desktop/agentscope/src/agentscope/model/"
|
| 31 |
+
|
| 32 |
+
for folder in ["_groq", "_openrouter", "_nvidia_nim"]:
|
| 33 |
+
folder_path = os.path.join(base_path, folder, "_models")
|
| 34 |
+
if os.path.exists(folder_path):
|
| 35 |
+
for file in os.listdir(folder_path):
|
| 36 |
+
if file in model_info:
|
| 37 |
+
name, label, context = model_info[file]
|
| 38 |
+
content = template.format(name=name, label=label, context_size=context)
|
| 39 |
+
with open(os.path.join(folder_path, file), "w", encoding="utf-8") as f:
|
| 40 |
+
f.write(content)
|
| 41 |
+
print(f"Updated {file}")
|