adaptai / platform /aiml /mlops /scripts /promote_checkpoint.sh
ADAPT-Chase's picture
Add files using upload-large-folder tool
93be2a2 verified
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <src_checkpoint_dir> <dest_model_dir>" >&2
exit 1
fi
SRC="$1"
DEST="$2"
echo "[promote] Validating source: $SRC"
for f in model-00001-of-00004.safetensors model-00002-of-00004.safetensors model-00003-of-00004.safetensors model-00004-of-00004.safetensors config.json tokenizer.json tokenizer_config.json merges.txt vocab.json added_tokens.json model.safetensors.index.json; do
if [ ! -f "$SRC/$f" ]; then
echo "[promote] Missing $f in $SRC" >&2
exit 2
fi
done
ts=$(date +%F_%H-%M-%S)
backup="${DEST}.bak_${ts}"
echo "[promote] Backing up $DEST -> $backup"
cp -a "$DEST" "$backup"
echo "[promote] Copying new weights"
rsync -a --delete "$SRC/" "$DEST/"
echo "[promote] Promotion complete"