GithubHelp home page GithubHelp logo

gen0s / h2ogpt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from h2oai/h2ogpt

0.0 0.0 0.0 41.08 MB

Private Q&A and summarization of documents+images or chat with local GPT, 100% private, Apache 2.0. Supports Mixtral, llama.cpp, and more. Demo: https://gpt.h2o.ai/ https://codellama.h2o.ai/

Home Page: http://h2o.ai

License: Apache License 2.0

Shell 0.63% Python 90.55% Groovy 0.28% TeX 2.77% Makefile 0.22% HTML 1.97% Smarty 0.06% Jupyter Notebook 3.48% Dockerfile 0.03%

h2ogpt's Introduction

h2oGPT

Turn โ˜… into โญ (top-right corner) if you like the project!

Query and summarize your documents or just chat with local private GPT LLMs using h2oGPT, an Apache V2 open-source project.

  • Private offline database of any documents (PDFs, Excel, Word, Images, Video Frames, Youtube, Audio, Code, Text, MarkDown, etc.)
    • Persistent database (Chroma, Weaviate, or in-memory FAISS) using accurate embeddings (instructor-large, all-MiniLM-L6-v2, etc.)
    • Efficient use of context using instruct-tuned LLMs (no need for LangChain's few-shot approach)
    • Parallel summarization and extraction, reaching an output of 80 tokens per second with the 13B LLaMa2 model
    • HYDE (Hypothetical Document Embeddings) for enhanced retrieval based upon LLM responses
  • Variety of models supported (LLaMa2, Mistral, Falcon, Vicuna, WizardLM. With AutoGPTQ, 4-bit/8-bit, LORA, etc.)
    • GPU support from HF and LLaMa.cpp GGML models, and CPU support using HF, LLaMa.cpp, and GPT4ALL models
    • Attention Sinks for arbitrarily long generation (LLaMa-2, Mistral, MPT, Pythia, Falcon, etc.)
  • UI or CLI with streaming of all models
    • Upload and View documents through the UI (control multiple collaborative or personal collections)
    • Vision LLaVa Model and Stable Diffusion Image Generation
    • Voice STT using Whisper with streaming audio conversion
    • Voice TTS using MIT-Licensed Microsoft Speech T5 with multiple voices and Streaming audio conversion
    • Voice TTS using MPL2-Licensed TTS including Voice Cloning and Streaming audio conversion
    • AI Assistant Voice Control Mode for hands-free control of h2oGPT chat
    • Bake-off UI mode against many models at the same time
    • Easy Download of model artifacts and control over models like LLaMa.cpp through the UI
    • Authentication in the UI by user/password
    • State Preservation in the UI by user/password
  • Linux, Docker, macOS, and Windows support
  • Inference Servers support (HF TGI server, vLLM, Gradio, ExLLaMa, Replicate, OpenAI, Azure OpenAI, Anthropic)
  • OpenAI-compliant
    • Server Proxy (experimental)
    • Python client API
  • Web-Search integration with Chat and Document Q/A
  • Agents for Search, Document Q/A, Python Code, CSV frames (Experimental, best with OpenAI currently)
  • Evaluate performance using reward models
  • Quality maintained with over 1000 unit and integration tests taking over 4 GPU-hours

Get Started

GitHub license Linux macOS Windows Docker

To quickly try out h2oGPT with limited document Q/A capability, create a fresh Python 3.10 environment and run:

  • CPU or MAC (M1/M2):
    # for windows/mac use "set" or relevant environment setting mechanism
    export PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu"
  • Linux/Windows CUDA:
    # for windows/mac use "set" or relevant environment setting mechanism
    export PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cu118"

Then do on any system:

git clone https://github.com/h2oai/h2ogpt.git
cd h2ogpt
pip install -r requirements.txt
pip install -r reqs_optional/requirements_optional_langchain.txt
pip install -r reqs_optional/requirements_optional_gpt4all.txt
pip install -r reqs_optional/requirements_optional_langchain.urls.txt
# GPL, only run next line if that is ok:
# pip install -r reqs_optional/requirements_optional_langchain.gpllike.txt

python generate.py --base_model=TheBloke/zephyr-7B-beta-GGUF --prompt_type=zephyr --max_seq_len=4096

then go to your browser by visiting http://127.0.0.1:7860 or http://localhost:7860. Choose 13B for a better model than 7B. If you encounter issues with llama-cpp-python or other packages that try to compile and fail, try binary wheels for your platform as linked in the detailed instructions below. For AVX1 or AMD ROC systems, edit reqs_optional/requirements_optional_gpt4all.txt to choose valid packages.

We recommend quantized models for most small-GPU systems, e.g. LLaMa-2-7B-Chat-GGUF for 9GB+ GPU memory or larger models like LLaMa-2-13B-Chat-GGUF if you have 16GB+ GPU memory.


Windows 10/11 64-bit with full document Q/A capability

  • One-click Installers

    Nov 05, 2023:

    Oct 06, 2023:

    Aug 19, 2023:

    The installers include all dependencies for document Q/A except for models (LLM, embedding, reward), which you can download through the UI. After installation, go to start and run h2oGPT, and a web browser will open for h2oGPT. To use LLaMa model, go to Models tab, select llama base model, then click load to download from preset URL. Then use as normal. To terminate the app, in task manager kill the Python process named pythonw.exe as will also show up in nvidia-smi if using GPUs. Set environment variables (in system properties->advanced->environment variables) to control things:

    • n_jobs: number of cores for various tasks
    • OMP_NUM_THREADS thread count for LLaMa
    • CUDA_VISIBLE_DEVICES which GPUs are used. Recommend set to single fast GPU, e.g. CUDA_VISIBLE_DEVICES=0 if have multiple GPUs. Note that UI cannot control which GPUs (or CPU mode) for LLaMa models.
    • Any CLI argument from python generate.py --help with environment variable set as h2ogpt_x, e.g. h2ogpt_h2ocolors to False.
    • Set env h2ogpt_server_name to actual IP address for LAN to see app, e.g. h2ogpt_server_name to 192.168.1.172 and allow access through firewall if have Windows Defender activated.
  • Windows 10/11 Manual Install and Run Docs


Linux (CPU/CUDA) with full document Q/A capability


macOS (CPU/M1/M2) with full document Q/A capability

  • One-click Installers (Experimental and subject to changes)

    Nov 08, 2023

    Download the runnable file and open it from the Finder. It will take a few minutes to unpack and run the application. These one-click installers are experimental. Report any issues with steps to reproduce at https://github.com/h2oai/h2ogpt/issues.

    Note: The app bundle is unsigned. If you experience any issues with running the app, run the following commands:

    $ xattr -dr com.apple.quarantine {file-path}/h2ogpt-osx-m1-gpu
    $ chmod +x {file-path}/h2ogpt-osx-m1-gpu
  • macOS Manual Install and Run Docs


Example Models

GPU mode requires CUDA support via torch and transformers. A 7B/13B model in 16-bit uses 14GB/26GB of GPU memory to store the weights (2 bytes per weight). Compression such as 4-bit precision (bitsandbytes, AWQ, GPTQ, etc.) can further reduce memory requirements down to less than 6GB when asking a question about your documents. (For more information, see low-memory mode.)

CPU mode uses GPT4ALL and LLaMa.cpp, e.g. gpt4all-j, requiring about 14GB of system RAM in typical use.


Live Demos

Inference Benchmarks for Summarization & Generation

Resources

Partners

Video Demo

demo2.mp4

YouTube 4K version: https://www.youtube.com/watch?v=_iktbj4obAI

Docs Guide

Experimental features

These are not part of normal installation instructions and are experimental.

  • Agents -- in Alpha testing. Optimal for OpenAI, but that also fails sometimes.

Roadmap

  • Integration of code and resulting LLMs with downstream applications and low/no-code platforms
  • Complement h2oGPT chatbot with other APIs like ToolBench
  • Enhance the model's code completion, reasoning, and mathematical capabilities, ensure factual correctness, minimize hallucinations, and avoid repetitive output
  • Add better agents for SQL and CSV question/answer

Development

  • To create a development environment for training and generation, follow the installation instructions.
  • To fine-tune any LLM models on your data, follow the fine-tuning instructions.
  • To run h2oGPT tests:
    pip install requirements-parser pytest-instafail pytest-random-order
    pip install playsound==1.3.0
    pytest --instafail -s -v tests
    # for client tests
    make -C client setup
    make -C client build
    pytest --instafail -s -v client/tests
    # for openai server test on already-running local server
    pytest -s -v -n 4 openai_server/test_openai_server.py::test_openai_client
    or tweak/run tests/test4gpus.sh to run tests in parallel.

Help

Acknowledgements

Why H2O.ai?

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:

  • H2O MLOps to deploy and monitor models at scale
  • H2O Feature Store in collaboration with AT&T
  • Open-source Low-Code AI App Development Frameworks Wave and Nitro
  • Open-source Python datatable (the engine for H2O Driverless AI feature engineering)

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.

Disclaimer

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.

  • Biases and Offensiveness: The large language model is trained on a diverse range of internet text data, which may contain biased, racist, offensive, or otherwise inappropriate content. By using this model, you acknowledge and accept that the generated content may sometimes exhibit biases or produce content that is offensive or inappropriate. The developers of this repository do not endorse, support, or promote any such content or viewpoints.
  • Limitations: The large language model is an AI-based tool and not a human. It may produce incorrect, nonsensical, or irrelevant responses. It is the user's responsibility to critically evaluate the generated content and use it at their discretion.
  • Use at Your Own Risk: Users of this large language model must assume full responsibility for any consequences that may arise from their use of the tool. The developers and contributors of this repository shall not be held liable for any damages, losses, or harm resulting from the use or misuse of the provided model.
  • Ethical Considerations: Users are encouraged to use the large language model responsibly and ethically. By using this model, you agree not to use it for purposes that promote hate speech, discrimination, harassment, or any form of illegal or harmful activities.
  • Reporting Issues: If you encounter any biased, offensive, or otherwise inappropriate content generated by the large language model, please report it to the repository maintainers through the provided channels. Your feedback will help improve the model and mitigate potential issues.
  • Changes to this Disclaimer: The developers of this repository reserve the right to modify or update this disclaimer at any time without prior notice. It is the user's responsibility to periodically review the disclaimer to stay informed about any changes.

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.

Star History

Star History Chart

h2ogpt's People

Contributors

pseudotensor avatar arnocandel avatar achraf-mer avatar tloen avatar chathurindaranasinghe avatar fazpu avatar zainhaq-h2o avatar ryanchesler avatar eshamaaqib avatar this avatar mathanraj-sharma avatar hsm207 avatar lweren avatar mins0o avatar tomkraljevic avatar ozahavi avatar blacksuan19 avatar us8945 avatar jamesbraza avatar eltociear avatar aniketp04 avatar zba avatar hemenkapadia avatar jefffohl avatar kohakublueleaf avatar efii avatar squidwardthetentacles avatar mmalohlava avatar 3x0dv5 avatar pascal-pfeiffer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.