Home

Awesome

🧠 IncarnaMind

πŸ‘€ In a Nutshell

IncarnaMind enables you to chat with your personal documents πŸ“ (PDF, TXT) using Large Language Models (LLMs) like GPT (architecture overview). While OpenAI has recently launched a fine-tuning API for GPT models, it doesn't enable the base pretrained models to learn new data, and the responses can be prone to factual hallucinations. Utilize our Sliding Window Chunking mechanism and Ensemble Retriever enables efficient querying of both fine-grained and coarse-grained information within your ground truth documents to augment the LLMs.

Feel free to use it and we welcome any feedback and new feature suggestions πŸ™Œ.

✨ New Updates

Open-Source and Local LLMs Support

Alternative Open-Source LLMs Options

How to use GGUF models

Here is a comparison table of the different models I tested, for reference only:

MetricsGPT-4GPT-3.5Claude 2.0Llama2-70bLlama2-70b-ggufLlama2-70b-api
ReasoningHighMediumHighMediumMediumMedium
SpeedMediumHighMediumVery LowLowMedium
GPU RAMN/AN/AN/AVery HighHighN/A
SafetyLowLowLowHighHighLow

πŸ’» Demo

https://github.com/junruxiong/IncarnaMind/assets/44308338/89d479fb-de90-4f7c-b166-e54f7bc7344c

πŸ’‘ Challenges Addressed

🎯 Key Features

πŸ— Architecture

High Level Architecture

image

Sliding Window Chunking

image

πŸš€ Getting Started

1. Installation

The installation is simple, you just need to run few commands.

1.0. Prerequisites

1.1. Clone the repository

git clone https://github.com/junruxiong/IncarnaMind
cd IncarnaMind

1.2. Setup

Create Conda virtual environment:

conda create -n IncarnaMind python=3.10

Activate:

conda activate IncarnaMind

Install all requirements:

pip install -r requirements.txt

Install llama-cpp seperatly if you want to run quantized local LLMs:

CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python==0.1.83 --no-cache-dir
CMAKE_ARGS="-DLLAMA_METAL=on"  FORCE_CMAKE=1 pip install llama-cpp-python==0.1.83 --no-cache-dir

Setup your one/all of API keys in configparser.ini file:

[tokens]
OPENAI_API_KEY = (replace_me)
ANTHROPIC_API_KEY = (replace_me)
TOGETHER_API_KEY = (replace_me)
# if you use full Meta-Llama models, you may need Huggingface token to access.
HUGGINGFACE_TOKEN = (replace_me)

(Optional) Setup your custom parameters in configparser.ini file:

[parameters]
PARAMETERS 1 = (replace_me)
PARAMETERS 2 = (replace_me)
...
PARAMETERS n = (replace_me)

2. Usage

2.1. Upload and process your files

Put all your files (please name each file correctly to maximize the performance) into the /data directory and run the following command to ingest all data: (You can delete example files in the /data directory before running the command)

python docs2db.py

2.2. Run

In order to start the conversation, run a command like:

python main.py

2.3. Chat and ask any questions

Wait for the script to require your input like the below.

Human:

2.4. Others

When you start a chat, the system will automatically generate a IncarnaMind.log file. If you want to edit the logging, please edit in the configparser.ini file.

[logging]
enabled = True
level = INFO
filename = IncarnaMind.log
format = %(asctime)s [%(levelname)s] %(name)s: %(message)s

🚫 Limitations

πŸ“ Upcoming Features

πŸ™Œ Acknowledgements

Special thanks to Langchain, Chroma DB, LocalGPT, Llama-cpp for their invaluable contributions to the open-source community. Their work has been instrumental in making the IncarnaMind project a reality.

πŸ–‹ Citation

If you want to cite our work, please use the following bibtex entry:

@misc{IncarnaMind2023,
  author = {Junru Xiong},
  title = {IncarnaMind},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub Repository},
  howpublished = {\url{https://github.com/junruxiong/IncarnaMind}}
}

πŸ“‘ License

Apache 2.0 License