CSIGv3_train_script / scripts /download_weights.sh
XenderYang's picture
CSIGv3 AdcSR train scripts + A100 runbook
4811c23 verified
Raw History Blame Contribute Delete
1.74 kB
#!/usr/bin/env bash
# Plan A: 服务器有外网时下载权重(在项目根执行)
# 双方案: 无外网时在本地跑同脚本并把 weight/ 与 models/ 传上来(见 pack_upload)
set -euo pipefail
cd "$(dirname "$0")/.."
export HF_ENDPOINT=https://hf-mirror.com
mkdir -p weight/pretrained models/stable-diffusion-2-1-base weight/gdpo
HF=https://huggingface.co/Guaishou74851/AdcSR/resolve/main
for f in weight/net_params_200.pkl weight/pretrained/DAPE.pth weight/pretrained/halfDecoder.ckpt \
weight/pretrained/osediff.pkl weight/pretrained/ram_swin_large_14m.pth; do
echo "==> $f"; curl -fL --retry 5 --retry-delay 3 -o "$f" "$HF/$f"
done
MS=https://modelscope.cn/models/AI-ModelScope/stable-diffusion-2-1-base/resolve/master
for f in model_index.json feature_extractor/preprocessor_config.json scheduler/scheduler_config.json \
tokenizer/merges.txt tokenizer/special_tokens_map.json tokenizer/tokenizer_config.json \
tokenizer/vocab.json text_encoder/config.json text_encoder/model.fp16.safetensors \
unet/config.json unet/diffusion_pytorch_model.fp16.safetensors \
vae/config.json vae/diffusion_pytorch_model.fp16.safetensors; do
echo "==> $f"; curl -fL --retry 5 --retry-delay 3 --create-dirs -o "models/stable-diffusion-2-1-base/$f" "$MS/$f"
done
# GDPO 教师 (S2 前下载; 失败可 --teacher osediff)
echo "==> GDPO (Joypop/GDPO)"
python - <<'EOF'
import os
try:
from huggingface_hub import snapshot_download
snapshot_download(repo_id="Joypop/GDPO", repo_type="model", local_dir="weight/gdpo", allow_patterns=["ckp/*", "ram/*"])
print("GDPO downloaded")
except Exception as e:
print("GDPO download failed (可回退 osediff):", e)
EOF
du -sh weight models