showhandshowhand's picture
Uploading model files
259f28d verified
raw
history blame
858 Bytes
import json
import sys
import os
# 要删除的字段
fields_to_remove = [
"corda_config",
"eva_config",
"exclude_modules",
"trainable_token_indices",
"lora_bias"
]
def clean_config(file_path):
if not os.path.exists(file_path):
print(f"❌ 文件不存在: {file_path}")
return
with open(file_path, "r", encoding="utf-8") as f:
config = json.load(f)
for field in fields_to_remove:
config.pop(field, None)
with open(file_path, "w", encoding="utf-8") as f:
json.dump(config, f, indent=2, ensure_ascii=False)
print(f"✅ 已清理并保存: {file_path}")
if __name__ == "__main__":
if len(sys.argv) < 2:
print("用法: python clean_adapter_config.py <路径/adapter_config.json>")
sys.exit(1)
config_path = sys.argv[1]
clean_config(config_path)