项目简介
该存储库展示了检索增强生成(RAG)聊天界面,支持多种开源模型。
特征
通过 URL 与您的数据聊天: doc(x), pdf, txt 和 YouTube 视频。
安装与使用
轻松设置
手动管道安装
git clone https://github.com/qnguyen3/chat-with-mlx.git
cd chat-with-mlx
python -m venv .venv
source .venv/bin/activate
pip install -e .
手动 Conda 安装
git clone https://github.com/qnguyen3/chat-with-mlx.git
cd chat-with-mlx
conda create -n mlx-chat python=3.11
conda activate mlx-chat
pip install -e .
用法
支持型号
-
Google Gemma-7b-it, Gemma-2b-it
-
Mistral-7B-Instruct, OpenHermes-2.5-Mistral-7B, NousHermes-2-Mistral-7B-DPO
-
Mixtral-8x7B-Instruct-v0.1, Nous-Hermes-2-Mixtral-8x7B-DPO
-
Quyen-SE (0.5B), Quyen (4B)
-
StableLM 2 Zephyr (1.6B)
-
Vistral-7B-Chat, VBD-Llama2-7b-chat, vinallama-7b-chat
添加您自己的模型
解决方案1
此解决方案只需要您在 chat_with_mlx/models/configs 中使用简单的 .yaml 配置文件添加自己的模型
examlple.yaml
:
original_repo: google/gemma-2b-it
mlx-repo: mlx-community/quantized-gemma-2b-it
quantize: 4bit
default_language: multi
添加 .yaml 配置后,您可以在应用程序中加载模型(现在您需要通过终端/CLI 跟踪下载)
解决方案2
与解决方案1相同。有时,用于下载模型的
download_snapshot
方法速度很慢,您想自己下载。
添加.yaml配置后,您可以自行下载repo并将其添加到
chat_with_mlx/models/download
中。文件夹名称必须与不带用户名的原始存储库名称相同(因此
google/gemma-2b-it
->
gemma-2b-it
)。
一个完整的模型应该有以下文件: