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

  1. Browse to the Anaconda website
  2. Register (or Skip)
  3. Scroll down to Miniconda Installers and download the latest graphical installer for Windows
  4. Launch the installer
  5. Install to your user only
  6. 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

  1. Download the latest release from the skier233/nsfw_ai_model_server releases page
  2. Unzip the file to a noted location (herein .\model_server)
  3. Download any models needed from the models table
  4. Unzip the desired models
  5. Copy the models and config folders from the downloaded model to .\model_server\, overwriting old config files if needed
  6. Optionally check your .\model_server\config\config.yaml file to enable the correct pipelines (see more...)
  7. Launch Windows Terminal and select the Anaconda PowerShell environment
  8. Navigate to .\model_server\ and execute .\install.ps1
  9. Wait. Awhile. If this is your first time there are many large dependencies that need to download.
  10. If you are using a paid model, you'll be presented with the Patreon login to verify your license
  11. 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)
  1. Ready to go!

Starting the Server Later

  1. Launch Windows Terminal
  2. Navigate to .\model_server
  3. Run .\start.ps1

Stash Prep

  1. Install the plugin (Settings > Plugins > Community)
  2. Open your Stash's config folder
  3. Edit plugins/community/ai_tagger/config.py
  4. Set API_BASE_URL to your Windows 11 machines IP
  5. Adjust performance options as desired
  6. Adjust tag options as desired
  7. Set up path mutation (see Storage Prep FMI). Example:
path_mutation = {"/remote-data": "Z:\\porn", "/data", "X:\\porn"}
  1. Remember to double-escape backslashes!
  2. 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

  1. Get shell access on your Docker host machine (eg. open Terminal, or use ssh)
  2. Launch a shell in the Docker container:
docker exec -it Stash /bin/sh
  1. 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
  1. Activate the venv:
source /root/.stash/venv/bin/activate
  • You should see the (venv) prefix in your shell prompt
  1. Install the dependencies:
pip install -r /root/.stash/plugins/community/ai_tagger/requirements.txt
  1. Open Stash > Settings > System
  2. Edit Python Executable Path: /root/.stash/venv/bin/python
  3. Done! Restart the Stash container to double check.

Storage Prep

  1. Make sure your Stash's library folders are on drive or network share that is also accessible to the Windows machine
  2. For each Library, mount the share in Windows using Map Network Drive
  3. For each Library, add an entry like "/server/path": "<Z>:\\share\\path" in the Stash Plugin Config