updated faq, tft

This commit is contained in:
mik-tf
2024-08-29 16:43:43 -04:00
parent ec47399867
commit b7e3f2b323
49 changed files with 325 additions and 618 deletions

View File

@@ -10,9 +10,12 @@ In this section, we delve into sophisticated topics and powerful functionalities
- [Listing Free Public IPs](list_public_ips.md)
- [Cloud Console](cloud_console.md)
- [Redis](grid3_redis.md)
- [IPFS](ipfs_toc.md)
- [IPFS on a Full VM](ipfs_fullvm.md)
- [IPFS on a Micro VM](ipfs_microvm.md)
- [IPFS](ipfs/ipfs_toc.md)
- [MinIO Operator with Helm3](minio_helm3.md)
- [AI & ML Workloads](ai_ml_workloads.md)
- [Hummingbot](hummingbot.md)
- [Hummingbot](hummingbot.md)
- [AI & ML Workloads](ai_ml_workloads/ai_ml_workloads_toc.md)
- [Ecommerce](ecommerce/ecommerce.md)
- [HTTPS with Caddy](https_caddy.md)
- [Node Status Bot](node_status_bot.md)
- [Minetest](minetest.md)
- [Remote Desktop and GUI](remote-desktop_gui.md)

View File

@@ -0,0 +1,7 @@
# AI & ML Workloads
<h2>Table of Contents</h2>
- [CPU and Llama](cpu_and_llama.md)
- [GPU and Pytorch](gpu_and_pytorch.md)
- [GPU and Fooocus](gpu_and_fooocus.md)

View File

