Giter Site home page Giter Site logo

ieit-yuan / yuanchat Goto Github PK

View Code? Open in Web Editor NEW
29.0 2.0 6.0 19.57 MB

License: Apache License 2.0

Dockerfile 0.23% Shell 0.11% Python 58.82% JavaScript 16.74% HTML 0.19% Vue 22.85% SCSS 1.06%
fastapi huggingface large-language-models llm nodejs python transformer vuejs3 inference

yuanchat's Introduction

Info Apache License


Logo

Yuan LLM 开源项目对话应用
源官网 »

English / 简体中文

🎉 最近更新


目录
  1. 关于
  2. 开始
  3. 产品规划
  4. 贡献
  5. 许可

关于

YuanChat Screen Shot

源ChatYuan-2.0 项目的一部分, 作为Yuan-2.0的一个客户端应用. 源Chat 提供了一种简单的交互方式,可以让用户很轻松的使用 Yuan-2.0, 用户可以很方便的进行测试以及使用。

(回到顶端)

构建

本项目基于下面这些优秀的项目:

FastAPIVueNodeJS

(回到顶端)

开始

1. Docker 部署

1.1 依赖条件

首先,在您使用 Docker 部署之前,您需要先安装:

1.2 部署

我们提供了一个制作好的源Chat镜像,一条命令就可以完成项目的部署操作。

docker run --rm -d --name yuanchat -p 5050:5050 -e YUAN_2_URL=http://ip:port/yuan yuanmodel/yuanchat:latest

这里, YUAN_2_URL=http://ip:port/yuanYuan-2.0模型服务的地址,ip 是你部署Yuan-2.0服务的节点 ip,port 是服务对外端口,例如,你可以这样写:http://192.168.1.1:8000/yuan

1.3 验证

在浏览器中访问链接:http://localhost:5050,如果部署正确,那么你将会看到这个页面:

YuanChat Screen Shot

(回到顶端)


2. 源码部署

用源码创建并部署属于你自己的版本

2.1 依赖条件

在源码部署之前,你需要安装以下开发环境

2.2 部署

2.2.1 下载源码
git clone https://github.com/IEIT-Yuan/YuanChat.git
2.2.2 生成静态文件
cd YuanChat/src/webui
npm install
npm run build

获取更多 webui 详细信息,请参考 README

2.2.3 修改项目配置文件

如果你的Yuan-2.0 模型服务的地址不是http://127.0.0.1:8000,你需要在YuanChat/src/python/yuan_processing/as_constants.pyYUAN_2_URL参数指定正确的地址,例如:YUAN_2_URL=http://192.168.1.1:8000/yuan

获取更多 python 服务端详细信息,请参考 README

2.2.4 安装 python 依赖包
cd YuanChat
pip install -r requirements.txt
2.2.5 启动 python 服务
cd YuanChat
bash start.sh

2.2.6 Web UI 定制修改

  • 修改源 Chat Web UI 左上角的 Logo,需要将 /src/webui/public/logo.png 替换为提前准备好的 Logo 图片,建议图片尺寸为 120*48。

  • 修改源 Chat 的对话欢迎语,需要修改 /src/webui/src/locales/lang/zh-CN.js 中的多语言配置,具体要修改以下内容:

  welcomeHeader: '我是源Chat,基于源2.0大模型的对话应用。',
  welcomeParagraph1: '我能够进行多轮对话,回答领域问题,协助人们进行应用文写作和艺术创作。',
  • 修改源 Chat 的对话推荐问题,需要修改 /src/webui/public/recommends.json 中的内容。

当你处于 web UI 的本地开发模式(请参考 README),以上修改将立即生效。如果要部署,请参考源码部署章节

2.3 验证

在浏览器中访问链接 http://localhost:5050,如果部署正确,那么你将会看到这个页面:

YuanChat Screen Shot

产品规划

  • 增加 README 中文文档
  • 增加 windows+GPU 部署说明

(回到顶端)

贡献

贡献使得开源社区成为一个学习、激励和创造的绝佳场所。非常感谢您的任何贡献。

如果你对我们有更好的建议,请将仓库 fork 下来,并创建一个 pr。您也可以简单点,用标签“优化”给我们提一个问题。 别忘了给这个项目打一颗星!再次感谢!

  1. 从仓库 Fork 项目
  2. 创建一个你的分支 (git checkout -b feature/AmazingFeature)
  3. 提交你的变更 (git commit -m 'Add some AmazingFeature')
  4. 将代码 push 到你的远程分支 (git push origin feature/AmazingFeature)
  5. 提交 Pull Request

