mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2026-07-17 01:55:28 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af7a4004c8 | ||
|
|
b8f39c5104 | ||
|
|
8cbc63b017 | ||
|
|
06ad467b7d | ||
|
|
16ce7396c1 | ||
|
|
d1bb2aac29 | ||
|
|
b9861f7510 | ||
|
|
bc7eb80e02 | ||
|
|
0429db0244 | ||
|
|
210bf3c9cf | ||
|
|
708e0b486d | ||
|
|
ad782620ac | ||
|
|
e8c6aeeea2 | ||
|
|
987c694afa | ||
|
|
822fa0c47a | ||
|
|
d8921f835d | ||
|
|
54932a51cb | ||
|
|
cfcb101443 | ||
|
|
73dbd34310 | ||
|
|
03b9e2004e | ||
|
|
98ae021ea6 | ||
|
|
147094e892 | ||
|
|
fa91e2b980 | ||
|
|
ed35d1fbb0 | ||
|
|
2db43570ae |
88
README.md
88
README.md
@@ -16,20 +16,80 @@ 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 [Alpaca C++](https://github.com/zanussbaum/gpt4all.cpp) repository.
|
||||
|
||||
- `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 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 +97,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.
|
||||
@@ -78,6 +138,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 +211,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 +224,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
|
||||
|
||||
15
configs/eval/generate_gptj_0.yaml
Normal file
15
configs/eval/generate_gptj_0.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
# model/tokenizer
|
||||
model_name: 'nomic-ai/gpt4all-gptj-epoch_0'
|
||||
tokenizer_name: 'EleutherAI/gpt-j-6B'
|
||||
lora: false
|
||||
lora_path: 'nolora'
|
||||
|
||||
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?
|
||||
@@ -22,24 +22,25 @@ def read_jsonl_file(file_path):
|
||||
return data
|
||||
|
||||
def setup_model(config):
|
||||
model = AutoModelForCausalLM.from_pretrained(config["model_name"], device_map="auto", torch_dtype=torch.float16, output_hidden_states=True)
|
||||
model = AutoModelForCausalLM.from_pretrained(config["model_name"], device_map="auto", torch_dtype=torch.float16, output_hidden_states=True, use_auth_token=True)
|
||||
tokenizer = AutoTokenizer.from_pretrained(config["tokenizer_name"])
|
||||
added_tokens = tokenizer.add_special_tokens({"bos_token": "<s>", "eos_token": "</s>", "pad_token": "<pad>"})
|
||||
if "gptj" in config["model_name"]:
|
||||
tokenizer.pad_token = tokenizer.eos_token
|
||||
else:
|
||||
added_tokens = tokenizer.add_special_tokens({"bos_token": "<s>", "eos_token": "</s>", "pad_token": "<pad>"})
|
||||
|
||||
if added_tokens > 0:
|
||||
model.resize_token_embeddings(len(tokenizer))
|
||||
if added_tokens > 0:
|
||||
model.resize_token_embeddings(len(tokenizer))
|
||||
|
||||
if 'lora' in config and config['lora']:
|
||||
model = PeftModelForCausalLM.from_pretrained(model, config["lora_path"], device_map="auto", torch_dtype=torch.float16, return_hidden_states=True)
|
||||
model.to(dtype=torch.float16)
|
||||
if config["lora"]:
|
||||
model = PeftModelForCausalLM.from_pretrained(model, config["lora_path"], device_map="auto", torch_dtype=torch.float16)
|
||||
|
||||
model.to(dtype=torch.float16)
|
||||
print(f"Mem needed: {model.get_memory_footprint() / 1024 / 1024 / 1024:.2f} GB")
|
||||
|
||||
return model, tokenizer
|
||||
|
||||
|
||||
|
||||
|
||||
def eval_example(model, tokenizer, example, config):
|
||||
|
||||
prompt = example['instruction'] + ' ' + example['instances'][0]['input']
|
||||
|
||||
Reference in New Issue
Block a user