V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NicholasCao
V2EX  ›  OpenAI

ChatBLOOM-1.7B 开源中英文聊天模型

  •  1
     
  •   NicholasCao · 2023-04-28 17:42:00 +08:00 · 715 次点击
    这是一个创建于 602 天前的主题,其中的信息可能已经有所发展或是发生改变。

    ChatBLOOM

    ChatBLOOM 是基于 BLOOM ( 17 亿参数)训练的中英双语对话语言模型,目前跑通 SFT ,RM 和 PPO 小作坊跑通确实比较难,希望有能力的网友开源共建,点点 Star 鼓励也好呀💖~

    代码,权重均开源

    Links:

    Cases

    基于我们发布的SFT 模型。 虽然这个模型只有 1.7B 参数,但也显示出同样不错的能力。以下是一些例子:

    Chinese

    中文用的 ChatGLM 的例子

    <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

    <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.
    

    快速体验

    import torch
    from transformers import AutoTokenizer, AutoModelForCausalLM
    
    tokenizer = AutoTokenizer.from_pretrained('nicholascao/chatbloom-1b7-sft')
    tokenizer.pad_token_id = tokenizer.eos_token_id
    
    model = AutoModelForCausalLM.from_pretrained('nicholascao/chatbloom-1b7-sft').half()
    
    inputs = tokenizer('<Human>: Hello <eoh> <Assistant>:', return_tensors='pt').to(torch.cuda.current_device())
    model.to(torch.cuda.current_device())
    
    output = model.generate(**inputs, max_length=768, do_sample=True, temperature=0.8, top_k=50, early_stopping=True, repetition_penalty=1.1)
    output = tokenizer.decode(output[0], skip_special_tokens=True)
    print(output)
    

    或者使用我们编写好的聊天脚本

    git clone [email protected]:NicholasCao/ChatBLOOM.git
    cd ChatBLOOM
    python chat.py
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2878 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:07 · PVG 17:07 · LAX 01:07 · JFK 04:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.