Skip to content

Instantly share code, notes, and snippets.

@regiellis
Created June 7, 2024 14:23
Show Gist options
  • Save regiellis/44989e4446aebea39e724c6204904e74 to your computer and use it in GitHub Desktop.
Save regiellis/44989e4446aebea39e724c6204904e74 to your computer and use it in GitHub Desktop.
Invoke Service
#!/bin/bash
set -eu
# Ensure we're in the correct folder in case user's CWD is somewhere else
scriptdir=$(dirname "$0")
cd "$scriptdir"
. .venv/bin/activate
export INVOKEAI_ROOT="$scriptdir"
# Stash the CLI args - when we prompt for user input, `$@` is overwritten
PARAMS=$@
# This setting allows torch to fall back to CPU for operations that are not supported by MPS on macOS.
if [ "$(uname -s)" == "Darwin" ]; then
export PYTORCH_ENABLE_MPS_FALLBACK=1
fi
invokeai-web
[Unit]
Description=Invoke script
After=network.target
[Service]
User=playlogic
ExecStart=/mnt/Hub/AI/INVOKEAI/invoke-web.sh # make sure to update this with your path
Restart=on-success
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment