Compare commits

...

42 Commits

Author SHA1 Message Date
Zach Nussbaum
a7d4bdb7ea feat: eval faster 2023-04-08 04:45:52 +00:00
Zach Nussbaum
506b0511d1 chore: ignnore eval 2023-04-05 21:12:45 +00:00
Andriy Mulyar
1eeaa5c8ee Discord Link 2023-04-04 23:23:34 -04:00
Zach Nussbaum
846f4cdf84 Merge pull request #174 from waybarrios/fixing_data_bug
DatasetDict to dataset object.
2023-04-03 17:34:23 -04:00
Andriy Mulyar
c62312f82e Merge pull request #181 from joliss/readme
Fix `git submodule` instructions
2023-04-03 17:21:50 -04:00
Andriy Mulyar
cec1fda6ec Merge pull request #161 from gourcetools/main
Create launcher.sh
2023-04-03 17:20:28 -04:00
Andriy Mulyar
8e7ce1f7c7 Merge pull request #96 from eltociear/patch-1
Fix typo in TRAINING_LOG.md
2023-04-03 17:18:11 -04:00
Andriy Mulyar
9ac9de7e0a Merge pull request #148 from HiraduNakamura/patch-1
Made capitalization consistent
2023-04-03 17:17:52 -04:00
Andriy Mulyar
6f89d8a2aa Merge pull request #146 from ParisNeo/gitignore_update
Added vscode files to gitignore
2023-04-03 17:16:22 -04:00
Andriy Mulyar
f07b1362ad Updated Python Bindings 2023-04-03 01:50:43 -04:00
Jo Liss
d9a678dd3d Fix git submodule instructions 2023-04-02 19:19:02 +03:00
Wayner Barrios
1a451445a2 DatasetDict to dataset object. 2023-04-01 23:52:25 -04:00
gourcetools
78321adf45 Create launcher.sh
The script detects the user's operating system, lists available .bin files and prompts the user to select a .bin file to run.
Ensuring a more user-friendly experience.
2023-04-01 17:30:40 +02:00
HiraduNakamura
1d5f6af634 Made capitalization consistent 2023-03-31 20:26:09 -04:00
ParisNeo
67e19bccb0 added *.bin to the gitignore 2023-04-01 01:35:50 +02:00
ParisNeo
6524fec7ff Added vscode files to gitignore 2023-04-01 01:16:16 +02:00
Andriy Mulyar
e1357c3720 Update README.md 2023-03-31 12:29:38 -04:00
Andriy Mulyar
b8f39c5104 Merge pull request #116 from Yuvanesh-ux/patch-1
Direct users to discord for help
2023-03-30 17:55:55 -04:00
Yuvanesh-ux
8cbc63b017 Update README.md 2023-03-30 17:53:24 -04:00
Andriy Mulyar
06ad467b7d Merge pull request #110 from mudler/patch-1
Fix typo
2023-03-30 16:20:25 -04:00
Ettore Di Giacinto
16ce7396c1 Fix typo 2023-03-30 21:51:40 +02:00
Benjamin Schmidt
d1bb2aac29 Update README.md 2023-03-30 13:47:04 -04:00
Benjamin Schmidt
b9861f7510 Update README.md 2023-03-30 13:46:03 -04:00
Andriy Mulyar
bc7eb80e02 Huggingface Datasets link 2023-03-30 12:54:28 -04:00
Brandon Duderstadt
0429db0244 Merge pull request #97 from nomic-ai/roadmap
updated roadmap
2023-03-30 12:32:37 -04:00
bstadt
210bf3c9cf updated roadmap 2023-03-30 12:32:14 -04:00
Ikko Eltociear Ashimine
5556de9152 Fix typo in TRAINING_LOG.md
Conditonal -> Conditional
2023-03-31 00:53:53 +09:00
Andriy Mulyar
708e0b486d Merge pull request #93 from BoQsc/BoQsc-patch-2
Update README.md - Improve the Try it yourself section.
2023-03-30 11:33:15 -04:00
Brandon Duderstadt
ad782620ac Merge pull request #94 from nomic-ai/roadmap
added roadmap
2023-03-30 11:13:15 -04:00
bstadt
e8c6aeeea2 added roadmap 2023-03-30 11:10:07 -04:00
Andriy Mulyar
987c694afa Merge pull request #91 from BoQsc/patch-2
Update README.md - Fix GitHub Markdown does not recognize Torrent Magnets
2023-03-30 10:53:52 -04:00
Feldwor
822fa0c47a Update README.md - Fix GitHub Markdown does not recognize Torrent Magnets. 2023-03-30 17:40:43 +03:00
Andriy Mulyar
d8921f835d Torrent Magnet Link Update 2023-03-30 10:32:52 -04:00
Feldwor
54932a51cb Update README.md - Improve the Try it yourself section. 2023-03-30 17:32:17 +03:00
Andriy Mulyar
cfcb101443 Merge pull request #90 from BoQsc/patch-1
Update README.md - Move Torrent/Magnet links to save space in the README file.
2023-03-30 10:31:27 -04:00
Andriy Mulyar
73dbd34310 Updated training data link 2023-03-30 10:30:50 -04:00
Feldwor
03b9e2004e Update README.md - Move Torrent/Magnet links to save space in the readme file. 2023-03-30 16:56:12 +03:00
Brandon Duderstadt
98ae021ea6 Update README.md 2023-03-29 22:36:43 -04:00
Andriy Mulyar
147094e892 Update README.md 2023-03-29 17:22:05 -04:00
Andriy Mulyar
fa91e2b980 Update README.md 2023-03-29 17:18:46 -04:00
Andriy Mulyar
ed35d1fbb0 Update README.md 2023-03-29 17:18:21 -04:00
Andriy Mulyar
2db43570ae Update README.md 2023-03-29 17:13:55 -04:00
14 changed files with 213 additions and 87 deletions

