mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-29 03:33:20 +01:00
Changes to make things work on MacOS/x64
This commit is contained in:
parent
6ab3133b33
commit
8465bc1bc9
@ -58,7 +58,7 @@ if [ "$PACKAGES_TO_INSTALL" != "" ]; then
|
|||||||
echo "Downloading micromamba from $MICROMAMBA_DOWNLOAD_URL to $MAMBA_ROOT_PREFIX/micromamba"
|
echo "Downloading micromamba from $MICROMAMBA_DOWNLOAD_URL to $MAMBA_ROOT_PREFIX/micromamba"
|
||||||
|
|
||||||
mkdir -p "$MAMBA_ROOT_PREFIX"
|
mkdir -p "$MAMBA_ROOT_PREFIX"
|
||||||
curl -L "$MICROMAMBA_DOWNLOAD_URL" | tar -xvj bin/micromamba -O > "$MAMBA_ROOT_PREFIX/micromamba"
|
curl -L "$MICROMAMBA_DOWNLOAD_URL" | tar -xvj -O bin/micromamba > "$MAMBA_ROOT_PREFIX/micromamba"
|
||||||
|
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo
|
echo
|
||||||
|
@ -28,5 +28,12 @@ EOF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filesize() {
|
||||||
|
case "$(uname -s)" in
|
||||||
|
Linux*) stat -c "%s" $1;;
|
||||||
|
Darwin*) stat -f "%z" $1;;
|
||||||
|
*) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "../models/stable-diffusion/sd-v1-4.ckpt" ]; then
|
if [ -f "../models/stable-diffusion/sd-v1-4.ckpt" ]; then
|
||||||
model_size=`find "../models/stable-diffusion/sd-v1-4.ckpt" -printf "%s"`
|
model_size=`filesize "../models/stable-diffusion/sd-v1-4.ckpt"`
|
||||||
|
|
||||||
if [ "$model_size" -eq "4265380512" ] || [ "$model_size" -eq "7703807346" ] || [ "$model_size" -eq "7703810927" ]; then
|
if [ "$model_size" -eq "4265380512" ] || [ "$model_size" -eq "7703807346" ] || [ "$model_size" -eq "7703810927" ]; then
|
||||||
echo "Data files (weights) necessary for Stable Diffusion were already downloaded"
|
echo "Data files (weights) necessary for Stable Diffusion were already downloaded"
|
||||||
@ -153,7 +153,7 @@ if [ ! -f "../models/stable-diffusion/sd-v1-4.ckpt" ]; then
|
|||||||
curl -L -k https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt > ../models/stable-diffusion/sd-v1-4.ckpt
|
curl -L -k https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt > ../models/stable-diffusion/sd-v1-4.ckpt
|
||||||
|
|
||||||
if [ -f "../models/stable-diffusion/sd-v1-4.ckpt" ]; then
|
if [ -f "../models/stable-diffusion/sd-v1-4.ckpt" ]; then
|
||||||
model_size=`find "../models/stable-diffusion/sd-v1-4.ckpt" -printf "%s"`
|
model_size=`filesize "../models/stable-diffusion/sd-v1-4.ckpt"`
|
||||||
if [ ! "$model_size" == "4265380512" ]; then
|
if [ ! "$model_size" == "4265380512" ]; then
|
||||||
fail "The downloaded model file was invalid! Bytes downloaded: $model_size"
|
fail "The downloaded model file was invalid! Bytes downloaded: $model_size"
|
||||||
fi
|
fi
|
||||||
@ -164,7 +164,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if [ -f "../models/gfpgan/GFPGANv1.3.pth" ]; then
|
if [ -f "../models/gfpgan/GFPGANv1.3.pth" ]; then
|
||||||
model_size=`find "../models/gfpgan/GFPGANv1.3.pth" -printf "%s"`
|
model_size=`filesize "../models/gfpgan/GFPGANv1.3.pth"`
|
||||||
|
|
||||||
if [ "$model_size" -eq "348632874" ]; then
|
if [ "$model_size" -eq "348632874" ]; then
|
||||||
echo "Data files (weights) necessary for GFPGAN (Face Correction) were already downloaded"
|
echo "Data files (weights) necessary for GFPGAN (Face Correction) were already downloaded"
|
||||||
@ -180,7 +180,7 @@ if [ ! -f "../models/gfpgan/GFPGANv1.3.pth" ]; then
|
|||||||
curl -L -k https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth > ../models/gfpgan/GFPGANv1.3.pth
|
curl -L -k https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth > ../models/gfpgan/GFPGANv1.3.pth
|
||||||
|
|
||||||
if [ -f "../models/gfpgan/GFPGANv1.3.pth" ]; then
|
if [ -f "../models/gfpgan/GFPGANv1.3.pth" ]; then
|
||||||
model_size=`find "../models/gfpgan/GFPGANv1.3.pth" -printf "%s"`
|
model_size=`filesize "../models/gfpgan/GFPGANv1.3.pth"`
|
||||||
if [ ! "$model_size" -eq "348632874" ]; then
|
if [ ! "$model_size" -eq "348632874" ]; then
|
||||||
fail "The downloaded GFPGAN model file was invalid! Bytes downloaded: $model_size"
|
fail "The downloaded GFPGAN model file was invalid! Bytes downloaded: $model_size"
|
||||||
fi
|
fi
|
||||||
@ -191,7 +191,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if [ -f "../models/realesrgan/RealESRGAN_x4plus.pth" ]; then
|
if [ -f "../models/realesrgan/RealESRGAN_x4plus.pth" ]; then
|
||||||
model_size=`find "../models/realesrgan/RealESRGAN_x4plus.pth" -printf "%s"`
|
model_size=`filesize "../models/realesrgan/RealESRGAN_x4plus.pth"`
|
||||||
|
|
||||||
if [ "$model_size" -eq "67040989" ]; then
|
if [ "$model_size" -eq "67040989" ]; then
|
||||||
echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus were already downloaded"
|
echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus were already downloaded"
|
||||||
@ -207,7 +207,7 @@ if [ ! -f "../models/realesrgan/RealESRGAN_x4plus.pth" ]; then
|
|||||||
curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth > ../models/realesrgan/RealESRGAN_x4plus.pth
|
curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth > ../models/realesrgan/RealESRGAN_x4plus.pth
|
||||||
|
|
||||||
if [ -f "../models/realesrgan/RealESRGAN_x4plus.pth" ]; then
|
if [ -f "../models/realesrgan/RealESRGAN_x4plus.pth" ]; then
|
||||||
model_size=`find "../models/realesrgan/RealESRGAN_x4plus.pth" -printf "%s"`
|
model_size=`filesize "../models/realesrgan/RealESRGAN_x4plus.pth"`
|
||||||
if [ ! "$model_size" -eq "67040989" ]; then
|
if [ ! "$model_size" -eq "67040989" ]; then
|
||||||
fail "The downloaded ESRGAN x4plus model file was invalid! Bytes downloaded: $model_size"
|
fail "The downloaded ESRGAN x4plus model file was invalid! Bytes downloaded: $model_size"
|
||||||
fi
|
fi
|
||||||
@ -218,7 +218,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if [ -f "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" ]; then
|
if [ -f "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" ]; then
|
||||||
model_size=`find "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" -printf "%s"`
|
model_size=`filesize "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth"`
|
||||||
|
|
||||||
if [ "$model_size" -eq "17938799" ]; then
|
if [ "$model_size" -eq "17938799" ]; then
|
||||||
echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus_anime were already downloaded"
|
echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus_anime were already downloaded"
|
||||||
@ -234,7 +234,7 @@ if [ ! -f "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" ]; then
|
|||||||
curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth > ../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth
|
curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth > ../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth
|
||||||
|
|
||||||
if [ -f "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" ]; then
|
if [ -f "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" ]; then
|
||||||
model_size=`find "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" -printf "%s"`
|
model_size=`filesize "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth"`
|
||||||
if [ ! "$model_size" -eq "17938799" ]; then
|
if [ ! "$model_size" -eq "17938799" ]; then
|
||||||
fail "The downloaded ESRGAN x4plus_anime model file was invalid! Bytes downloaded: $model_size"
|
fail "The downloaded ESRGAN x4plus_anime model file was invalid! Bytes downloaded: $model_size"
|
||||||
fi
|
fi
|
||||||
@ -245,7 +245,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if [ -f "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt" ]; then
|
if [ -f "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt" ]; then
|
||||||
model_size=`find ../models/vae/vae-ft-mse-840000-ema-pruned.ckpt -printf "%s"`
|
model_size=`filesize "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt"`
|
||||||
|
|
||||||
if [ "$model_size" -eq "334695179" ]; then
|
if [ "$model_size" -eq "334695179" ]; then
|
||||||
echo "Data files (weights) necessary for the default VAE (sd-vae-ft-mse-original) were already downloaded"
|
echo "Data files (weights) necessary for the default VAE (sd-vae-ft-mse-original) were already downloaded"
|
||||||
@ -261,7 +261,7 @@ if [ ! -f "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt" ]; then
|
|||||||
curl -L -k https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt > ../models/vae/vae-ft-mse-840000-ema-pruned.ckpt
|
curl -L -k https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt > ../models/vae/vae-ft-mse-840000-ema-pruned.ckpt
|
||||||
|
|
||||||
if [ -f "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt" ]; then
|
if [ -f "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt" ]; then
|
||||||
model_size=`find ../models/vae/vae-ft-mse-840000-ema-pruned.ckpt -printf "%s"`
|
model_size=`filesize "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt"`
|
||||||
if [ ! "$model_size" -eq "334695179" ]; then
|
if [ ! "$model_size" -eq "334695179" ]; then
|
||||||
printf "\n\nError: The downloaded default VAE (sd-vae-ft-mse-original) file was invalid! Bytes downloaded: $model_size\n\n"
|
printf "\n\nError: The downloaded default VAE (sd-vae-ft-mse-original) file was invalid! Bytes downloaded: $model_size\n\n"
|
||||||
printf "\n\nError downloading the data files (weights) for the default VAE (sd-vae-ft-mse-original). Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
|
printf "\n\nError downloading the data files (weights) for the default VAE (sd-vae-ft-mse-original). Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
|
||||||
|
@ -45,7 +45,7 @@ APP_CONFIG_DEFAULTS = {
|
|||||||
'update_branch': 'main',
|
'update_branch': 'main',
|
||||||
'ui': {
|
'ui': {
|
||||||
'open_browser_on_start': True,
|
'open_browser_on_start': True,
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
@ -57,16 +57,21 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS):
|
|||||||
try:
|
try:
|
||||||
config_json_path = os.path.join(CONFIG_DIR, 'config.json')
|
config_json_path = os.path.join(CONFIG_DIR, 'config.json')
|
||||||
if not os.path.exists(config_json_path):
|
if not os.path.exists(config_json_path):
|
||||||
return default_val
|
config = default_val
|
||||||
with open(config_json_path, 'r', encoding='utf-8') as f:
|
else:
|
||||||
config = json.load(f)
|
with open(config_json_path, 'r', encoding='utf-8') as f:
|
||||||
if 'net' not in config:
|
config = json.load(f)
|
||||||
config['net'] = {}
|
if 'net' not in config:
|
||||||
if os.getenv('SD_UI_BIND_PORT') is not None:
|
config['net'] = {}
|
||||||
config['net']['listen_port'] = int(os.getenv('SD_UI_BIND_PORT'))
|
if os.getenv('SD_UI_BIND_PORT') is not None:
|
||||||
if os.getenv('SD_UI_BIND_IP') is not None:
|
config['net']['listen_port'] = int(os.getenv('SD_UI_BIND_PORT'))
|
||||||
config['net']['listen_to_network'] = (os.getenv('SD_UI_BIND_IP') == '0.0.0.0')
|
else:
|
||||||
return config
|
config['net']['listen_port'] = 9000
|
||||||
|
if os.getenv('SD_UI_BIND_IP') is not None:
|
||||||
|
config['net']['listen_to_network'] = (os.getenv('SD_UI_BIND_IP') == '0.0.0.0')
|
||||||
|
else:
|
||||||
|
config['net']['listen_to_network'] = True
|
||||||
|
return config
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warn(traceback.format_exc())
|
log.warn(traceback.format_exc())
|
||||||
return default_val
|
return default_val
|
||||||
|
Loading…
Reference in New Issue
Block a user