Skip to content

Commit

Permalink
wip: ui update and pipelining
Browse files Browse the repository at this point in the history
  • Loading branch information
jazelly committed Jul 11, 2024
1 parent 4031f3b commit 1d0f494
Show file tree
Hide file tree
Showing 401 changed files with 16,514 additions and 42,324 deletions.
86 changes: 67 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

Finetune an LLM, within a few clicks!

<p align="center">
<a href="https://discord.gg/kghtMX7v" target="_blank">
<img src="https://img.shields.io/badge/FinetuneLLMs-chat_with_us-blue" alt="Discord">
</a>
<a href="https://github.com/jazelly/FinetuneLLMs/blob/main/LICENSE" target="_blank">
<img src="https://img.shields.io/static/v1?label=license&message=MIT&color=white" alt="License">
</a>

</p>

## 🔥Goal & Roadmap🔥

The main objective of this project is to lower the barrier to training large language models, especially for startup companies that have hardware in hands. With this project, it should be easy for a company to start experimenting with LLM training within a basic setup on servers with GPU/CPU resources.
Expand All @@ -10,17 +20,6 @@ In a way, it helps provide an opportunity for everyone who has hardware availabl

### [Roadmap](https://github.com/users/jazelly/projects/1/views/1)

## Supported finetuning techniques

| Model \ Method | SFT | DPO | ORPO | KTO | PRO |
| -------------- | --- | --- | ---- | --- | --- |
| llama 2 ||||||
| llama 3 ||||||
| gguf ||||||
| phi-3 ||||||
| Mistral ||||||
| ... | ? | ? | ? | ? | ? |

## General Setup

This repo provides 3 modules, `frontend `(react), `server` (nodejs), and `trainer` (python django)
Expand All @@ -39,30 +38,79 @@ You need CUDA for now, but once llama.cpp is integrated, this will no longer be

## Dev Setup

Setup frontend
### Setup frontend

```
// copy .env.example to .env
cd frontend
// copy .env.example to .env
npm ci
npm run dev
// or yarn && yarn dev
```

Setup server
### Setup server

```
// copy .env.example to .env and .env.development
cd server
// copy .env.example to .env and .env.development
npx prisma migrate dev
yarn
yarn dev
npm i
npm run dev
```

### Setup trainer

#### Manual installation using Conda

Recommended if you have some experience with the command-line.

##### 0. Install Conda

https://docs.conda.io/en/latest/miniconda.html

On Linux or WSL, it can be automatically installed with these two commands ([source](https://educe-ubc.github.io/conda.html)):

```
curl -sL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" > "Miniconda3.sh"
bash Miniconda3.sh
```

##### 1. Create a new conda environment

```
conda create -n fllms python=3.11
conda activate fllms
```

##### 2. Install Pytorch

| System | GPU | Command |
| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| Linux/WSL | NVIDIA | `pip3 install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu121` |
| Linux/WSL | CPU only | `pip3 install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cpu` |
| Linux | AMD | `pip3 install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/rocm5.6` |
| MacOS + MPS | Any | `pip3 install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1` |
| Windows | NVIDIA | `pip3 install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu121` |
| Windows | CPU only | `pip3 install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1` |

The up-to-date commands can be found here: https://pytorch.org/get-started/locally/.

For NVIDIA, you also need to install the CUDA runtime libraries:

```
conda install -y -c "nvidia/label/cuda-12.1.1" cuda-runtime
```

If you need `nvcc` to compile some library manually, replace the command above with

```
conda install -y -c "nvidia/label/cuda-12.1.1" cuda
```

Setup trainer
##### 3. Install dependencies

```
cd trainer
pip install -r requirements.txt
daphne trainer.asgi:application
python watch.py
```
5 changes: 5 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
env='Development'
VITE_API_BASE='http://localhost:3001/api' # Use this URL when developing locally
# VITE_API_BASE="https://$CODESPACE_NAME-3001.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN/api" # for Github Codespaces
# VITE_API_BASE='/api' # Use this URL deploying on non-localhost address OR in docker.

TRAINER_WS_URL_BASE='ws://localhost:8000/'

TRAINER_API_BASE='http://localhost:8000/'
17 changes: 17 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always",
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto"
}
3 changes: 2 additions & 1 deletion frontend/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"editor.formatOnSave": true
"editor.formatOnSave": true,
"editor.rulers": [80]
}
Loading

0 comments on commit 1d0f494

Please sign in to comment.