TroubleChute Logo
< Go Back

TroubleChute Script Hub

Currently viewing: PowerShell/AI/gpt4all.ps1

NOTE: The following code may be out-of-date compared to GitHub, but is all pulled from GitHub every hour or so.

When shortlinks are used (filename as subdomain), code used by PowerShell and other interactions with this site is served from GitHub.

(Right-click -> Download the button below to save the file)

Last modified: 2023-06-07T14:00:44.000+02:00

# Copyright (C) 2023 TroubleChute (Wesley Pyburn)
# Licensed under the GNU General Public License v3.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    GNU General Public License for more details.
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
# ----------------------------------------
# This script:
# 1. Installs Chocolatey (for installing VCRuntimes and aria2) -
# 2. Installs git to clone the nomic-ai/gpt4all project. In the future you can run 'git pull' in the project's folder to update it.
# 3. Downloads nomic-ai/gpt4all
# 4. Installs aria2c for a much faster model download using Choco.
# 5. Installs required Microsoft VC Runtimes, which the project will not run without, using Choco.
# 6. Launches gpt4all.
# 7. (Optional) Create a desktop shortcut
# ----------------------------------------

Write-Host "--------------------------------------------" -ForegroundColor Cyan
Write-Host "Welcome to TroubleChute's GPT4All installer!" -ForegroundColor Cyan
Write-Host "GPT4All as well as all of its other dependencies should now be installed..." -ForegroundColor Cyan
Write-Host "[Version 2023-04-06 (version 2)]" -ForegroundColor Cyan
Write-Host "`nThis script is provided AS-IS without warranty of any kind. See &"
Write-Host "Consider supporting these install scripts:" -ForegroundColor Green
Write-Host "--------------------------------------------`n`n" -ForegroundColor Cyan

Set-Variable ProgressPreference SilentlyContinue # Remove annoying yellow progress bars when doing Invoke-WebRequest for this session

# 1. Install Chocolatey
Write-Host "`nInstalling Chocolatey..." -ForegroundColor Cyan
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))

# 2. Install or update Git if not already installed
Write-Host "`nInstalling Git..." -ForegroundColor Cyan
iex (irm

# 3. Clone the nomic-ai GPT4All repo
Write-Host "`nCloning the nomic-ai GPT4All repo..." -ForegroundColor Cyan
git clone

# Import function to reload without needing to re-open Powershell
iex (irm

# 4. Before downloading the model, we'll install aria2c to make the download MUCH faster
Write-Host "`nInstalling aria2c (Faster model download)..." -ForegroundColor Cyan
choco upgrade aria2 -y

# 5. Download the GPT4All Lora model
Write-Host "`nDownloading the GPT4All model. This will take a while" -ForegroundColor Cyan
aria2c -x 8 -s 8 --disable-ipv6 --continue --out="./gpt4all/chat/gpt4all-lora-quantized.bin"

# 6. Install VCRedist (if missing any)
Write-Host "`nInstalling required VCRuntimes..." -ForegroundColor Cyan
choco upgrade vcredist2015 -y

iex (irm # Get RemoteFunction importer
Import-RemoteFunction -ScriptUri "" # Import function to create a shortcut

# 7. Create a desktop shortcut
Write-Host "`nCreating shortcut on desktop..." -ForegroundColor Cyan
$shortcutName = "GPT4All"
$targetPath = "gpt4all\chat\gpt4all-lora-quantized-win64.exe"
$workingDirectory = "gpt4all\chat"

do {
    Write-Host -ForegroundColor Cyan -NoNewline "`n`nDo you want a desktop shortcut? (y/n): "
    $createShortcut = Read-Host
} while ($createShortcut -notin "Y", "y", "N", "n")

if ($createShortcut -eq "Y" -or $createShortcut -eq "y") {
    New-Shortcut -ShortcutName $shortcutName -TargetPath $targetPath -WorkingDirectory $workingDirectory

# 8. Run the gpt4all-lora-quantized-win64 program
Write-Host "`nRunning GPT4All" -ForegroundColor Cyan
Start-Process -FilePath 'gpt4all\chat\gpt4all-lora-quantized-win64.exe' -WorkingDirectory 'gpt4all\chat'

TCNO TechNobo / TroubleChute © Wesley Pyburn (TroubleChute)
Support Me Privacy Policy Cookies Policy Terms of Service Contact