Page:
Using the AI Tagger Remotely
1
Using the AI Tagger Remotely
Skylar Grant edited this page 2025-01-06 18:35:10 -05:00
This guide will walk you through the process of setting up and using Skier's NSFW AI Tagger on a remote (within the LAN) Windows 11 machine.
You will need 20-30GB+ free on the server machine!!
Anaconda Prep
- Browse to the Anaconda website
- Register (or Skip)
- Scroll down to Miniconda Installers and download the latest graphical installer for Windows
- Launch the installer
- Install to your user only
- ONLY select the option to add it to your
PATH
unless you know what you're doing with the other options
NSFW AI Server Prep
- Download the latest release from the
skier233/nsfw_ai_model_server
releases page - Unzip the file to a noted location (herein
.\model_server
) - Download any models needed from the models table
- Unzip the desired models
- Copy the
models
andconfig
folders from the downloaded model to.\model_server\
, overwriting old config files if needed - Optionally check your
.\model_server\config\config.yaml
file to enable the correct pipelines (see more...) - Launch Windows Terminal and select the Anaconda PowerShell environment
- Navigate to
.\model_server\
and execute.\install.ps1
- Wait. Awhile. If this is your first time there are many large dependencies that need to download.
- If you are using a paid model, you'll be presented with the Patreon login to verify your license
- Eventually you'll be met with:
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
- Ready to go!
Starting the Server Later
- Launch Windows Terminal
- Navigate to
.\model_server
- Run
.\start.ps1
Stash Prep
- Install the plugin (Settings > Plugins > Community)
- Open your Stash's config folder
- Edit
plugins/community/ai_tagger/config.py
- Set
API_BASE_URL
to your Windows 11 machines IP - Adjust performance options as desired
- Adjust tag options as desired
- Set up path mutation (see Storage Prep FMI). Example:
path_mutation = {"/remote-data": "Z:\\porn", "/data", "X:\\porn"}
- Remember to double-escape backslashes!
- Run
pip install -r requirements.txt
within your Stash's environment
- You may need to add
--break-system-packages
if your python environment is managed (eg. in a docker container)
Docker Stash Prep
- Get shell access on your Docker host machine (eg. open Terminal, or use
ssh
) - Launch a shell in the Docker container:
docker exec -it Stash /bin/sh
- Create a new Python virtual environment:
python -m venv /root/.stash/venv
ls -al /root/.stash/venv
- Adjust your in-container path to the config folder if it's different for some reason
- Activate the venv:
source /root/.stash/venv/bin/activate
- You should see the
(venv)
prefix in your shell prompt
- Install the dependencies:
pip install -r /root/.stash/plugins/community/ai_tagger/requirements.txt
- Open Stash > Settings > System
- Edit Python Executable Path:
/root/.stash/venv/bin/python
- Done! Restart the Stash container to double check.
Storage Prep
- Make sure your Stash's library folders are on drive or network share that is also accessible to the Windows machine
- For each Library, mount the share in Windows using Map Network Drive
- For each Library, add an entry like
"/server/path": "<Z>:\\share\\path"
in the Stash Plugin Config