Home >System Tutorial >Windows Series >I Run a Custom GPT Chatbot in Windows: Here's Why and How to Do It
There are a number of advantages to running a GPT/AI chatbot on your own computer rather than accessing one on the Internet. We'll show why you might want to, and the easiest way to get it set up on Windows.
While online AI chatbots like ChatGPT are dominant, with access to huge amounts of training data and up-to-date information, there are a few reasons you might want to run your own local chatbot on your Windows computer.
Running your own AI tools locally is free, and comes without the restrictions of online tools: There's no censorship, and you can load whatever machine-learning models, tailor their responses and behavior, and provide any prompt, all without restriction (and in total privacy). It's also a good way to get an understanding of how modern large language model (LLM) AI tools work under the hood, especially if you are looking to get into the AI or tech industry.
You can find models for just about anything, from fictional character interactions, to programming, to general knowledge, and many other use cases that more general online models may not cover.
This tutorial will use text-generation-web-ui-docker, an open-source interface for large language models, that simplifies installing and using LLMs.
text-generation-web-ui-docker bundles the text-generation-web-ui project using Docker, which removes the need for installing and managing all the complex dependencies that local AI tools usually require by storing everything in a container separate to your system. The only thing you need to run your local chatbot is a Windows PC that supports Docker running using the Windows Subsystem for Linux (WSL). You'll also need a fairly recent GPU, ideally one from NVIDIA, for maximum compatibility.
Docker containers are similar to virtual machines in that they contain a whole running system, but they are much more lightweight, and perfect for distributing applications and all of their requirements in a single, easy-to-install bundle. To run text-generation-web-ui-docker in Docker, download and install Docker on your Windows system.
Docker can run on Windows in one of two ways: WSL or Hyper-V mode. WSL is recommended for most users, so you may need to enable it before installing Docker.
It's also recommended to install the Windows Terminal app, as it provides a convenient interface for WSL, PowerShell, and the Windows command line.
To download text-generation-web-ui-docker, visit its GitHub page. You can download a ".zip" file containing all the files you need by clicking on the green "Code" button and then clicking on "Download Zip" from the drop-down menu.
The screenshot below shows you where to find this on the GitHub page.
Brad Morton / How-To GeekExtract the downloaded ZIP file into its own folder, and then open the folder containing the unzipped files. Don't worry too much about the contents of this folder: it's all the moving parts for your AI chatbot, but Docker will take care of setting everything up for you.
Before you launch text-generation-web-ui-docker, you need to make sure it's configured for your PC hardware. Edit the file docker-compose.yml to specify the variant that matches your hardware: default-nvidia or default-cpu (if you don't have a compatible GPU).
Brad Morton / How-To GeekThen, still in the folder containing the downloaded and extracted files, right-click on an empty space and click "Open in Terminal" to open the directory in a new PowerShell window.
Brad Morton / How-To GeekMake sure Docker Desktop is running before typing in the following Docker command into the Terminal window:
docker compose up -d
This command will do the following:
If you haven't run this command before and the application needs to be downloaded (pulled), you might need to go and make a cup of tea, as it could take a while. Once the command has completed running successfully, you'll see that the text-generation-web-ui-docker Docker container has been created and started.
Brad Morton / How-To GeekThe running container will also appear in Docker Desktop, where you can stop, start, and manage it.
Brad Morton / How-To GeekOnce text-generation-web-ui-docker is up and running in Docker, you can access it by typing the address http://localhost:7860 into your browser's address bar. Localhost is the address your computer uses to access services it is running itself, each of which is assigned a unique port number (in this case 7860). You can see what ports a running Docker container has made available on localhost by opening it in Docker desktop.
This is an older version of GPT than you get when you use ChatGPT on the internet. Consequently, it won't be as smart or as intuitive as what you might expect, but it is customizable and private.
Navigate to the Model tab in the web interface and enter openai-community/gpt2 into the "Download model or LoRA" box, and then click the Download button. This might take a few minutes.
Brad Morton / How-To GeekClick the Refresh icon in the top-left, then select the newly downloaded openai-community/gpt2 from the adjacent Model drop-down menu. Finally, click the "Load" button, and wait a few minutes until you see a success message.
Brad Morton / How-To GeekThis model works out of the box, and doesn't require any signup. As you get into AI and want to experiment with different models and AI tools, you can find more on HuggingFace.
This isn't quite like the AI chatbots you're used to using online, which are already set up for general use that cover a lot of situations. You'll need to tell the model how to behave before interacting with it, otherwise its output will be a bit... unhinged.
Brad Morton / How-To GeekHoo boy, while it got the right answer, this AI chatbot needs a bit of fine-tuning.
There's a lot you can tweak, and it can be a bit clunky at first, but with practice and experience, you can build a chatbot that is specific to your own usage, and that keeps your data 100% on your own computer, which is great for business and other confidential use-cases. To learn how to configure and train your local GPT chatbot, check out the text-generation-web-ui documentation and the OpenAI GP2 docs on HuggingFace.
If you want to generate images using AI from your Windows PC, you can use Fooocus to get easier and more immediate results.
The above is the detailed content of I Run a Custom GPT Chatbot in Windows: Here's Why and How to Do It. For more information, please follow other related articles on the PHP Chinese website!