0
stars
1,936
commits
Python
primary language
Jun 18, 2023
updated
Technical Paper: https://arxiv.org/pdf/2306.08161.pdf
h2oGPT is a large language model (LLM) fine-tuning framework and chatbot UI with document(s) question-answer capabilities. Documents help to ground LLMs against hallucinations by providing them context relevant to the instruction. h2oGPT is fully permissive Apache V2 open-source project for 100% private and secure use of LLMs and document embeddings for document question-answer.
Welcome! Join us and make an issue or a PR, and contribute to making the best fine-tuned LLMs, chatbot UI, and document question-answer framework!
Turn ★ into ⭐ (top-right corner) if you like the project!
Live hosted instances:
For questions, discussing, or just hanging out, come and join our Discord!
GPU mode requires CUDA support via torch and transformers. A 6.9B (or 12GB) model in 8-bit uses 7GB (or 13GB) of GPU memory. 8-bit or 4-bit precision can further reduce memory requirements.
CPU mode uses GPT4ALL and LLaMa.cpp, e.g. gpt4all-j, requiring about 14GB of system RAM in typical use.
GPU and CPU mode tested on variety of NVIDIA GPUs in Ubuntu 18-22, but any modern Linux variant should work. MACOS support tested on Macbook Pro running Monterey v12.3.1 using CPU mode.
Light mode with soft colors talking to cat image:

Dark mode with H2O.ai colors:

https://user-images.githubusercontent.com/6147661/232924684-6c0e2dfb-2f24-4098-848a-c3e4396f29f6.mov
All open-source datasets and models are posted on 🤗 H2O.ai's Hugging Face page.
Also check out H2O LLM Studio for our no-code LLM fine-tuning framework!
First one needs a Python 3.10 environment. For help installing a Python 3.10 environment, see Install Python 3.10 Environment. On newer Ubuntu systems and environment may be installed by just doing:
sudo apt-get install -y build-essential gcc python3.10-dev
Check your installation by doing:
python --version # should say 3.10.xx
pip --version # should say pip 23.x.y ... (python 3.10)
On some systems, pip still refers back to the system one, then one can use python -m pip or pip3 instead of pip or try python3 instead of python.
After Python 3.10 environment installed:
git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
# broad support, but no training-time or data creation dependencies
for fil in requirements.txt reqs_optional/requirements_optional_langchain.txt reqs_optional/requirements_optional_gpt4all.txt reqs_optional/requirements_optional_langchain.gpllike.txt ; do pip install -r $fil ; done
# Optional: support docx, pptx, ArXiv, etc.
sudo apt-get install -y libmagic-dev poppler-utils tesseract-ocr libreoffice
# Optional: for supporting unstructured package
python -m nltk.downloader all
Place all documents in user_path or upload in UI.
UI using GPU with at least 24GB with streaming:
python generate.py --base_model=h2oai/h2ogpt-oasst1-512-12b --load_8bit=True --score_model=None --langchain_mode='UserData' --user_path=user_path
UI using CPU (streaming not yet supported in UI):
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None --langchain_mode='UserData' --user_path=user_path
For help installing cuda toolkit, see CUDA Toolkit
git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu117
python generate.py --base_model=h2oai/h2ogpt-oig-oasst1-512-6_9b --load_8bit=True
Then point browser at http://0.0.0.0:7860 (linux) or http://localhost:7860 (windows/mac) or the public live URL printed by the server (disable shared link with --share=False). For 4-bit or 8-bit support, older GPUs may require older bitsandbytes installed as pip uninstall bitsandbytes -y ; pip install bitsandbytes==0.38.1. For production uses, we recommend at least the 12B model, ran as:
python generate.py --base_model=h2oai/h2ogpt-oasst1-512-12b --load_8bit=True
and one can use --h2ocolors=False to get soft blue-gray colors instead of H2O.ai colors. Here is a list of environment variables that can control some things in generate.py.
Note if you download the model yourself and point --base_model to that location, you'll need to specify the prompt_type as well by running:
python generate.py --base_model=<user path> --load_8bit=True --prompt_type=human_bot
for some user path <user path>.
For quickly using a private document collection for Q/A, place documents (PDFs, text, etc.) into a folder called user_path and run
pip install -r reqs_optional/requirements_optional_langchain.txt
python -m nltk.downloader all # for supporting unstructured package
python generate.py --base_model=h2oai/h2ogpt-oig-oasst1-512-6_9b --load_8bit=True --langchain_mode=UserData --user_path=user_path
For more ways to ingest on CLI and control see LangChain Readme. For example, for improved pdf handling via pymupdf (GPL) and support for docx, ppt, OCR, and ArXiV run:
sudo apt-get install -y libmagic-dev poppler-utils tesseract-ocr tesseract-ocr libreoffice
pip install -r reqs_optional/requirements_optional_langchain.gpllike.txt
For 4-bit support, the latest dev versions of transformers, accelerate, and peft are required, which can be installed by running:
pip uninstall peft transformers accelerate -y
pip install -r reqs_optional/requirements_optional_4bit.txt
where uninstall is required in case, e.g., peft was installed from GitHub previously. Then when running generate pass --load_4bit=True, which is only supported for certain architectures like GPT-NeoX-20B, GPT-J, LLaMa, etc.
Any other instruct-tuned base models can be used, including non-h2oGPT ones. Larger models require more GPU memory.
CPU support is obtained after installing two optional requirements.txt files. This does not preclude GPU support, just adds CPU support:
git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
pip install -r requirements.txt # only do if didn't already do for GPU support, since windows needs --extra-index-url line
pip install -r reqs_optional/requirements_optional_langchain.txt
python -m nltk.downloader all # for supporting unstructured package
pip install -r reqs_optional/requirements_optional_gpt4all.txt
See GPT4All for details on installation instructions if any issues encountered.
.env_gpt4all model name if desired.model_path_llama=WizardLM-7B-uncensored.ggmlv3.q8_0.bin
model_path_gptj=ggml-gpt4all-j-v1.3-groovy.bin
model_name_gpt4all_llama=ggml-wizardLM-7B.q4_2.bin
For gptj and gpt4all_llama, you can choose a different model than our default choice by going to GPT4All Model explorer GPT4All-J compatible model. One does not need to download manually, the gp4all package will download at runtime and put it into .cache like Hugging Face would. However, gpjt model often gives no output, even outside h2oGPT.
So, for chatting, a better instruct fine-tuned LLaMa-based model for llama.cpp can be downloaded from TheBloke. For example, 13B WizardLM Quantized or 7B WizardLM Quantized. TheBloke has a variety of model types, quantization bit depths, and memory consumption. Choose what is best for your system's specs. However, be aware that LLaMa-based models are not commercially viable.
For 7B case, download WizardLM-7B-uncensored.ggmlv3.q8_0.bin into local path. Then one sets model_path_llama in .env_gpt4all, which is currently the default.
For LangChain support using documents in user_path folder, run h2oGPT like:
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None --langchain_mode='UserData' --user_path=user_path
See LangChain Readme for more details. For no langchain support (still uses LangChain package as model wrapper), run as:
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None
No streaming is currently supported for these CPU models in UI, but that will be fixed soon.
When using llama.cpp based CPU models, for computers with low system RAM or slow CPUs, we recommend adding to .env_gpt4all:
use_mlock=False
n_ctx=1024
where use_mlock=True is default to avoid slowness and n_ctx=2048 is default for large context handling. For computers with plenty of system RAM, we recommend adding to .env_gpt4all:
n_batch=1024
for faster handling. One some systems this has no strong effect, but on others may increase speed quite a bit.
Also, for slow and low-memory systems, we recommend using a smaller embedding by using with generrate.py:
python generate.py ... --hf_embedding_model=sentence-transformers/all-MiniLM-L6-v2
where ... means any other options one should add like --base_model etc. This simpler embedding is about half the size as default instruct-large and so uses less disk, CPU memory, and GPU memory if using GPUs.
First install Rust:
curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh
Enter new shell and test: rustc --version
When running a Mac with Intel hardware (not M1), you may run into _clang: error: the clang compiler does not support '-march=native'_ during pip install.
If so, set your archflags during pip install. eg: ARCHFLAGS="-arch x86_64" pip3 install -r requirements.txt
If you encounter an error while building a wheel during the pip install process, you may need to install a C++ compiler on your computer.
Now go back to normal CPU installation.
Follow these steps, which includes the above GPU or CPU install step at one point:
set path=%path%;c:\MinGW\msys\1.0\bin\ to get C++ in pathconda install cudatoolkit -c conda-forge as required easily make bitsandbytes workwsl --installpip install with --extra-index-url https://download.pytorch.org/whl/cu117 as in GPU sectionFor GPU support of 4-bit and 8-bit, run:
pip uninstall bitsandbytes
pip install https://github.com/jllllll/bitsandbytes-windows-webui/raw/main/bitsandbytes-0.39.0-py3-none-any.whl
unless you have compute capability <7.0, then your GPU only supports 8-bit (not 4-bit) and you should install older bitsandbytes:
pip uninstall bitsandbytes
pip install https://github.com/jllllll/bitsandbytes-windows-webui/raw/main/bitsandbytes-0.38.1-py3-none-any.whl
When running windows on GPUs with bitsandbytes you should see something like:
(h2ogpt) c:\Users\pseud\h2ogpt>python generate.py --base_model=h2oai/h2ogpt-oig-oasst1-512-6_9b --load_8bit=True
bin C:\Users\pseud\.conda\envs\h2ogpt\lib\site-packages\bitsandbytes\libbitsandbytes_cuda118.dll
Using Model h2oai/h2ogpt-oig-oasst1-512-6_9b
device_map: {'': 0}
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:06<00:00, 2.16s/it]
device_map: {'': 1}
Running on local URL: http://0.0.0.0:7860
Running on public URL: https://f8fa95f123416c72dc.gradio.live
This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
where bitsandbytes cuda118 was used because conda cuda toolkit is cuda 11.8. You can confirm GPU use via nvidia-smi showing GPU memory consumed.
Note 8-bit inference is about twice slower than 16-bit inference, and the only use of 8-bit is to keep memory profile low.
Bitsandbytes can be uninstalled (pip uninstall bitsandbytes) and still h2oGPT can be used if one does not pass --load_8bit=True.
The CLI can be used instead of gradio by running for some base model, e.g.:
python generate.py --base_model=gptj --cli=True
and for LangChain run:
python make_db.py --user_path=user_path --collection_name=UserData
python generate.py --base_model=gptj --cli=True --langchain_mode=UserData
with documents in user_path folder, or directly run:
python generate.py --base_model=gptj --cli=True --langchain_mode=UserData --user_path=user_path
which will build the database first time. One can also use any other models, like:
python generate.py --base_model=h2oai/h2ogpt-oig-oasst1-512-6_9b --cli=True --langchain_mode=UserData --user_path=user_path
or for WizardLM:
python generate.py --base_model='llama' --prompt_type=wizard2 --cli=True --langchain_mode=UserData --user_path=user_path
No streaming is currently supported for llama in CLI chat, but that will be fixed soon.
generate.py by default runs a gradio server with a UI (click for help with UI). Key benefits of the UI include:
See how we compare to other tools like PrivateGPT, see our comparisons at h2oGPT's LangChain Integration FAQ.
We disable background uploads by disabling telemetry for Hugging Face, gradio, and chroma, and one can additionally avoid downloads (of fonts) by running generate.py with --gradio_offline_level=2. See Offline Documentation for details.
generate.py by default runs a gradio server, which also gives access to client API using gradio client. See example test code or other tests in our tests. Any element in gradio_runner.py with api_name defined can be accessed via the gradio client.
An OpenAI compliant client is available. Refer the README for more details.
The wheel adds all dependencies including optional dependencies like 4-bit and flash-attention. To build do:
python setup.py sdist bdist_wheel
To install the default dependencies do:
pip install dist/h2ogpt-0.1.0-py3-none-any.whl
replace 0.1.0 with actual version built if more than one.
To install additional dependencies, for instance for faiss on GPU, do:
pip install dist/h2ogpt-0.1.0-py3-none-any.whl
pip install dist/h2ogpt-0.1.0-py3-none-any.whl[FAISS]
once whl file is installed, two new scripts will be added to the current environment: h2ogpt_finetune, and h2ogpt_generate.
The wheel is not required to use h2oGPT locally from repo, but makes it portable with all required dependencies.
See setup.py for controlling other options via extras_require.
Flash attention support, see Flash Attention
Docker for inference.
More Links, context, competitors, models, datasets
Our Makers at H2O.ai have built several world-class Machine Learning, Deep Learning and AI platforms:
We also built platforms for deployment and monitoring, and for data wrangling and governance:
Many of our customers are creating models and deploying them enterprise-wide and at scale in the H2O AI Cloud:
We are proud to have over 25 (of the world's 280) Kaggle Grandmasters call H2O home, including three Kaggle Grandmasters who have made it to world #1.
Please read this disclaimer carefully before using the large language model provided in this repository. Your use of the model signifies your agreement to the following terms and conditions.
By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.
Python
89.8%
TeX
8.7%
0
stars
1,936
commits
Python
primary language
Jun 18, 2023
updated
Technical Paper: https://arxiv.org/pdf/2306.08161.pdf
h2oGPT is a large language model (LLM) fine-tuning framework and chatbot UI with document(s) question-answer capabilities. Documents help to ground LLMs against hallucinations by providing them context relevant to the instruction. h2oGPT is fully permissive Apache V2 open-source project for 100% private and secure use of LLMs and document embeddings for document question-answer.
Welcome! Join us and make an issue or a PR, and contribute to making the best fine-tuned LLMs, chatbot UI, and document question-answer framework!
Turn ★ into ⭐ (top-right corner) if you like the project!
Live hosted instances:
For questions, discussing, or just hanging out, come and join our Discord!
GPU mode requires CUDA support via torch and transformers. A 6.9B (or 12GB) model in 8-bit uses 7GB (or 13GB) of GPU memory. 8-bit or 4-bit precision can further reduce memory requirements.
CPU mode uses GPT4ALL and LLaMa.cpp, e.g. gpt4all-j, requiring about 14GB of system RAM in typical use.
GPU and CPU mode tested on variety of NVIDIA GPUs in Ubuntu 18-22, but any modern Linux variant should work. MACOS support tested on Macbook Pro running Monterey v12.3.1 using CPU mode.
Light mode with soft colors talking to cat image:

Dark mode with H2O.ai colors:

https://user-images.githubusercontent.com/6147661/232924684-6c0e2dfb-2f24-4098-848a-c3e4396f29f6.mov
All open-source datasets and models are posted on 🤗 H2O.ai's Hugging Face page.
Also check out H2O LLM Studio for our no-code LLM fine-tuning framework!
First one needs a Python 3.10 environment. For help installing a Python 3.10 environment, see Install Python 3.10 Environment. On newer Ubuntu systems and environment may be installed by just doing:
sudo apt-get install -y build-essential gcc python3.10-dev
Check your installation by doing:
python --version # should say 3.10.xx
pip --version # should say pip 23.x.y ... (python 3.10)
On some systems, pip still refers back to the system one, then one can use python -m pip or pip3 instead of pip or try python3 instead of python.
After Python 3.10 environment installed:
git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
# broad support, but no training-time or data creation dependencies
for fil in requirements.txt reqs_optional/requirements_optional_langchain.txt reqs_optional/requirements_optional_gpt4all.txt reqs_optional/requirements_optional_langchain.gpllike.txt ; do pip install -r $fil ; done
# Optional: support docx, pptx, ArXiv, etc.
sudo apt-get install -y libmagic-dev poppler-utils tesseract-ocr libreoffice
# Optional: for supporting unstructured package
python -m nltk.downloader all
Place all documents in user_path or upload in UI.
UI using GPU with at least 24GB with streaming:
python generate.py --base_model=h2oai/h2ogpt-oasst1-512-12b --load_8bit=True --score_model=None --langchain_mode='UserData' --user_path=user_path
UI using CPU (streaming not yet supported in UI):
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None --langchain_mode='UserData' --user_path=user_path
For help installing cuda toolkit, see CUDA Toolkit
git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu117
python generate.py --base_model=h2oai/h2ogpt-oig-oasst1-512-6_9b --load_8bit=True
Then point browser at http://0.0.0.0:7860 (linux) or http://localhost:7860 (windows/mac) or the public live URL printed by the server (disable shared link with --share=False). For 4-bit or 8-bit support, older GPUs may require older bitsandbytes installed as pip uninstall bitsandbytes -y ; pip install bitsandbytes==0.38.1. For production uses, we recommend at least the 12B model, ran as:
python generate.py --base_model=h2oai/h2ogpt-oasst1-512-12b --load_8bit=True
and one can use --h2ocolors=False to get soft blue-gray colors instead of H2O.ai colors. Here is a list of environment variables that can control some things in generate.py.
Note if you download the model yourself and point --base_model to that location, you'll need to specify the prompt_type as well by running:
python generate.py --base_model=<user path> --load_8bit=True --prompt_type=human_bot
for some user path <user path>.
For quickly using a private document collection for Q/A, place documents (PDFs, text, etc.) into a folder called user_path and run
pip install -r reqs_optional/requirements_optional_langchain.txt
python -m nltk.downloader all # for supporting unstructured package
python generate.py --base_model=h2oai/h2ogpt-oig-oasst1-512-6_9b --load_8bit=True --langchain_mode=UserData --user_path=user_path
For more ways to ingest on CLI and control see LangChain Readme. For example, for improved pdf handling via pymupdf (GPL) and support for docx, ppt, OCR, and ArXiV run:
sudo apt-get install -y libmagic-dev poppler-utils tesseract-ocr tesseract-ocr libreoffice
pip install -r reqs_optional/requirements_optional_langchain.gpllike.txt
For 4-bit support, the latest dev versions of transformers, accelerate, and peft are required, which can be installed by running:
pip uninstall peft transformers accelerate -y
pip install -r reqs_optional/requirements_optional_4bit.txt
where uninstall is required in case, e.g., peft was installed from GitHub previously. Then when running generate pass --load_4bit=True, which is only supported for certain architectures like GPT-NeoX-20B, GPT-J, LLaMa, etc.
Any other instruct-tuned base models can be used, including non-h2oGPT ones. Larger models require more GPU memory.
CPU support is obtained after installing two optional requirements.txt files. This does not preclude GPU support, just adds CPU support:
git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
pip install -r requirements.txt # only do if didn't already do for GPU support, since windows needs --extra-index-url line
pip install -r reqs_optional/requirements_optional_langchain.txt
python -m nltk.downloader all # for supporting unstructured package
pip install -r reqs_optional/requirements_optional_gpt4all.txt
See GPT4All for details on installation instructions if any issues encountered.
.env_gpt4all model name if desired.model_path_llama=WizardLM-7B-uncensored.ggmlv3.q8_0.bin
model_path_gptj=ggml-gpt4all-j-v1.3-groovy.bin
model_name_gpt4all_llama=ggml-wizardLM-7B.q4_2.bin
For gptj and gpt4all_llama, you can choose a different model than our default choice by going to GPT4All Model explorer GPT4All-J compatible model. One does not need to download manually, the gp4all package will download at runtime and put it into .cache like Hugging Face would. However, gpjt model often gives no output, even outside h2oGPT.
So, for chatting, a better instruct fine-tuned LLaMa-based model for llama.cpp can be downloaded from TheBloke. For example, 13B WizardLM Quantized or 7B WizardLM Quantized. TheBloke has a variety of model types, quantization bit depths, and memory consumption. Choose what is best for your system's specs. However, be aware that LLaMa-based models are not commercially viable.
For 7B case, download WizardLM-7B-uncensored.ggmlv3.q8_0.bin into local path. Then one sets model_path_llama in .env_gpt4all, which is currently the default.
For LangChain support using documents in user_path folder, run h2oGPT like:
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None --langchain_mode='UserData' --user_path=user_path
See LangChain Readme for more details. For no langchain support (still uses LangChain package as model wrapper), run as:
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None
No streaming is currently supported for these CPU models in UI, but that will be fixed soon.
When using llama.cpp based CPU models, for computers with low system RAM or slow CPUs, we recommend adding to .env_gpt4all:
use_mlock=False
n_ctx=1024
where use_mlock=True is default to avoid slowness and n_ctx=2048 is default for large context handling. For computers with plenty of system RAM, we recommend adding to .env_gpt4all:
n_batch=1024
for faster handling. One some systems this has no strong effect, but on others may increase speed quite a bit.
Also, for slow and low-memory systems, we recommend using a smaller embedding by using with generrate.py:
python generate.py ... --hf_embedding_model=sentence-transformers/all-MiniLM-L6-v2
where ... means any other options one should add like --base_model etc. This simpler embedding is about half the size as default instruct-large and so uses less disk, CPU memory, and GPU memory if using GPUs.
First install Rust:
curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh
Enter new shell and test: rustc --version
When running a Mac with Intel hardware (not M1), you may run into _clang: error: the clang compiler does not support '-march=native'_ during pip install.
If so, set your archflags during pip install. eg: ARCHFLAGS="-arch x86_64" pip3 install -r requirements.txt
If you encounter an error while building a wheel during the pip install process, you may need to install a C++ compiler on your computer.
Now go back to normal CPU installation.
Follow these steps, which includes the above GPU or CPU install step at one point:
set path=%path%;c:\MinGW\msys\1.0\bin\ to get C++ in pathconda install cudatoolkit -c conda-forge as required easily make bitsandbytes workwsl --installpip install with --extra-index-url https://download.pytorch.org/whl/cu117 as in GPU sectionFor GPU support of 4-bit and 8-bit, run:
pip uninstall bitsandbytes
pip install https://github.com/jllllll/bitsandbytes-windows-webui/raw/main/bitsandbytes-0.39.0-py3-none-any.whl
unless you have compute capability <7.0, then your GPU only supports 8-bit (not 4-bit) and you should install older bitsandbytes:
pip uninstall bitsandbytes
pip install https://github.com/jllllll/bitsandbytes-windows-webui/raw/main/bitsandbytes-0.38.1-py3-none-any.whl
When running windows on GPUs with bitsandbytes you should see something like:
(h2ogpt) c:\Users\pseud\h2ogpt>python generate.py --base_model=h2oai/h2ogpt-oig-oasst1-512-6_9b --load_8bit=True
bin C:\Users\pseud\.conda\envs\h2ogpt\lib\site-packages\bitsandbytes\libbitsandbytes_cuda118.dll
Using Model h2oai/h2ogpt-oig-oasst1-512-6_9b
device_map: {'': 0}
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:06<00:00, 2.16s/it]
device_map: {'': 1}
Running on local URL: http://0.0.0.0:7860
Running on public URL: https://f8fa95f123416c72dc.gradio.live
This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
where bitsandbytes cuda118 was used because conda cuda toolkit is cuda 11.8. You can confirm GPU use via nvidia-smi showing GPU memory consumed.
Note 8-bit inference is about twice slower than 16-bit inference, and the only use of 8-bit is to keep memory profile low.
Bitsandbytes can be uninstalled (pip uninstall bitsandbytes) and still h2oGPT can be used if one does not pass --load_8bit=True.
The CLI can be used instead of gradio by running for some base model, e.g.:
python generate.py --base_model=gptj --cli=True
and for LangChain run:
python make_db.py --user_path=user_path --collection_name=UserData
python generate.py --base_model=gptj --cli=True --langchain_mode=UserData
with documents in user_path folder, or directly run:
python generate.py --base_model=gptj --cli=True --langchain_mode=UserData --user_path=user_path
which will build the database first time. One can also use any other models, like:
python generate.py --base_model=h2oai/h2ogpt-oig-oasst1-512-6_9b --cli=True --langchain_mode=UserData --user_path=user_path
or for WizardLM:
python generate.py --base_model='llama' --prompt_type=wizard2 --cli=True --langchain_mode=UserData --user_path=user_path
No streaming is currently supported for llama in CLI chat, but that will be fixed soon.
generate.py by default runs a gradio server with a UI (click for help with UI). Key benefits of the UI include:
See how we compare to other tools like PrivateGPT, see our comparisons at h2oGPT's LangChain Integration FAQ.
We disable background uploads by disabling telemetry for Hugging Face, gradio, and chroma, and one can additionally avoid downloads (of fonts) by running generate.py with --gradio_offline_level=2. See Offline Documentation for details.
generate.py by default runs a gradio server, which also gives access to client API using gradio client. See example test code or other tests in our tests. Any element in gradio_runner.py with api_name defined can be accessed via the gradio client.
An OpenAI compliant client is available. Refer the README for more details.
The wheel adds all dependencies including optional dependencies like 4-bit and flash-attention. To build do:
python setup.py sdist bdist_wheel
To install the default dependencies do:
pip install dist/h2ogpt-0.1.0-py3-none-any.whl
replace 0.1.0 with actual version built if more than one.
To install additional dependencies, for instance for faiss on GPU, do:
pip install dist/h2ogpt-0.1.0-py3-none-any.whl
pip install dist/h2ogpt-0.1.0-py3-none-any.whl[FAISS]
once whl file is installed, two new scripts will be added to the current environment: h2ogpt_finetune, and h2ogpt_generate.
The wheel is not required to use h2oGPT locally from repo, but makes it portable with all required dependencies.
See setup.py for controlling other options via extras_require.
Flash attention support, see Flash Attention
Docker for inference.
More Links, context, competitors, models, datasets
Our Makers at H2O.ai have built several world-class Machine Learning, Deep Learning and AI platforms:
We also built platforms for deployment and monitoring, and for data wrangling and governance:
Many of our customers are creating models and deploying them enterprise-wide and at scale in the H2O AI Cloud:
We are proud to have over 25 (of the world's 280) Kaggle Grandmasters call H2O home, including three Kaggle Grandmasters who have made it to world #1.
Please read this disclaimer carefully before using the large language model provided in this repository. Your use of the model signifies your agreement to the following terms and conditions.
By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.
Python
89.8%
TeX
8.7%