太牛了!h2oGPT直接操作本地PDF、Excel、Word、圖像、等文件!
h2o項(xiàng)目簡(jiǎn)介
查詢和總結(jié)您的文檔,或者只是使用 h2oGPT(一個(gè) Apache V2 開(kāi)源項(xiàng)目)與本地私有 GPT LLM 聊天。
項(xiàng)目地址
https://github.com/h2oai/h2ogpt
測(cè)試體驗(yàn)地址
https://gpt.h2o.ai/
主要功能
- 任何文檔的私人離線數(shù)據(jù)庫(kù)(PDF、Excel、Word、圖像、代碼、文本、MarkDown 等)
- 使用精確嵌入(大型、全 MiniLM-L6-v2 等)的持久數(shù)據(jù)庫(kù)(Chroma、Weaviate 或內(nèi)存中 FAISS)
- 使用指令調(diào)整的 LLM有效利用上下文(不需要 LangChain 的少樣本方法)
- 并行匯總達(dá)到 80 個(gè)令牌/秒輸出 13B LLaMa2
- 通過(guò) UI上傳和查看文檔(控制多個(gè)協(xié)作或臨時(shí)集合)
- UI或 CLI 以及所有模型的流式傳輸
- 同時(shí)針對(duì)多個(gè)模型進(jìn)行UI 模式
- 支持多種模型(LLaMa2、Falcon、Vicuna、WizardLM,包括 AutoGPTQ、4 位/8 位、LORA)
- HF 和 LLaMa.cpp GGML 模型的GPU支持,以及使用 HF、LLaMa.cpp 和 GPT4ALL 模型的CPU支持
- Linux、Docker、MAC 和 Windows支持
- 推理服務(wù)器支持(HF TGI 服務(wù)器、vLLM、Gradio、ExLLaMa、OpenAI)
- 符合 OpenAI 標(biāo)準(zhǔn)的 Python 客戶端 API,用于客戶端-服務(wù)器控制
- 使用獎(jiǎng)勵(lì)模型評(píng)估績(jī)效
https://huggingface.co/h2oai

上傳文件這里注意可以上傳本地的常見(jiàn)的各種類型的文件。

支持的本機(jī)數(shù)據(jù)類型
.pdf:便攜式文檔格式(PDF),
.txt:文本文件(UTF-8),
.csv:CSV,
.toml:托姆爾,
.py: Python,
.rst:重構(gòu)文本,
.rtf:富文本格式,
.md:降價(jià),
.html:HTML 文件,
.docx:Word文檔(可選),
.doc:Word文檔(可選),
.xlsx:Excel 文檔(可選),
.xls:Excel 文檔(可選),
.enex: 印象筆記,
.eml: 電子郵件,
.epub:電子書(shū),
.odt:打開(kāi)文檔文本,
.pptx: PowerPoint 文檔,
.ppt: PowerPoint 文檔,
.png:PNG圖像(可選),
.jpg:JPEG 圖像(可選),
.jpeg:JPEG 圖像(可選)。
生成回答,可以看到提問(wèn)問(wèn)題后,多個(gè)模型同時(shí)回答,用戶可以選擇一個(gè)自己感覺(jué)比較合理的回答。

可以查看和管理自己上傳的文檔。



1:下載 Visual Studio 2022



# 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: for supporting unstructured package
python -m nltk.downloader all
5:可選配置

For document Q/A with UI using LLaMa.cpp-based model on CPU or GPU:
Click Download Wizard Model and place file in h2oGPT directory.
python generate.py --base_model='llama' --prompt_type=wizard2 --score_model=None --langchain_mode='UserData' --user_path=user_path

Starting get_model: llama
ggml_init_cublas: found 2 CUDA devices:
Device 0: NVIDIA GeForce RTX 3090 Ti
Device 1: NVIDIA GeForce RTX 2080
llama.cpp: loading model from WizardLM-7B-uncensored.ggmlv3.q8_0.bin
llama_model_load_internal: format = ggjt v3 (latest)
llama_model_load_internal: n_vocab = 32001
llama_model_load_internal: n_ctx = 1792
llama_model_load_internal: n_embd = 4096
llama_model_load_internal: n_mult = 256
llama_model_load_internal: n_head = 32
llama_model_load_internal: n_layer = 32
llama_model_load_internal: n_rot = 128
llama_model_load_internal: ftype = 7 (mostly Q8_0)
llama_model_load_internal: n_ff = 11008
llama_model_load_internal: model size = 7B
llama_model_load_internal: ggml ctx size = 0.08 MB
llama_model_load_internal: using CUDA for GPU acceleration
ggml_cuda_set_main_device: using device 0 (NVIDIA GeForce RTX 3090 Ti) as main device
llama_model_load_internal: mem required = 4518.85 MB (+ 1026.00 MB per state)
llama_model_load_internal: allocating batch_size x (512 kB + n_ctx x 128 B) = 368 MB VRAM for the scratch buffer
llama_model_load_internal: offloading 20 repeating layers to GPU
llama_model_load_internal: offloaded 20/35 layers to GPU
llama_model_load_internal: total VRAM used: 4470 MB
llama_new_context_with_model: kv self size = 896.00 MB
AVX = 1 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | VSX = 0 |
Model {'base_model': 'llama', 'tokenizer_base_model': '', 'lora_weights': '', 'inference_server': '', 'prompt_type': 'wizard2', 'prompt_dict': {'promptA': 'Below is an instruction that describes a task. Write a response that appropriately completes the request.', 'promptB': 'Below is an instruction that describes a task. Write a response that appropriately completes the request.', 'PreInstruct': '\n### Instruction:\n', 'PreInput': None, 'PreResponse': '\n### Response:\n', 'terminate_response': ['\n### Response:\n'], 'chat_sep': '\n', 'chat_turn_sep': '\n', 'humanstr': '\n### Instruction:\n', 'botstr': '\n### Response:\n', 'generates_leading_space': False}}
Running on local URL: http://0.0.0.0:7860
To create a public link, set `share=True` in `launch()`.
轉(zhuǎn)到http://127.0.0.1:7860(忽略上面的消息)。添加--share=True以獲得可共享的安全鏈接。
要僅與 LLM 聊天,請(qǐng)?jiān)凇凹稀敝袉螕鬜esources并單擊LLM,或者在不使用--langchain_mode=UserData.
在nvidia-smi或其他一些 GPU 監(jiān)視器程序中,您應(yīng)該看到python.exe在(計(jì)算)模式下使用 GPUC并使用 GPU 資源。
3090Ti 的 i9 上,每秒大約獲得 5 個(gè)令牌。

感興趣的小伙伴們快去動(dòng)手試試吧!