(回到顶端)

许可

YuanChat License下分发. 获取更多信息请参考 YuanChat LICENSE .
Apache License 2.0下分发. 获取更多信息请参考 LICENSE .

(回到顶端)

yuanchat's People

Contributors

iamlovingit avatar xqziei avatar wk-iei avatar huifu1018 avatar zhanghui06 avatar lilianlhl avatar

Stargazers

Mark avatar WangDaBing avatar CHurricane avatar  avatar  avatar Rafael Crist avatar ppkliu avatar renz7 avatar  avatar LeonLee avatar Sailfish avatar  avatar Bnightning avatar Aric Smith avatar  avatar  avatar shenchuochuo avatar  avatar  avatar Lu Hai avatar  avatar Napoleon L avatar kl avatar JackCheng avatar GuWen avatar  avatar lzj avatar  avatar  avatar

Watchers

 avatar  avatar

yuanchat's Issues

通用版不能加载baichuan2-7b-chat-int4模型

模型列表中有baichuan2-7b-chat-int4的模型,且可以下载
image

但是在加载模型时,遇到以下错误信息,软件提示加载模型失败

2024-07-24 09:59:22.098 | INFO     | pkg.server.process.process_model:load_model:103 - load_model model_id:5, type:1
2024-07-24 09:59:22.158 | INFO     | pkg.plugins.chat_model_plugin.baichuan2_hf:load_model:60 - Creat tokenizer...
2024-07-24 09:59:22.385 | INFO     | pkg.plugins.chat_model_plugin.baichuan2_hf:load_model:63 - init model ...
2024-07-24 09:59:22.385 | INFO     | pkg.plugins.chat_model_plugin.baichuan2_hf:load_model:65 - using cpu
Xformers is not installed correctly. If you want to use memory_efficient_attention to accelerate training use the following command to install Xformers
pip install xformers.
2024-07-24 09:59:22.432 | ERROR    | pkg.server.process.process_model:load_model_by_model_info:129 - load_model_by_model_info error, model_id:5, err: Needs import model weight init func to run quantize.

苦恼,新版真的能运行吗?

安装了三次,都失败了。具体就是点击(yuanchat.exe),pc shell窗口执行了一堆命令后,该窗口自动关闭。旧版的是pc shell窗口和一个yuanchat窗口。但新版除了pc shell 窗口闪现,什么窗口都没有。

从百度网盘下载了安装文件。第一次识别原安装路径,覆盖安装,安装后发现除执行文件(yuanchat.exe)是日期是6.5外,其他都是6.10,应该是安装可以了。但运行结果如上。

删除执行文件(yuanchat.exe),再安装一次。安装后,运行结果同上。

执行卸载(uninst.exe)。完成后,第三次安装。安装后,运行结果同上。

关于大模型下载与保存优化建议,以及chat的回复速度有点慢

第一次用上支持中文模型为主的chat工具。太好了。下载了Qwen,发现是下载了七八个模型。我很好好奇,加载模型时,加载了哪一个呢?期待看到后续版本支持可二次选择单个模型文件下载。
大模型保存。发现是可以使用gguf模型,太好了。检查大模型的保存路径,发现由于路径设置的第二级三级差异,没法与LMStudio文件夹内的gguf模型做共用。希望能考虑支持共用已下载的模型问题。
先试用了chat功能,对比LMStudio, chatbox, ollama,同一模型,yuanchat回复速度明显有点慢。希望能继续优化提高速度。
后续会试用rag功能。

通用版和XPU版下载Yuan2模型失败

点击下载模型时提示下载失败,日志信息如下:

