Home > Apps

You can’t run ChatGPT locally, but you’re not completely out of options

Downloading models to run AI without an internet connection

Reviewed By: Steve Hook

Last Updated on March 25, 2024
Image shows PC with the ChatGPT logo inside on green background below the PC guide logo
You can trust PC Guide: Our team of experts use a combination of independent consumer research, in-depth testing where appropriate - which will be flagged as such, and market analysis when recommending products, software and services. Find out how we test here.

As the demand for AI-powered chatbots and virtual assistants grows, more and more users want to run ChatGPT on their own device’s hardware. Perhaps you don’t have a stable internet connection, or simply don’t want to rely on cloud services. Unfortunately, running ChatGPT locally is not an option, but there are some ways to work around this issue. Setting up services like ChatGPT4All allows users to run a reasonable approximation of ChatGPT locally. Follow the steps outlined below to get the system up and running.

Quick answer

Unfortunately, running ChatGPT locally is not a possibility. GPT-4 cannot be downloaded, meaning ChatGPT can only be accesed via web browser or mobile app. However, there are other options out there that can provide a similar service locally, for example ChatGPT4All.

Why can’t ChatGPT run locally?

You cannot download GPT-4 and install it on your own machine. This means that you can’t run ChatGPT (or the GPT-4 model) locally. However, there are other options for this.

First, a little background knowledge. ChatGPT is a language model that uses machine learning to generate human-like text. The neural network uses an artificial intelligence technology called Generative Pre-trained Transformer (GPT). It’s trained on a diverse range of internet text, but it can also be fine-tuned with specific datasets for more specialized tasks.


Top 5 Cyber Monday deals

This year's Cyber Monday has officially kickstarted, offering up huge discounts on some of the market's leading tech products. Below, we'll list the best Cyber Monday deals we can find.

Prices and savings subject to change. Click through to get the current deal prices.


However, concerns about data privacy and reliance on cloud-based services have led many to wonder if it can deploy ChatGPT on local servers or devices. This section will explore the feasibility of running ChatGPT locally and examine local deployment’s potential benefits and challenges.

The GPT-4 model that ChatGPT runs on is not available for public download, for multiple reasons. Firstly due to concerns of misuse, ethics safeguards, and the potential to produce harmful applications in the wrong hands. Secondly, the hardware requirements to run ChatGPT locally are substantial – far beyond a consumer PC. ChatGPT runs on industrial-grade processing hardware, like the NVIDIA H100 GPU, which can sell for north of $20,000 per unit.

How to access a ChatGPT-like chatbot locally

Although you can’t install ChatGPT directly onto your machine, there are workarounds. GPT4All is a reasonable approximation of ChatGPT. Unlike ChatGPT, it is open-source and you can download the code right now from Github.

Installing ChatGPT4All locally involves several steps.

Step

1

Clone the OpenAI repository

First, you’ll need to clone the OpenAI repository to your local machine using a git clone command.

Step

2

Install necessary dependancies

Once the repository is on your machine, you’ll need to install the necessary dependencies. This can usually be done with a pip install command.

Step

3

Run the model

After the dependencies are installed, you can run the model. This involves running a Python script that initializes the model and starts a conversation.

Setting up your Local PC for GPT4All

Before you can run ChatGPT-like software on your PC, you need to ensure that your machine is adequately prepared. This involves installing the necessary software and setting up the appropriate environment.

Step

1

Ensure system is up-to-date

The first step is to ensure that your operating system is up-to-date. Whether you’re using Windows, macOS, or a Linux distribution, it’s crucial to have the latest security and performance updates.

Step

2

Install Node.js and PyTorch

Next, you’ll need to install Node.js and PyTorch, two essential dependencies for running ChatGPT. Node.js is a JavaScript runtime that allows you to run JavaScript on your local machine, while PyTorch is a machine learning library that’s used for applications like ChatGPT.

Understanding the Role of Node and PyTorch

Node.js and PyTorch are two critical dependencies for running this chatbot locally. Node.js is a JavaScript runtime that allows you to execute JavaScript code outside a web browser. This is necessary for running the server-side code that interacts with the ChatGPT model.

