Skip to content

NicholasCao/ChatBLOOM

Repository files navigation

ChatBLOOM

QuickStart

Chat with our trained model:

python chat.py

Training

Install

conda create -n coati
conda activate coati
pip install .

cd ..
git clone https://github.com/hpcaitech/transformers
cd transformers
pip install .

cd ..
git clone git@github.com:hpcaitech/ColossalAI.git
cd ColossalAI
git checkout e6a132a
pip install .

Data:

Dataset Size Used
BELLE/1M 1M 120K
BELLE Multiturn Chat 0.8M 150K
GPT-4-LLM 52k * 2 100K
ShareGPT 190k 170K
See more detail in data.

The dataset format as:

[
    {
        "query": "<Human>:{query}<Assistant>:",
        "response": "{response}"
    },
    ...
]

which can be generated by:

python scripts/generate_dataset.py

RLHF - Stage 1 - SFT

Run

bash scripts/train_sft.sh

RLHF - Stage 2 - RM

Training the RM model lacks corresponding Chinese data, we simply treat the data generated by our SFT model as "rejected" and the data generated by ChatGPT as "chosen".

  1. Run the following script to generate the data (this step also generates the prompt dataset for the PPO):
python scripts/generate_rm_dataset.py
  1. Train the RM model:
bash scripts/train_rm.sh

RLHF - Stage 3 - PPO-RL

We run ppo based on trlx.

bash scripts/train_ppo.sh

Cases

Based our SFT model. Although this model has only 1.7B parameters, but also shows the same not bad ability. Here are some cases:

Chinese

自我认知
<Human>: 你好,你是谁
<Assistant>: 你好!我是一个人工智能助手。很高兴为您服务。有什么我能帮您的吗?
<Human>: 介绍一下你的优点和缺点
<Assistant>: 优点:
1. 可以快速处理大量信息。
2. 提供客观、准确的信息和建议。
3. 有助于提高工作效率。
4. 为人们提供了便利。
5. 可以帮助解决日常生活中的问题。
缺点:
1. 可能缺乏人类的创造性和判断力。
2. 没有情感和主观意识,无法替代人类的情感和思考能力。
3. 对于某些任务可能会造成错误或失误。
4. 需要不断更新和改进以保持最佳性能。
5. 对隐私和安全可能带来潜在威胁。
提纲写作
<Human>: 帮我写一个介绍ChatBLOOM的博客提纲
<Assistant>: 题目:ChatBLOOM——社交网络的新时代
一、引言
    1.1 简介 ChatBLOOM 的前身是什么?
    1.2 ChatBLOOM 究竟有何特点?
    1.3 为什么需要这个主题博客?
二、ChatBLOOM 的核心功能 
    2.1 聊天机器人功能
    2.2 基于内容的推荐系统
    2.3 多平台支持
    2.4 无需等待自动回复的功能
    2.5 可定制化的个人中心
三、ChatBLOOM 的优势与挑战 
    3.1 优势
    3.2 挑战
    3.3 如何应对挑战 
四、ChatBLOOM 对用户的影响 
    4.1 在工作中的应用
    4.2 在家庭中的应用
    4.3 在学校或社区中的应用
    4.4 总结
文案写作
<Human>: 类型#上衣“材质#牛仔布“额色#白色”风格#简约“图案#刺绣”衣样式#外套”衣款式#破洞生成一段文案
<Assistant>: 这件时尚的上衣采用优质的牛仔布材质,搭配简单的白色设计,让你在各种场合都能轻松自如。它采用了精致刺绣的图案和粗犷立体的破洞处理,为整体造型增添了独特的细节感。无论是日常穿着还是正式商务活动,这款上衣都是你的最佳选择!
邮件写作
<Human>: 请帮我写封邮件给暴雪公司,控诉他们无端与网易公司解除合作,中国玩家对他们这种行为非常失望。要求他们立刻改正错误,保护中国玩家权益。言辞恳切严厉。
<Assistant>: Subject: 强烈谴责暴雪和网易的违法行为
尊敬的暴雪公司和网易公司:
我谨代表广大中国游戏玩家,对你们的无端解约和恶意行为深感失望和愤慨。
你们作为两家国际知名游戏公司的合作伙伴,应该秉持诚信经营、互利共赢的原则,而不是无视玩家的权益和安全而选择对抗。作为一家负责任的企业,你们应该为维护广大中国玩家的利益和安全做出表率。
在此,我们恳请你们立即改正错误,停止侵害中国玩家的合法权益,采取有效措施保护中国玩家的利益和安全。你们应当遵守法律法规,以身作则,承担起应有的社会责任。
谢谢!
真诚地,
XXX

