MCPcopy Index your code
hub / github.com/SillyTavern/SillyTavern-Extras

github.com/SillyTavern/SillyTavern-Extras @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
5,393 symbols 16,376 edges 453 files 1,315 documented · 24% updated 19mo ago★ 68638 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SillyTavern - Extras


Extras project is discontinued and won't receive any new updates or modules. The vast majority of modules are available natively in the main SillyTavern application. You may still install and use it but don't expect to get immediate support if you face any issues.


Recent news

  • April 24 2024 - The project is officially discontinued.
  • November 20 2023 - The project is relicensed as AGPLv3 to comply with the rest of ST organization policy. If you have any concerns about that, please raise a discussion in the appropriate channel.
  • November 16 2023 - Requirement files were remade from scratch to simplify the process of local installation.
  • Removed requirements-complete.txt, please use requirements.txt instead.
  • Unlocked versions of all requirements unless strictly necessary.
  • Coqui TTS requirements moved to requirements-coqui.txt.
  • July 25 2023 - Now extras require Python 3.11 to run, some of the new modules will be incompatible with old Python 3.10 installs. To migrate using conda, please remove old environment using conda remove --name extras --all and reinstall using the instructions below.

What is this

A set of APIs for various SillyTavern extensions.

You need to run the latest version of SillyTavern. Grab it here: How to install, Git repository

All modules, except for Stable Diffusion, run on the CPU by default. However, they can alternatively be configured to use CUDA (with --cuda command line option). When running all modules simultaneously, you can expect a usage of approximately 6 GB of RAM. Loading Stable Diffusion adds an additional couple of GB to the memory usage.

Some modules can be configured to use CUDA separately from the rest (e.g. --talkinghead-gpu, --coqui-gpu command line options). This is useful in low-VRAM setups, such as on a gaming laptop.

Try on Colab (will give you a link to Extras API): Open In Colab

Colab link: https://colab.research.google.com/github/SillyTavern/SillyTavern/blob/release/colab/GPU.ipynb

Documentation: https://docs.sillytavern.app/

How to run

:exclamation: IMPORTANT! Requirement files explained

  • Default requirements.txt installs PyTorch CUDA by default.
  • If you run on AMD GPU, use requirements-rocm.txt file instead.
  • If you run on Apple Silicon (ARM series), use the requirements-silicon.txt file instead.
  • If you want to use Coqui TTS, install requirements-coqui.txt after choosing the requirements from the list above.
  • If you want to use RVC, install requirements-rvc.txt after choosing the requirements from the list above.
  • BE WARNED THAT:
  • Coqui package is extremely unstable and may break other packages or not work at all in your environment.
  • It's not really worth it.

Common errors when installing requirements

ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects

Installing the chromadb package requires one of the following:

  1. Have Visual C++ build tools installed: https://visualstudio.microsoft.com/visual-cpp-build-tools/
  2. Installing hnswlib from conda: conda install -c conda-forge hnswlib

:exclamation: IMPORTANT! The chromadb package is used only by the chromadb module for the old Smart Context extension, which is deprecated. You will likely not need it.

Missing modules reported by SillyTavern extensions menu?

You must specify a list of module names to be run in the --enable-modules command (caption provided as an example). See Modules section.

☁️ Colab

  • Open colab link
  • Select desired "extra" options and start the cell
  • Wait for it to finish
  • Get an API URL link from colab output under the ### SillyTavern Extensions LINK ### title
  • Start SillyTavern with extensions support: set enableExtensions to true in config.conf
  • Navigate to SillyTavern extensions menu and put in an API URL and tap "Connect" to load the extensions

What about mobile/Android/Termux? 🤔

There are some folks in the community having success running Extras on their phones via Ubuntu on Termux. This project wasn't made with mobile support in mind, so this guide is provided strictly for your information only: https://rentry.org/STAI-Termux#downloading-and-running-tai-extras

:exclamation: IMPORTANT!