On the other hand, PyTorch is an open-source machine learning library for Python, used for applications such as natural language processing. ChatGPT, being a language model, relies on PyTorch for its underlying computations.

Getting an API Key

The API key is what allows you to access and use the ChatGPT model. Without it, you would not be able to use the model or access any of its features. The API key is also used to track usage and ensure that users are not abusing the system.

To get the API key for GPT4All, you must first sign up for an account on the OpenAI website. Once you have an account, you can generate an API key. This key is necessary for running the ChatGPT model.

✓ Quick tip

Creating a project directory

When working on a project like running GPT4All locally, it’s crucial to keep your files and dependencies organized. This is where a project directory comes in. A project directory is a folder on your computer where you store all the files related to a specific project.

In the context of running GPT4All locally, your project directory might include the ChatGPT model file, any scripts you use to interact with the model, and any additional resources like documentation or related code files.

Running a chatbot locally on different systems

The process for running ChatGPT can vary slightly depending on your operating system. On Windows, you might need to use a different command to start the model. On Mac, you might need to adjust your security settings to allow the model to run.

Essential AI Tools

More Deals Coming Soon!

How to run GPT 3 locally

Step

1

Compile ChatGPT

To run GPT 3 locally, download the source code from GitHub and compile it yourself. You can also use a pre-compiled version of ChatGPT, such as the one available on the Hugging Face Transformers website.

Step

2

Python environment

To run ChatGPT locally, you will need to have a Python environment with the following libraries installed:

  • Transformers
  • NumPy
  • Pandas
  • Scikit-learn

Step

3

Download ChatGPT source code

Once you have installed these libraries, you can download the ChatGPT source code from GitHub and follow the instructions in the README file to compile it.

Step

4

Run the command

Once it is compiled, you can run ChatGPT by running the following command:

python chatgpt.py

You can then interact with ChatGPT by typing in your questions or prompts.

Step

5

Running inference on your local PC

Once you’ve set up your local PC and installed all required dependencies, the next step is to run inference. In the context of machine learning, inference refers to the process of using a trained model to make predictions.

In the case of ChatGPT, running inference involves sending a prompt to the model and receiving a generated response. This process is handled through the OpenAI API, which you’ll interact with using the scripts you’ve set up in your project directory.

Incorporating HTML for User Interface

While running ChatGPT locally can be done entirely through the command line, incorporating HTML can provide a more user-friendly interface. HTML, or HyperText Markup Language, is the standard markup language for documents designed to be displayed in a web browser.

By creating a simple HTML interface, you can make it easier to send prompts to ChatGPT and display the generated responses. This could involve creating a text input field for entering prompts, a button for sending the prompt to the model, and a text area for displaying the generated response.

Installing the Pre-Trained Model

To install the pre-trained model:

Step

1

Download Pre-trained model

You will need to download from the OpenAI website.

Step

2

Install it on your local machine

Once you have downloaded the model, you can install it on your local machine using the pip install command.

The command will look something like this: pip install gpt-2-simple.

The benefits of using a pre-trained Model

Using a pre-trained model has many benefits. First, it saves you the time and effort of training a model from scratch. Second, pre-trained models have already been trained on a large amount of data, which means they are likely to perform better than a model trained from scratch.

Training the model

Training the model involves feeding it a large amount of data and allowing it to learn from that data. The more data the model is fed, the better it will perform. Training a model can take a long time and requires a lot of computational power.

Troubleshooting – common issues

If you encounter issues while installing or running ChatGPT, there are a few things you can try. First, make sure you’ve installed all the necessary dependencies. If you’re still having trouble, check the error message – it can often provide clues about what’s going wrong.

Conclusion

There you have it; you cannot run ChatGPT locally because while GPT 3 is open source, ChatGPT is not. Hence, you must look for ChatGPT-like alternatives to run locally if you are concerned about sharing your data with the cloud servers to access ChatGPT.

Maria is a contributer to PC Guide, highly-interested in productivity and AI tools, and ensuring the inclusion of detailed product info and coverage across versus pieces.