HONO GPT for Chat and PDF
0
stars
2
commits
Python
primary language
Jul 31, 2023
updated
Turn ★ into ⭐ (top-right corner) if you like the project!
Query and summarize your documents (PDFs, Excel, Word, Images, Code, Text, MarkDown, etc.) or just chat using local private GPT LLMs (Falcon, Vicuna, WizardLM including AutoGPTQ) sourced from vector database (Chroma, FAISS, Weaviate) using accurate embeddings (instruct-large, all-MiniLM-L6-v1, etc.). Supports Linux, Windows, or MAC for both CPU and GPU. Clean UI or CLI supported with LLM streaming, with bake-off mode against any number of models in UI. OpenAI-compliant Python client access to the server.
Live h2oGPT Document Q/A Demohttps://github.com/h2oai/h2ogpt/assets/2249614/2f805035-2c85-42fb-807f-fd0bca79abc6
YouTube 4K version: https://www.youtube.com/watch?v=_iktbj4obAI
GPU mode requires CUDA support via torch and transformers. A 6.9B (or 12GB) model in 8-bit uses 8GB (or 13GB) of GPU memory. 8-bit precision, 4-bit precision, and AutoGPTQ can further reduce memory requirements down no more than about 6.5GB when asking a question about your documents (see low-memory mode).
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, as well as MAC M1 using MPS.
See how we compare to other tools like PrivateGPT, see our comparisons.
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
virtualenv -p python3 h2ogpt
source h2ogpt/bin/activate
or use conda:
conda create -n h2ogpt -y
conda activate h2ogpt
conda install python=3.10 -c conda-forge -y
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.
For MACOS and Windows 10/11 please follow their instructions.
On Ubuntu, after Python 3.10 environment installed do:
git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
# fix any bad env
pip uninstall -y pandoc pypandoc pypandoc-binary
# broad support, but no training-time or data creation dependencies
# CPU only:
pip install -r requirements.txt --extra-index https://download.pytorch.org/whl/cpu
# GPU only:
pip install -r requirements.txt --extra-index https://download.pytorch.org/whl/cu118
Then run:
# Required for Doc Q/A: LangChain:
pip install -r reqs_optional/requirements_optional_langchain.txt
# Required for CPU: LLaMa/GPT4All:
pip install -r reqs_optional/requirements_optional_gpt4all.txt
# Optional: PyMuPDF/ArXiv:
pip install -r reqs_optional/requirements_optional_langchain.gpllike.txt
# Optional: Selenium/PlayWright:
pip install -r reqs_optional/requirements_optional_langchain.urls.txt
# Optional: support docx, pptx, ArXiv, etc. required by some python packages
sudo apt-get install -y libmagic-dev poppler-utils tesseract-ocr libreoffice
# Optional: for supporting unstructured package
python -m nltk.downloader all
# Optional: For AutoGPTQ support on x86_64 linux
pip uninstall -y auto-gptq ; CUDA_HOME=/usr/local/cuda-11.8 GITHUB_ACTIONS=true pip install auto-gptq --no-cache-dir
See AutoGPTQ for more details for AutoGPTQ and other GPU installation aspects.
Place all documents in user_path or upload in UI (Help with 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
wget https://huggingface.co/TheBloke/WizardLM-7B-uncensored-GGML/resolve/main/WizardLM-7B-uncensored.ggmlv3.q8_0.bin
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None --langchain_mode='UserData' --user_path=user_path
If using OpenAI for the LLM is ok, but you want documents to be parsed and embedded locally, then do:
python generate.py --inference_server=openai_chat --base_model=gpt-3.5-turbo --score_model=None
and perhaps you want better image caption performance and focus local GPU on that, then do:
python generate.py --inference_server=openai_chat --base_model=gpt-3.5-turbo --score_model=None --captions_model=Salesforce/blip2-flan-t5-xl
Add --share=True to make gradio server visible via sharable URL. If you see an error about protobuf, try:
pip install protobuf==3.20.0
Once all files are downloaded, the CLI and UI can be run in offline mode, see offline mode.
pip install requirements-parser ; pytest -s -v tests client/testsFlash 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.
1 commits
1 commits
HONO GPT for Chat and PDF
0
stars
2
commits
Python
primary language
Jul 31, 2023
updated
Turn ★ into ⭐ (top-right corner) if you like the project!
Query and summarize your documents (PDFs, Excel, Word, Images, Code, Text, MarkDown, etc.) or just chat using local private GPT LLMs (Falcon, Vicuna, WizardLM including AutoGPTQ) sourced from vector database (Chroma, FAISS, Weaviate) using accurate embeddings (instruct-large, all-MiniLM-L6-v1, etc.). Supports Linux, Windows, or MAC for both CPU and GPU. Clean UI or CLI supported with LLM streaming, with bake-off mode against any number of models in UI. OpenAI-compliant Python client access to the server.
Live h2oGPT Document Q/A Demohttps://github.com/h2oai/h2ogpt/assets/2249614/2f805035-2c85-42fb-807f-fd0bca79abc6
YouTube 4K version: https://www.youtube.com/watch?v=_iktbj4obAI
GPU mode requires CUDA support via torch and transformers. A 6.9B (or 12GB) model in 8-bit uses 8GB (or 13GB) of GPU memory. 8-bit precision, 4-bit precision, and AutoGPTQ can further reduce memory requirements down no more than about 6.5GB when asking a question about your documents (see low-memory mode).
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, as well as MAC M1 using MPS.
See how we compare to other tools like PrivateGPT, see our comparisons.
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
virtualenv -p python3 h2ogpt
source h2ogpt/bin/activate
or use conda:
conda create -n h2ogpt -y
conda activate h2ogpt
conda install python=3.10 -c conda-forge -y
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.
For MACOS and Windows 10/11 please follow their instructions.
On Ubuntu, after Python 3.10 environment installed do:
git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
# fix any bad env
pip uninstall -y pandoc pypandoc pypandoc-binary
# broad support, but no training-time or data creation dependencies
# CPU only:
pip install -r requirements.txt --extra-index https://download.pytorch.org/whl/cpu
# GPU only:
pip install -r requirements.txt --extra-index https://download.pytorch.org/whl/cu118
Then run:
# Required for Doc Q/A: LangChain:
pip install -r reqs_optional/requirements_optional_langchain.txt
# Required for CPU: LLaMa/GPT4All:
pip install -r reqs_optional/requirements_optional_gpt4all.txt
# Optional: PyMuPDF/ArXiv:
pip install -r reqs_optional/requirements_optional_langchain.gpllike.txt
# Optional: Selenium/PlayWright:
pip install -r reqs_optional/requirements_optional_langchain.urls.txt
# Optional: support docx, pptx, ArXiv, etc. required by some python packages
sudo apt-get install -y libmagic-dev poppler-utils tesseract-ocr libreoffice
# Optional: for supporting unstructured package
python -m nltk.downloader all
# Optional: For AutoGPTQ support on x86_64 linux
pip uninstall -y auto-gptq ; CUDA_HOME=/usr/local/cuda-11.8 GITHUB_ACTIONS=true pip install auto-gptq --no-cache-dir
See AutoGPTQ for more details for AutoGPTQ and other GPU installation aspects.
Place all documents in user_path or upload in UI (Help with 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
wget https://huggingface.co/TheBloke/WizardLM-7B-uncensored-GGML/resolve/main/WizardLM-7B-uncensored.ggmlv3.q8_0.bin
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None --langchain_mode='UserData' --user_path=user_path
If using OpenAI for the LLM is ok, but you want documents to be parsed and embedded locally, then do:
python generate.py --inference_server=openai_chat --base_model=gpt-3.5-turbo --score_model=None
and perhaps you want better image caption performance and focus local GPU on that, then do:
python generate.py --inference_server=openai_chat --base_model=gpt-3.5-turbo --score_model=None --captions_model=Salesforce/blip2-flan-t5-xl
Add --share=True to make gradio server visible via sharable URL. If you see an error about protobuf, try:
pip install protobuf==3.20.0
Once all files are downloaded, the CLI and UI can be run in offline mode, see offline mode.
pip install requirements-parser ; pytest -s -v tests client/testsFlash 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.
1 commits
1 commits
Python
91.7%
TeX
6.9%