8
.gitignore vendored
View File

@@ -1,3 +1,4 @@
eval_data/*.pkl
*.jsonl
*tar.gz
ckpts**
@@ -161,4 +162,9 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/
# vs code
.vscode
*.bin

106
README.md
View File

@@ -4,8 +4,14 @@
<p align="center">
<a href="https://s3.amazonaws.com/static.nomic.ai/gpt4all/2023_GPT4All_Technical_Report.pdf">:green_book: Technical Report</a>
</p>
<p align="center">
<a href="https://discord.gg/kvmy6dQB">Discord</a>
<a href="https://github.com/nomic-ai/pyllamacpp">:snake: Official Python Bindings</a>
</p>
<p align="center">
<a href="https://discord.gg/mGZE39AS3e">Discord</a>
</p>
@@ -16,20 +22,83 @@ Run on M1 Mac (not sped up!)
# Try it yourself
Download the CPU quantized gpt4all model checkpoint: [gpt4all-lora-quantized.bin](https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized.bin).
Here's how to get started with the CPU quantized GPT4All model checkpoint:
1. Download the `gpt4all-lora-quantized.bin` file from [Direct Link](https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized.bin) or [[Torrent-Magnet]](https://tinyurl.com/gpt4all-lora-quantized).
2. Clone this repository, navigate to `chat`, and place the downloaded file there.
3. Run the appropriate command for your OS:
- M1 Mac/OSX: `cd chat;./gpt4all-lora-quantized-OSX-m1`
- Linux: `cd chat;./gpt4all-lora-quantized-linux-x86`
- Windows (PowerShell): `cd chat;./gpt4all-lora-quantized-win64.exe`
- Intel Mac/OSX: `cd chat;./gpt4all-lora-quantized-OSX-intel`
Clone this repository down and place the quantized model in the `chat` directory and start chatting by running:
For custom hardware compilation, see our [llama.cpp](https://github.com/zanussbaum/gpt4all.cpp) fork.
- `cd chat;./gpt4all-lora-quantized-OSX-m1` on M1 Mac/OSX
- `cd chat;./gpt4all-lora-quantized-linux-x86` on Linux
- `cd chat;./gpt4all-lora-quantized-win64.exe` on Windows (PowerShell)
- `cd chat;./gpt4all-lora-quantized-OSX-intel` on Intel Mac/OSX
-----------
To compile for custom hardware, see our fork of the [Alpaca C++](https://github.com/zanussbaum/gpt4all.cpp) repo.
[Secret Unfiltered Checkpoint](https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-unfiltered-quantized.bin) - [[Torrent]](https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-unfiltered-quantized.bin.torrent)
This model had all refusal to answer responses removed from training. Try it with:
- `cd chat;./gpt4all-lora-quantized-OSX-m1 -m gpt4all-lora-unfiltered-quantized.bin`
-----------
Note: the full model on GPU (16GB of RAM required) performs much better in our qualitative evaluations.
# Python Client
## CPU Interface
To run GPT4all in python, see the new [official Python bindings](https://github.com/nomic-ai/pyllamacpp).
The old bindings are still available but now deprecated. They will not work in a notebook environment.
To get running using the python client with the CPU interface, first install the [nomic client](https://github.com/nomic-ai/nomic) using `pip install nomic`
Then, you can use the following script to interact with GPT4All:
```
from nomic.gpt4all import GPT4All
m = GPT4All()
m.open()
m.prompt('write me a story about a lonely computer')
```
## GPU Interface
There are two ways to get up and running with this model on GPU.
The setup here is slightly more involved than the CPU model.
1. clone the nomic client [repo](https://github.com/nomic-ai/nomic) and run `pip install .[GPT4All]` in the home dir.
2. run `pip install nomic` and install the additional deps from the wheels built [here](https://github.com/nomic-ai/nomic/tree/main/bin)
Once this is done, you can run the model on GPU with a script like the following:
```
from nomic.gpt4all import GPT4AllGPU
m = GPT4AllGPU(LLAMA_PATH)
config = {'num_beams': 2,
'min_new_tokens': 10,
'max_length': 100,
'repetition_penalty': 2.0}
out = m.generate('write me a story about a lonely computer', config)
print(out)
```
Where LLAMA_PATH is the path to a Huggingface Automodel compliant LLAMA model.
Nomic is unable to distribute this file at this time.
We are working on a GPT4All that does not have this limitation right now.
You can pass any of the [huggingface generation config params](https://huggingface.co/docs/transformers/main_classes/text_generation#transformers.GenerationConfig) in the config.
# Roadmap
## Short Term
- <span style="color:green">(IN PROGRESS)</span> Train a GPT4All model based on GPTJ to alleviate llama distribution issues.
- <span style="color:green">(IN PROGRESS)</span> Create improved CPU and GPU interfaces for this model.
- <span style="color:red">(NOT STARTED)</span> Integrate llama.cpp bindings
- <span style="color:red">(NOT STARTED)</span> Create a good conversational chat interface for the model.
- <span style="color:red">(NOT STARTED)</span> Allow users to opt in and submit their chats for subsequent training runs
## Medium Term
- <span style="color:red">(NOT STARTED)</span> Integrate GPT4All with [Atlas](https://atlas.nomic.ai) to allow for document retrieval.
- BLOCKED by GPT4All based on GPTJ
- <span style="color:red">(NOT STARTED)</span> Integrate GPT4All with Langchain.
- <span style="color:green">(IN PROGRESS)</span> Build easy custom training scripts to allow users to fine tune models.
## Long Term
- <span style="color:red">(NOT STARTED)</span> Allow anyone to curate training data for subsequent GPT4All releases using Atlas.
- <span style="color:green">(IN PROGRESS)</span> Democratize AI.
# Reproducibility
Trained LoRa Weights:
@@ -37,9 +106,9 @@ Trained LoRa Weights:
- gpt4all-lora-epoch-2 (three full epochs of training) https://huggingface.co/nomic-ai/gpt4all-lora-epoch-2
Raw Data:
- [Training Data Without P3](https://s3.amazonaws.com/static.nomic.ai/gpt4all/2022_03_27/gpt4all_curated_data_without_p3_2022_03_27.tar.gz)
- [Training Data Without P3](https://huggingface.co/datasets/nomic-ai/gpt4all_prompt_generations)
- Explorer: https://atlas.nomic.ai/map/gpt4all_data_clean_without_p3
- [Full Dataset with P3](https://s3.amazonaws.com/static.nomic.ai/gpt4all/2022_03_27/gpt4all_curated_data_full_2022_03_27.tar.gz)
- [Full Dataset with P3](https://huggingface.co/datasets/nomic-ai/gpt4all_prompt_generations_with_p3)
- Explorer: https://atlas.nomic.ai/map/gpt4all_data_clean
We are not distributing a LLaMa 7B checkpoint.
@@ -50,9 +119,10 @@ You can reproduce our trained model by doing the following:
Clone the repo
`git clone --recurse-submodules https://github.com/nomic-ai/gpt4all.git`
`git submodule configure && git submodule update`
```
git clone --recurse-submodules https://github.com/nomic-ai/gpt4all.git
git submodule update --init
```
Setup the environment
@@ -78,6 +148,10 @@ accelerate launch --dynamo_backend=inductor --num_processes=8 --num_machines=1 -
python generate.py --config configs/generate/generate.yaml --prompt "Write a script to reverse a string in Python"
```
## Need Help?
Join the <a href="https://discord.gg/kvmy6dQB"> Discord </a> and ask for help in `#gpt4all-help`
# Sample Generations
### Provide instructions for the given exercise. Leg Raises
@@ -147,7 +221,7 @@ python generate.py --config configs/generate/generate.yaml --prompt "Write a scr
### What is a three word topic describing the following keywords: baseball, football, soccer:
>Sports, athletics, games
## Citation
If you utilize this reposistory, models or data in a downstream project, please consider citing it with:
```
@@ -160,7 +234,3 @@ If you utilize this reposistory, models or data in a downstream project, please
howpublished = {\url{https://github.com/nomic-ai/gpt4all}},
}
```
### Alternative Download Locations
#### gpt4all-lora-quantized.bin Backup Torrent Link
magnet:?xt=urn:btih:1F11A9691EE06C18F0040E359361DCA0479BCB5A&dn=gpt4all-lora-quantized.bin&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce

View File

@@ -160,7 +160,7 @@ We realized that we had two bugs however:
- We accidentally duplicated data and effectively trained for 2 epochs instead of 1
- We added an eos token to every sequence, even those that we truncated (e.g. long code that exceeds the 1024).
## Conditonal EOS and 1 Epoch
## Conditional EOS and 1 Epoch
Using the same parameters, we then trained a model using a "conditional" eos token where we only add an `eos` when the inputs are less than the maximum sequence length for one epoch.

View File

@@ -1,15 +0,0 @@
# model/tokenizer
model_name: # update with llama 7b
tokenizer_name: # update with llama 7b
lora: true
lora_path: "nomic-ai/gpt4all-lora"
max_new_tokens: 512
temperature: 0.001
prompt: |
#this code prints a string reversed
my_string = "hello how are you"
print(len(my_string))
My code above does not work. Can you help me?

View File

@@ -1,11 +1,13 @@
# model/tokenizer
model_name: # update with llama model name
tokenizer_name: # update with llama model name
model_name: "zpn/llama-7b"
tokenizer_name: "zpn/llama-7b"
lora: true
lora_path: "tloen/alpaca-lora-7b"
stride: 512
num_proc: 64
batch_size: 1
max_new_tokens: 512
temperature: 0.001
prompt: |

View File

@@ -1,14 +0,0 @@
# model/tokenizer
model_name: # update
tokenizer_name: # update
lora_path: "no-lora"
max_new_tokens: 512
temperature: 0.001
prompt: |
#this code prints a string reversed
my_string = "hello how are you"
print(len(my_string))
My code above does not work. Can you help me?

View File

@@ -0,0 +1,9 @@
# model/tokenizer
model_name: "nomic-ai/gpt4all-gptj-multinode-deepspeed-epoch_0"
tokenizer_name: "EleutherAI/gpt-j-6B"
lora: false
lora_path: null
stride: 512
num_proc: 64
batch_size: 1

View File

@@ -0,0 +1,9 @@
# model/tokenizer
model_name: "zpn/llama-7b"
tokenizer_name: "zpn/llama-7b"
lora: true
lora_path: "nomic-ai/gpt4all-lora"
stride: 512
num_proc: 64
batch_size: 1

View File

@@ -1,15 +0,0 @@
# model/tokenizer
model_name: # update
tokenizer_name: # update
lora: true
lora_path: # update
max_new_tokens: 512
temperature: 0.001
prompt: |
#this code prints a string reversed
my_string = "hello how are you"
print(len(my_string))
My code above does not work. Can you help me?

View File

@@ -1,15 +0,0 @@
# model/tokenizer
model_name: # update
tokenizer_name: # update
lora: true
lora_path: # update
max_new_tokens: 512
temperature: 0.001
prompt: |
#this code prints a string reversed
my_string = "hello how are you"
print(len(my_string))
My code above does not work. Can you help me?

View File

@@ -68,7 +68,7 @@ def load_data(config, tokenizer):
dataset = load_dataset("json", data_files=files, split="train")
else:
dataset = load_dataset(dataset_path)
dataset = load_dataset(dataset_path,split='train')
dataset = dataset.train_test_split(test_size=.05, seed=config["seed"])

View File

@@ -5,8 +5,8 @@ from matplotlib import pyplot as plt
plt.figure()
for fpath in glob.glob('./eval_data/*.pkl'):
parts = fpath.split('__')
model_name = parts[1].replace('model-', '').replace('.pkl', '')
parts = fpath.split('_')
model_name = "-".join(fpath.replace(".pkl", "").split("_")[2:])
lora_name = parts[2].replace('lora-', '').replace('.pkl', '')
with open(fpath, 'rb') as f:
data = pickle.load(f)
@@ -14,7 +14,7 @@ for fpath in glob.glob('./eval_data/*.pkl'):
perplexities = np.nan_to_num(perplexities, 100)
perplexities = np.clip(perplexities, 0, 100)
if 'nomic' in fpath:
label = 'GPT4all-lora'
label = f'GPT4all-{model_name}'
else:
label = 'alpaca-lora'
plt.hist(perplexities, label=label, alpha=.5)

88
launcher.sh Normal file
View File

@@ -0,0 +1,88 @@
#!/bin/bash
# Display header
echo "=========================================================="
echo " ██████ ██████ ████████ ██ ██ █████ ██ ██ "
echo "██ ██ ██ ██ ██ ██ ██ ██ ██ ██ "
echo "██ ███ ██████ ██ ███████ ███████ ██ ██ "
echo "██ ██ ██ ██ ██ ██ ██ ██ ██ "
echo " ██████ ██ ██ ██ ██ ██ ███████ ███████ "
echo " └─> https://github.com/nomic-ai/gpt4all"
# Function to detect macOS architecture and set the binary filename
detect_mac_arch() {
local mac_arch
mac_arch=$(uname -m)
case "$mac_arch" in
arm64)
os_type="M1 Mac/OSX"
binary_filename="gpt4all-lora-quantized-OSX-m1"
;;
x86_64)
os_type="Intel Mac/OSX"
binary_filename="gpt4all-lora-quantized-OSX-intel"
;;
*)
echo "Unknown macOS architecture"
exit 1
;;
esac
}
# Detect operating system and set the binary filename
case "$(uname -s)" in
Darwin*)
detect_mac_arch
;;
Linux*)
if grep -q Microsoft /proc/version; then
os_type="Windows (WSL)"
binary_filename="gpt4all-lora-quantized-win64.exe"
else
os_type="Linux"
binary_filename="gpt4all-lora-quantized-linux-x86"
fi
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
os_type="Windows (Cygwin/MSYS/MINGW)"
binary_filename="gpt4all-lora-quantized-win64.exe"
;;
*)
echo "Unknown operating system"
exit 1
;;
esac
echo "================================"
echo "== You are using $os_type."
# Change to the chat directory
cd chat
# List .bin files and prompt user to select one
bin_files=(*.bin)
echo "== Available .bin files:"
for i in "${!bin_files[@]}"; do
echo " [$((i+1))] ${bin_files[i]}"
done
# Function to get user input and validate it
get_valid_user_input() {
local input_valid=false
while ! $input_valid; do
echo "==> Please enter a number:"
read -r user_selection
if [[ $user_selection =~ ^[0-9]+$ ]] && (( user_selection >= 1 && user_selection <= ${#bin_files[@]} )); then
input_valid=true
else
echo "Invalid input. Please enter a number between 1 and ${#bin_files[@]}."
fi
done
}
get_valid_user_input
selected_bin_file="${bin_files[$((user_selection-1))]}"
# Run the selected .bin file with the appropriate command
./"$binary_filename" -m "$selected_bin_file"

View File

@@ -9,4 +9,5 @@ peft
nodelist-inflator
deepspeed
sentencepiece
jsonlines
jsonlines
matplotlib