Giter VIP home page Giter VIP logo

leeing--newsgpt's Introduction

👩‍🏫👩‍🏫“ Leeing ” —— NewBeing Low-end version👩‍🏫👩‍🏫

This is a low-profile version of Newbeing, which is linked to the web, and can get the latest daily news through the web interface and answer your questions with the help of these news.

  • A token-level keyword extraction model based on Bert was designed and trained.
  • Fine-tune ChatGLM with news interview data for better results.
  • Use two news interfaces to extract the latest news and the most matching news respectively, and select the most relevant news as input based on the Dense Retrieval algorithm.
  • Realized the demo version test of the web version.

Recently updated

  • 👏🏻 2023.06.20: Leeing-v1 version released. It has realized all basic functions and supports two modes: web version interaction and command line interaction.

How to use

  • Experimental environment

python 3.8

GeForce RTX 3090 ,24gMemory

  • Clone this project
cd ~
https://github.com/lightxxxshadow/Leeing--NewsGPT.git
  • Install dependencies
pip install -r requirements.txt

It should be noted that the version of Torch needs to be selected according to the actual CUDA version of your server, please refer to PyTorch Installation Guide for details.

pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
  • Model download
  • You can choose to use your own or the data given below to train your own model, or you can directly use my trained model to test the effect.

  • Over hereDownload the model for keyword extraction, put it in the ./Keyword_Extractor path, and the GPU requires a minimum video memory of about 3G when fine-tuning.

  • Over hereDownload the prefix partial parameter model of the fine-tuned ChatGLM model based on the following data, and place the entire output folder under the ./chatglm_ptuning path,Just put it under the ./Keyword_Extractor path, and the video memory needs to be about 17G when fine-tuning.

  • Note that at the same time need to download the ChatGLM Model released by Tsinghua University, I chose the smallest 4int-level quantized version here, you can also use it directly without fine-tuning, the video memory consumes 6-7g, and the downloaded entire chatglm-6b-int4 file sister is placed in the same level directory as this README.

Note Modify the model path locally in the code!!!

  • Data download
  • In addition to downloading the trained model directly, you can train your own model by yourself through the following method.

  • Over hereDownload the training data of the Bert-based keyword extraction model and format compressed jsonl file.

After unzipping, put it in the ./Keyword_Extractor directory, run data_process.py to get train.json data for training, and there are about 30,000 pieces of data after processing and cleaning.

  • Over hereDownload the data for fine-tuning the ChatGLM model, which is a multi-round dialogue data of news interviews in English, which is very suitable for this task.

After extracting, put it in the ./chatglm_ptuning directory, and run two functions in the data_process.py: process1 and process2 respectively to obtain train.json data for training.

  • Due to the time and computing power of the model, the fine-tuning of the model Chat_GLM only used about 20,000 rounds of training data with context information, less than 1% of the total data volume.
  • Start the service

This project provides demo_show.py as an example of using the Leeing model, find the file path, and use the following command to start the service:

streamlit run demo_show.py

In particular, at least 7 gigabytes of video memory are required to run on the web side, otherwise it may not run. When running, because the news API used is an overseas website, you need to circumvent the wall and enable overseas services. Pay special attention to the installation package before running:

pip install streamlit
pip install streamlit_chat

Reference repository

@misc{chen2023soulchat,
      title={灵心健康大模型SoulChat:通过长文本咨询指令与多轮共情对话数据集的混合微调,提升大模型的“共情”能力},
      author={Yirong Chen, Xiaofen Xing, Zhenyu Wang, Xiangmin Xu},
      year={2023},
      month = {6},
      version = {1.0},
      url = {https://github.com/scutcyr/SoulChat}
}
@article{zeng2022glm,
  title={Glm-130b: An open bilingual pre-trained model},
  author={Zeng, Aohan and Liu, Xiao and Du, Zhengxiao and Wang, Zihan and Lai, Hanyu and Ding, Ming and Yang, Zhuoyi and Xu, Yifan and Zheng, Wendi and Xia, Xiao and others},
  journal={arXiv preprint arXiv:2210.02414},
  year={2022}
}
@misc{Rahul1582,
      title={BERT-Keyword-Extractor},
      author={BERT-Keyword-Extractor, Xiaofen Xing, Zhenyu Wang, Xiangmin Xu},
      year={2019},
      month = {5},
      url = {https://github.com/ibatra/BERT-Keyword-Extractor}
}

leeing--newsgpt's People

Contributors

w-y-li avatar

Stargazers

 avatar Xiang Zheng avatar Jinxiu Liu avatar  avatar 高孟熙 avatar AnswerOfTime avatar

Watchers

 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.