2024-07-23 18:12:24.373 | DEBUG    | pkg.app.app:run:9 - app.run is called.
2024-07-23 18:13:07.481 | ERROR    | pkg.server.process.model_download:_download_run:215 - Response details: {'Code': 10010205001, 'Message': '获取模型版本失败,信息:record not found', 'RequestId': 'fb6b018c-21cf-424e-a02e-0d70e184b69c', 'Success': False}, Request id: 3aa8e2c836df404795662a5aa72c249d
2024-07-23 18:13:16.587 | ERROR    | pkg.server.process.model_download:_download_run:215 - Response details: {'Code': 10010205001, 'Message': '获取模型版本失败,信息:record not found', 'RequestId': '832e58c0-27f2-4d18-a78c-d5db2d4f1345', 'Success': False}, Request id: e1eadaf802fd49bba16cd6c543cf41d9
2024-07-23 19:26:48.208 | DEBUG    | pkg.app.app:run:9 - app.run is called.
2024-07-23 19:28:12.837 | ERROR    | pkg.server.process.model_download:_download_run:215 - Response details: {'Code': 10010205001, 'Message': '获取模型版本失败,信息:record not found', 'RequestId': '67c248f8-1216-42d1-8581-69eb0144fcca', 'Success': False}, Request id: a94787f4c96946eabd8608bd8dc6e1c0
2024-07-23 19:32:27.093 | DEBUG    | pkg.app.app:run:9 - app.run is called.
2024-07-23 19:34:43.995 | DEBUG    | pkg.app.app:run:9 - app.run is called.
2024-07-23 19:36:42.066 | ERROR    | pkg.server.process.model_download:_download_run:215 - Response details: {'Code': 10010205001, 'Message': '获取模型版本失败,信息:record not found', 'RequestId': '9b4fb79f-17e5-453d-8972-be941f9e5ae8', 'Success': False}, Request id: 80b86356dfbc47c880eebba31bf7ebf0
2024-07-23 19:36:52.110 | ERROR    | pkg.server.process.model_download:_download_run:215 - Response details: {'Code': 10010205001, 'Message': '获取模型版本失败,信息:record not found', 'RequestId': 'cb0eb794-5c6d-4399-9e8e-0eb49bc3610f', 'Success': False}, Request id: d473d0d58aea4ffe8d4fa6ca86d5f3b1
2024-07-23 20:26:40.003 | DEBUG    | pkg.app.app:run:9 - app.run is called.
2024-07-23 20:28:09.241 | DEBUG    | pkg.app.app:run:9 - app.run is called.
2024-07-23 20:28:31.674 | ERROR    | pkg.server.process.model_download:_download_run:215 - Response details: {'Code': 10010205001, 'Message': '获取模型版本失败,信息:record not found', 'RequestId': 'd714f0ed-068b-4ad4-a411-89d78241f9de', 'Success': False}, Request id: 84f796b628fd4373960d4dc8a1238bf5
2024-07-23 20:29:51.193 | DEBUG    | pkg.app.app:run:9 - app.run is called.
2024-07-23 20:30:09.866 | ERROR    | pkg.server.process.model_download:_download_run:215 - Response details: {'Code': 10010205001, 'Message': '获取模型版本失败,信息:record not found', 'RequestId': 'bcc61fd9-036d-4040-b5ab-cda0bacce210', 'Success': False}, Request id: 8b702682f4e44137a6947820361cf45e
2024-07-23 20:43:13.709 | DEBUG    | pkg.app.app:run:9 - app.run is called.

排查后发现是modelscope中的模型author变为了IEITYuan,但是软件还是从原本的author链接查找模型信息,查找不到信息导致的下载失败。
image

暂时只能通过更新数据库中存储的链接来实现模型下载。
image

image

通用版和XPU版都有这个问题,希望能更新修复。

本地CPU部署出错

你好,我下载了yoanchat.exe, 用的模型是YuanLLM/Yuan2-2B-Janus-hf。模型已经下载。
本地CPU 部署推理失败:

 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:8000
 * Running on http://10.238.149.230:8000
 _internal.py[line:96] - INFO: Press CTRL+C to quit
INFO:     127.0.0.1:55129 - "GET /model/load/status HTTP/1.1" 200 OK
INFO:     127.0.0.1:56580 - "POST /sse/subscribe HTTP/1.1" 200 OK
0:00:00
 webserver_utils.py[line:64] - INFO:
 ques_id:2024-2-21-13-19-44-nqQmeNOD
 processtime:0:00:00
 input:[{'question': '你好', 'answer': ''}]
 processinput:['你好<sep>']
 yuanchat.py[line:102] - ERROR: message:[{'question': '你好', 'answer': ''}];Exception:Error happened when call chat-model-server: Expecting value: line 1 column 1 (char 0)

可以帮忙看看吗? 多谢。

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.