We will NOT provide any support for running Extras on Android. Direct all your questions to the creator of the guide linked above.

💻 Locally

Option 1 - Conda (recommended) 🐍

PREREQUISITES * Install Miniconda: https://docs.conda.io/en/latest/miniconda.html * (Important!) Read how to use Conda: https://conda.io/projects/conda/en/latest/user-guide/getting-started.html * Install git: https://git-scm.com/downloads

EXECUTE THESE COMMANDS ONE BY ONE IN THE CONDA COMMAND PROMPT.

TYPE/PASTE EACH COMMAND INTO THE PROMPT, HIT ENTER AND WAIT FOR IT TO FINISH!

  • Before the first run, create an environment (let's call it extras):
conda create -n extras
  • Now activate the newly created env
conda activate extras
  • Install Python 3.11
conda install python=3.11
  • Install the required system packages
conda install git
  • Clone this repository
git clone https://github.com/SillyTavern/SillyTavern-extras
  • Navigated to the freshly cloned repository
cd SillyTavern-extras
  • Install the project requirements
pip install -r requirements.txt
  • Run the Extensions API server
python server.py --enable-modules=caption,summarize,classify
  • Copy the Extra's server API URL listed in the console window after it finishes loading up. On local installs, this defaults to http://localhost:5100.
  • Open your SillyTavern config.conf file (located in the base install folder), and look for a line "const enableExtensions". Make sure that line has "= true", and not "= false".
  • Start your SillyTavern server
  • Open the Extensions panel (via the 'Stacked Blocks' icon at the top of the page), paste the API URL into the input box, and click "Connect" to connect to the Extras extension server.
  • To run again, simply activate the environment and run these commands. Be sure to the additional options for server.py (see below) that your setup requires.
conda activate extras
python server.py

:exclamation: IMPORTANT! Talkinghead

Installation requirements for Talkinghead changed in January 2024. The live mode - i.e. the talkinghead module that powers the Talkinghead mode of Character Expressions - no longer needs any additional packages.

However, a manual poser app has been added, serving two purposes. First, it is a GUI editor for the Talkinghead emotion templates. Secondly, it can batch-generate static emotion sprites from a single Talkinghead image. The latter can be convenient if you want the convenience of AI-powered posing (e.g. if you make new characters often), but don't want to run the live mode.

The manual poser app, and only that app, still requires the installation of an additional package that is not installed automatically due to incompatibility with Colab. If you want to be able to use the manual poser app, then run this after you have installed other requirements:

conda activate extras
pip install wxpython==4.2.1

The installation of the wxpython package can easily take half an hour on a fast CPU, as it needs to compile a whole GUI toolkit.

More information about Talkinghead can be found in its full documentation.

Option 2 - Vanilla 🍦

  • Install Python 3.11: https://www.python.org/downloads/release/python-3114/
  • Install git: https://git-scm.com/downloads
  • Clone the repo:
git clone https://github.com/SillyTavern/SillyTavern-extras
cd SillyTavern-extras
  • Run python -m pip install -r requirements.txt
  • Run python server.py --enable-modules=caption,summarize,classify
  • Get the API URL. Defaults to http://localhost:5100 if you run locally.
  • Start SillyTavern with extensions support: set enableExtensions to true in config.conf
  • Navigate to the SillyTavern extensions menu and put in an API URL and tap "Connect" to load the extensions

Modules

Name Used by Description
caption Image captioning
chromadb Smart Context Vector storage server
classify Character Expressions Text sentiment classification
coqui-tts Coqui TTS server
edge-tts Microsoft Edge TTS client
embeddings Vector Storage The Extras vectorization source
rvc Real-time voice cloning
sd Stable Diffusion image generation (remote A1111 server by default)
silero-tts Silero TTS server
summarize Summarize The Extras API backend
talkinghead Character Expressions AI-powered character animation (see full documentation)
websearch Websearch Google or DuckDuckGo search using Selenium headless browser

:exclamation: IMPORTANT!

  • Character Expressions can connect to two Extras modules, classify and talkinghead.
  • classify updates the expression of the AI character's avatar automatically based on text sentiment analysis.
  • talkinghead provides AI-powered character animation. It also takes its expression from the Extras classify.
    • To use Talkinghead, Extensions ⊳ Character Expressions ⊳ Local server classification in the ST GUI must be off, and classify must be enabled in Extras.
  • Smart Context is deprecated; superseded by Vector Storage.
  • The embeddings module makes the ingestion performance comparable with ChromaDB, as it uses the same vectorization backend.
  • Vector Storage does not use other Extras modules.
  • Summarize: the Main API is generally more capable, as it uses your main LLM to perform the summarization.
  • The summarize module is only used when you summarize with the Extras API. It uses a specialized BART summarization model, with a context size of 1024.

Options

Flag Description
--enable-modules Required option. Which modules to enable.

Expects a comma-separated list of module names. Ordering does not matter. See Modules

Example: --enable-modules=caption,sd | | --port | Specify the port on which the application is hosted. Default: 5100 | | --listen | Host the app on the local network | | --share | Share the app on CloudFlare tunnel | | --secure | Adds API key authentication requirements. Highly recommended when paired with share! | | --cpu | Run the models on the CPU instead of CUDA. Enabled by default. | | --mps or --m1 | Run the models on Apple Silicon. Only for M1 and M2 processors. | | --cuda | Use CUDA (GPU+VRAM) to run modules if it is available. Otherwise, falls back to using CPU. | | --cuda-device | Specifies a CUDA device to use. Defaults to cuda:0 (first available GPU). | | --talkinghead-gpu | Use CUDA (GPU+VRAM) for Talkinghead. Highly recommended, 10-30x FPS increase in animation. | | --talkinghead-model | Load a specific variant of the THA3 AI poser model for Talkinghead.

Default: auto (which is separable_half on GPU, separable_float on CPU). | | --talkinghead-models | If the THA3 AI poser models are not yet installed, downloads and installs them.

Expects a HuggingFace model ID.

Default: OktayAlpk/talking-head-anime-3 | | `--coqui-gpu

Core symbols most depended-on inside this repo

append
called by 550
modules/voice_conversion/fairseq/data/huffman/huffman_mmap_indexed_dataset.py
size
called by 522
modules/voice_conversion/fairseq/data/codedataset.py
get
called by 291
modules/voice_conversion/fairseq/data/audio/speech_to_text_dataset.py
safe_getattr
called by 165
modules/voice_conversion/fairseq/utils.py
pad
called by 164
modules/voice_conversion/fairseq/data/dictionary.py
eos
called by 109
modules/voice_conversion/fairseq/data/dictionary.py
write
called by 76
modules/voice_conversion/fairseq/data/indexed_dataset.py
LayerNorm
called by 57
modules/voice_conversion/fairseq/modules/layer_norm.py

Shape

Method 3,648
Function 924
Class 788
Route 33

Languages

Python100%
C++1%

Modules by API surface

server.py81 symbols
modules/voice_conversion/fairseq/data/indexed_dataset.py75 symbols
modules/voice_conversion/fairseq/utils.py74 symbols
modules/voice_conversion/fairseq/modules/kmeans_attention.py69 symbols
modules/voice_conversion/fairseq/logging/progress_bar.py69 symbols
modules/voice_conversion/fairseq/data/iterators.py68 symbols
modules/voice_conversion/fairseq/trainer.py63 symbols
modules/voice_conversion/rvc/infer_pack/models.py61 symbols
modules/voice_conversion/fairseq/models/fairseq_model.py58 symbols
modules/voice_conversion/fairseq/models/speech_to_text/modules/emformer.py57 symbols
modules/voice_conversion/fairseq/logging/meters.py54 symbols
modules/voice_conversion/fairseq/data/audio/data_cfg.py54 symbols

For agents

$ claude mcp add SillyTavern-Extras \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact