Repository navigation
Set Up Local AI Services with Docker
Run the VHToolkit's AI capabilities on your own machine instead of calling cloud providers. Each local service ships as a Docker container with a single script to start it and another to stop it. Use this when you need data sovereignty, offline operation, or simply want to develop without spending on API calls.
Every service is optional and independent. Start only the ones you need - for example Kokoro for speech synthesis while still using a cloud language model.
| Capability | Service | Port | Notes |
|---|---|---|---|
| Speech recognition | faster-whisper |
9005 | NVIDIA GPU recommended |
| Speech synthesis | kokoro |
8880 | CPU only, Apache-2.0. The preferred local option |
| Speech synthesis | piper |
9002 | CPU only. Small and fast; GPL-3.0 engine |
| Speech synthesis | xtts |
9004 | GPU. Voice cloning. Weights are non-commercial (CPML) |
| Language model | vllm |
8000 | GPU. One model per process, maximum throughput. Embeddings on 8001 |
| Language model | ollama |
11434 | Keeps several models resident and switches between them per request |
| Sensing | openface |
5101 | Facial behavior analysis |
| Knowledge retrieval | rag-proxy |
11434 | Sits in front of a language model to add retrieval. Not a container - a .NET service |
-
Docker Desktop on Windows or macOS, or Docker Engine on Linux. Install from here.
On Windows, use the WSL2 backend. It is the default during installation ("Use WSL 2 instead of Hyper-V (recommended)"), and for the GPU services it is not optional: GPU support in Docker Desktop for Windows works only with the WSL2 backend, and the Hyper-V backend cannot pass a GPU through at all. So
faster-whisper,xttsandvllmrequire it, while the CPU-only services run either way.You do not need to install a Linux distribution or work inside WSL yourself - Docker Desktop manages its own WSL2 backend, and the containers are started from an ordinary Windows terminal. The separate Install Windows Subsystem for Linux (WSL) page covers running Python services directly under WSL with Conda, which is a different and older approach to the same problem; if you are using these containers you can skip it.
-
An NVIDIA GPU for
faster-whisper,xttsandvllm. On Windows enable GPU support in Docker Desktop; on Linux install thenvidia-container-toolkit. The CPU-only services (kokoro,piper,openface) run anywhere. -
Disk space. Model weights download on first run and are cached in Docker volumes, so later starts are fast. A language model can be several gigabytes.
The services live in the RideServices submodule of the VHToolkit repository. If you cloned with submodules they are already present; if not, populate them from the repository root:
git submodule update --init --recursive
A plain git pull brings down the submodule reference but does not populate it, so run this after a pull that adds or updates the services. Everything below is relative to RideServices/Services/.
Open a terminal in the folder of the service you want and run its load script. For local speech synthesis:
cd RideServices/Services/kokoro
load.bat
On macOS or Linux use ./load.sh. The script checks that Docker is running, builds the image if needed, and starts the container in the background. The first run downloads the model, so give it a few minutes. The load scripts are safe to re-run: a container that is already up is left alone.
Two exceptions to that pattern. openface ships Windows scripts only - on macOS or Linux start it with docker compose up -d --build from its folder. It also has a load-gpu.bat that starts it against compose.gpu.yaml when you have a GPU to spare; the plain script is CPU-only and is the one to use otherwise.
Each service answers a health check. Substitute the port from the table above:
curl http://localhost:8880/health
The language-model services answer on OpenAI-compatible paths instead:
curl http://localhost:8000/v1/models
curl http://localhost:11434/api/tags
Most services also ship a test.bat / test.sh that sends a real request and reports what came back.
ollama and vllm can be started together with the RAG proxy, which gives the character retrieval over your own documents. From either service's folder:
load-with-rag.bat
The proxy takes over the port your client already uses and forwards to the language model on an internal port, so nothing changes in Unity. Put your documents in the proxy's corpus/ folder; GET /rag/status reports how many documents it loaded and whether semantic retrieval is ready. Stop the pair with unload-with-rag.bat.
Order matters if you start the parts separately - the proxy binds the port the client uses, so the language model has to move to its internal port first. load-with-rag.bat handles that for you, which is the reason to prefer it.
See Knowledge Retrieval (RAG) for what retrieval does and how to write documents that retrieve well.
Stopping frees the GPU memory:
unload.bat
Cached model weights survive in Docker volumes, so the next start is quick.
- Open a demo scene and press Play, then open the debug menu.
- Each capability lists its providers with the local ones marked. Pick Kokoro (Local) under TTS, Whisper (Local) under ASR, or vLLM (Local) or Ollama (Local) under NLP. The switch takes effect on the next turn - no restart needed.
- The VHToolkit already defaults to the ports in the table above, so no configuration is required as long as the containers run on the same machine.
- Talk to the character to confirm the local service is doing the work. A local language model on a modest GPU responds more slowly than a cloud one; that latency is the expected trade for keeping the conversation on your machine.
Both serve a local language model, and you would normally run one or the other rather than both.
-
vLLM serves exactly one model per process at high throughput. Change the model by editing
VLLM_MODELin the service's.envand restarting the container. The VHToolkit requests a stable alias, so swapping the underlying weights needs no change in Unity. -
Ollama keeps several models resident and switches between them per request. The NLP debug menu offers a swap button, so you can compare two models mid-conversation. Choose the models by editing
OLLAMA_MODEL_AandOLLAMA_MODEL_Bin its.env.
- Each service folder has its own
README.mdwith the details for that service, including any settings it accepts. -
xttsis included as an example of voice cloning. Its model weights are licensed for non-commercial use only, so check that before using it in anything you distribute. - Running several GPU services at once can exhaust video memory. If a container fails to start or a model refuses to load, stop the services you are not using and try again.
-
rag-evalin the same folder is not a service. It is a harness for measuring retrieval quality against a set of questions, useful when tuning a corpus rather than when running a character.