File size: 654 Bytes
20145da | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #!/usr/bin/env bash
set -euo pipefail
OUTPUT_DIR="${OUTPUT_DIR:-/workspace/output}"
USE_HF="${USE_HF:-true}"
CHECKPOINT=$(ls -td "${OUTPUT_DIR}"/v*-*/checkpoint-* 2>/dev/null | head -1)
if [ -z "${CHECKPOINT}" ]; then
echo "Error: No checkpoint found in ${OUTPUT_DIR}"
echo "Train the model first with: bash /opt/scripts/train.sh"
exit 1
fi
echo "============================================"
echo " Inference with checkpoint: ${CHECKPOINT}"
echo "============================================"
swift infer \
--adapters "${CHECKPOINT}" \
--stream true \
--temperature 0 \
--max_new_tokens 2048 \
--use_hf "${USE_HF}"
|