Code Monkey home page Code Monkey logo

sanzang-chat's Introduction

SanZang-Chat

项目简介

三藏-Chat是利用《西游记》中所有关于唐三藏的语句,以及Chat-GPT-3.5生成的相关问题结果,基于Internlm进行QLoRA微调得到的模仿唐三藏语气的聊天语言模型。

设备要求

  • CPU:Intel Core i5 或以上
  • GPU:NVIDIA GeForce GTX 1060 或以上
  • 内存:8GB 或以上
  • 存储:至少20GB可用空间

最佳实践

⚙️部署BaJie-Chat到Linux环境中
# 进入源码目录
cd xtuner

# 从源码安装 XTuner
pip install -e '.[all]'
apt install git git-lfs -y
git lfs install
git clone https://www.modelscope.cn/Shanghai_AI_Laboratory/internlm2-7b.git
xtuner train my_config/zbj_internlm2_chat_7b_qlora_oasst1_e3.py --deepspeed deepspeed_zero2
xtuner convert pth_to_hf my_config/zbj_internlm2_chat_7b_qlora_oasst1_e3.py work_dirs/zbj_internlm2_chat_7b_qlora_oasst1_e3/{your checkpoint} process_data/hf_models/zbj
xtuner convert merge {your model path} process_data/hf_models/zbj process_data/merged_models/zbj
  • 修改 web_demo.py 中的模型路径
-     model = (AutoModelForCausalLM.from_pretrained('path/to/your/model',
-                                                 trust_remote_code=True).to(
-                                                     torch.bfloat16).cuda())
-     tokenizer = AutoTokenizer.from_pretrained('path/to/your/tokenizer',
-                                              trust_remote_code=True)
+     model = (AutoModelForCausalLM.from_pretrained('process_data/merged_models/zbj',
+                                                 trust_remote_code=True).to(
+                                                     torch.bfloat16).cuda())
+     tokenizer = AutoTokenizer.from_pretrained('process_data/merged_models/zbj',
+                                              trust_remote_code=True)
pip install streamlit
pip install transformers>=4.34
streamlit run ./web_demo.py

效果展示

预览

八戒-Chat 截图

OpenXLab 链接

🎲在 OpenXLab 上尝试

数据处理

本项目采用《西游记》剧本中关于猪八戒的台词和语句作为训练数据,同时使用了InternLM进行QLoRA微调以生成更加贴合猪八戒风格的语言。

详细数据处理流程请参考以下链接:

相关拓展

Todo

  • qlora微调猪八戒
    • 增添原著数据,优化原著对话数据
    • 全量微调猪八戒
    • 接入lmdeploy实现openai api

特别鸣谢

特别感谢上海人工智能实验室的支持!

Internlm


🔍 探索八戒-Chat(Internlm-chat-7b)

Static Badge


更多拓展

SanZang-Chat

XTuner

InternLM

sanzang-chat's People

Contributors

jimmyma99 avatar kv-chiu 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.