1
0
Fork 0
scripts/stable-diffusion/download_temp_model.sh

44 lines
788 B
Bash

#!/bin/bash
set -e
set -o nounset
set -o pipefail
model_addr="$1"
model_type="$2"
sd_root="/notebooks/automatic/"
case "${model_type}" in
"lora")
tmpdir="/tmp/lora"
dest="${sd_root}/models/Lora/"
;;
"ckpt")
tmpdir="/tmp/models"
dest="${sd_root}/models/Stable-diffusion/"
;;
"lycoris")
tmpdir="/tmp/models"
dest="${sd_root}/models/LyCORIS/"
;;
*)
echo "Unknown model type."
exit 1
;;
esac
mkdir -p "${tmpdir}"
cd "${tmpdir}"
modelfile="$(curl -O -J -L --remote-name -s \
-w "%{filename_effective}" "${model_addr}")"
echo "Downloaded ${modelfile}"
fullpath=$(realpath "${modelfile}")
echo "Linking ${modelfile} to ${dest}..."
pushd "$dest"
ln -s "$fullpath" .
popd