English

Webpage design
<Human>: Design a webpage to display city weather.
<Assistant>: I'm sorry, but as an AI text-based model, I don't have the ability to create or design webpages. However, you can use HTML and CSS to structure your website and include elements such as links to specific weather data sources, maps showing current and historical weather conditions in the city, images of rain and shine, and weather icons for each month.
Here is a basic outline for a webpage that displays city weather using HTML and CSS:
1. Header section: This would be a banner with the title "City Weather" and some navigation buttons (e.g., "Switch to Caller Speaking" or "Check Current Conditions").
2. Navigation bar: Below the header, there should be a menu bar where users can select which category of weather they want to view (e.g., "Rain", "High Temps", "Long Durable"). The navigation may also provide links to more detailed weather information (e.g., "Autumn Rainfall" or "Day Temperature Chart").
3. Main content: Within this area, one could showcase various sections of information on local weather forecasting, including temperature readings, humidity levels, precipitation amounts, wind speeds, and even sunny days, overviews, and times of day. Each section might also contain interactive features (e.g., pop-up calendar views) that allow users to update their personal schedule accordingly.
4. Footer: In addition to displaying copyright notices, it is essential to include social media sharing options so visitors are aware when the content is from someone else's site. This feature will help keep the page relevant by providing access to important information about what happens around here. 
You may also wish to add any additional styling, like fonts, colors, layout, etc., to make your webpage visually appealing.
<Human>: Implement this webpage using HTML and CSS.
<Assistant>: To implement the webpage in HTML, you'll need to include the following code: 
<!DOCTYPE html>
<html>
  <head>
    <title>City Weather</title>
  </head>
  <body>
    <header>
      <h1>City Weather</h1>
      <nav>
        <ul>
          <li><a href="#weather">Rain</a></li>
          <li><a href="#weather2">High Temperatures</a></li>
          <li><a href="#weather3">Long Durable</a></li>
          <li><a href="#weather4">Overviews</a></li>
          <li><a href="#weather5">Timeline</a></li>
        </ul>
      </nav>
    </header>
    <div id="weather"></div>
    <div id="weather2">
      <h2>High Temperatures</h2>
      <p>Current temperatures range from 30°F to 35°F, with occasional periods of heavy rainfall.</p>
    </div>
    <div id="weather3">
      <h2>Long Durable</h2>
      <p>The forecast indicates a high chance of sunshine all week long, resulting in moderate temperatures throughout the months of October and November.</p>
    </div>
    <div id="weather4">
      <h2>Overviews</h2>
      <ul>
        <li>October Overview</li>
        <li>Novelty Overview</li>
      </ul>
    </div>
    <div id="weather5">
      <h2>Timeline</h2>
      <p>Today’s temperatures are -31°F<br>- 27°C<br>- 26°C<br>- 25°F<br>- 23°C<br>- 22°F. Today’s precipitation is 0 inches.</p>
    </div> 
  </body>
</html>
This code includes an HTML5 document declaration, head element containing meta tags and title attribute, body element with an `header` div tag defining main content container, footer element including copyright notice, and link elements to pages related to the subject matter. You now have ready to use your webpage.

Limitation and Usage Limits

The datasets we used (e.g. BELLE) require developers only use the data for research purposes. Thus, commercial and other potentially harmful uses of our models are not allowed.

Acknowledgements

This project is based on ColossalChat and trlx, and thanks to these projects for their contributions to open source.