@@ -0,0 +1,105 @@
<h1> AI & ML Workloads: CPU and Llama </h1>
<h2>Table of Contents</h2>
- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Deploy a Full VM](#deploy-a-full-vm)
- [Preparing the VM](#preparing-the-vm)
- [Setting OpenWebUI](#setting-openwebui)
- [Pull a Model](#pull-a-model)
- [Using Llama](#using-llama)
- [References](#references)
---
## Introduction
We present a simple guide on how to deploy large language models on the grid using CPU. For this guide, we will be deploying Llama on a full VM using OpenWebUI bundled with Ollama support.
Llama is a large language model trained by Meta AI. It is an open-source model, meaning that it is free to use and customize for various applications. This LLM is designed to be a more conversational AI allowing users to engage in natural-sounding conversations. Llama is trained on a massive dataset of text from the internet and can generate responses to a wide range of topics and questions.
Ollama is an open-source project that allows users to run large language models (LLMs) on their local machine.
OpenWebUI is one of many front ends for Ollama, providing a convenient and user friendly way to load weights and chat with the bot.
## Prerequisites
- [A TFChain account](dashboard@@wallet_connector)
- TFT in your TFChain account
- [Buy TFT](threefold_token@@buy_sell_tft)
- [Send TFT to TFChain](threefold_token@@tfchain_stellar_bridge)
## Deploy a Full VM
We start by deploying a full VM on the ThreeFold Dashboard. The more cores we set to the machine, the faster the model will be.
* On the [Threefold Dashboard](https://dashboard.grid.tf/#/), go to the [full virtual machine deployment page](https://dashboard.grid.tf/#/deploy/virtual-machines/full-virtual-machine/)
* Deploy a full VM (Ubuntu 22.04) with only `Wireguard` as the network
* Vcores: 8 vcores
* MB of RAM: 4096 GB
* GB of storage: 100 GB
* After deployment, [set the Wireguard configurations](ssh_wireguard.md)
* Connect to the VM via SSH
* ```
ssh root@VM_Wireguard_Address
```
## Preparing the VM
We prepare the full VM to run Llama.
* Install Docker
* ```
wget -O docker.sh get.docker.com
bash docker.sh
```
## Setting OpenWebUI
We now install OpenWebUI with bundled Ollama support. Note that you might need to use another port than `3000` if this port is already in use on your local machine.
* For CPU only
```
docker run -d -p 3000:8080 -v ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama
```
* Once the container is fully loaded and running, go to your browser to access OpenWebUI using the Wireguard address:
* ```
10.20.4.2:3000
```
You should now see the OpenWebUI page. You can register by entering your email and setting a password. This information will stay on the machine running OpenWebUI.
<p align="center">
<img src="./img/openwebui_page.png" />
</p>
## Pull a Model
Once you've access OpenWebUI, you need to download a LLM model before using it.
- Click on the bottom left button displaying your username
- Click on `Settings`, then `Admin Settings` and `Models`
- Under `Pull a model from Ollama.com`, enter the LLM model you want to use
- In our case we will use `llama3`
- Click on the button on the right to pull the image
![](./img/openwebui_model.png)
## Using Llama
Let's now use Llama!
- Click on `New Chat` on the top left corner
- Click on `Select a model` and select the model you downloaded
- You can click on `Set as default` for convenience
![](./img/openwebui_set_model.png)
- You can now `Send a Message` to Llama and interact with it!
That's it. You now have a running LLM instance on the grid.
## References
For any advanced configurations, you may refer to the [OpenWebUI documentation](https://github.com/open-webui/open-webui).

View File

@@ -0,0 +1,109 @@
<h1>AI & ML Workloads: GPU and Fooocus</h1>
<h2>Table of Contents</h2>
- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Prepare the System](#prepare-the-system)
- [Install the GPU Driver](#install-the-gpu-driver)
- [Install the Prerequisites and Launch Fooocus](#install-the-prerequisites-and-launch-fooocus)
- [Use Fooocus](#use-fooocus)
---
## Introduction
We show how to use a ThreeFold GPU node on the grid to deploy AI workloads for graphics and image generation. We will be using [Fooocus](https://github.com/lllyasviel/Fooocus) and a full virtual machine with a GPU card.
## Prerequisites
- [A TFChain account](dashboard@@wallet_connector)
- TFT in your TFChain account
- [Buy TFT](threefold_token@@buy_sell_tft)
- [Send TFT to TFChain](threefold_token@@tfchain_stellar_bridge)
- Reserve a [dedicated GPU node](dashboard@@node_finder) on the ThreeFold Grid
- Deploy a full VM running Ubuntu 22.04
- [SSH](ssh_guide.md) into the node with [Wireguard](ssh_wireguard.md)
## Prepare the System
- Update the system
```
dpkg --add-architecture i386
apt-get update
apt-get dist-upgrade
reboot
```
- Check the GPU info
```
lspci | grep VGA
lshw -c video
```
## Install the GPU Driver
- Download the latest Nvidia driver
- Check which driver is recommended
```
apt install ubuntu-drivers-common
ubuntu-drivers devices
```
- Install the recommended driver (e.g. with 535)
```
apt install nvidia-driver-535
```
- Check the GPU status
```
nvidia-smi
```
Now that the GPU node is set, let's install and launch Fooocus.
## Install the Prerequisites and Launch Fooocus
We install the prerequisites, including Miniconda, clone the repository, download the models and launch Fooocus.
- Install the prerequisites
```
apt update
apt install python3-pip python3-dev
pip3 install --upgrade pip
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
```
- Reload the shell to enable Conda
- Clone the Fooocus directory and install the Python requirements with Miniconda
```
git clone https://github.com/lllyasviel/Fooocus.git
cd Fooocus
conda env create -f environment.yaml
conda activate fooocus
pip install -r requirements_versions.txt
```
- Download the models with conda and deploy Fooocus
```
conda activate fooocus
python entry_with_update.py
```
- Create an SSH tunnel to the VM
```
ssh -4 -L 7865:127.0.0.1:7865 root@10.20.4.2
```
## Use Fooocus
You can then access Fooocus:
```
127.0.0.1:7865
```
Here are some image generated with Fooocus:
![](./img/fooocus_dog_ocean.png)
![](./img/fooocus_ship.png)
![](./img/fooocus_jungle.png)
![](./img/fooocus_stadium.png)

View File

@@ -1,4 +1,4 @@
<h1> AI & ML Workloads </h1>
<h1> AI & ML Workloads: GPU and Pytorch</h1>
<h2> Table of Contents </h2>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB