试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3

news2024/11/25 6:38:11

Chatgpt的出现给NLP领域带来了让人振奋的消息,可以很逼真的模拟人的对话,回答人们提出的问题,不过Chatgpt参数量,规模,训练代价都很昂贵。

幸运的是,出现了开源的一些相对小的模型,可以在本地或者云端部署体验,

动手体验了下Vicuna-7b,翻译过来是小羊驼」(骆马),拥有70亿参数,据作者实验能达到GPT-4的90%性能。在作者官网发布了三个版本,其中3个月前发布了v1.1,17天前发布了v1.3。

官网:lmsys (Large Model Systems Organization)

环境:

ubuntu18.04

九天毕昇8核32G内存,仅有cpu

时间:2023年7月5号

llama-7B

python3 -m cli --model-path /root/transformer_model_7b  --device cpu

文件:cli是fastchat/serve目录下的cli.py文件

cli.py内容

"""
Chat with a model with command line interface.

Usage:
python3 -m fastchat.serve.cli --model lmsys/vicuna-7b-v1.3
python3 -m fastchat.serve.cli --model lmsys/fastchat-t5-3b-v1.0

Other commands:
- Type "!!exit" or an empty line to exit.
- Type "!!reset" to start a new conversation.
"""
import argparse
import os
import re
import sys

from prompt_toolkit import PromptSession
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit.key_binding import KeyBindings
from rich.console import Console
from rich.live import Live
from rich.markdown import Markdown

from fastchat.model.model_adapter import add_model_args
from fastchat.modules.gptq import GptqConfig
from fastchat.serve.inference import ChatIO, chat_loop


class SimpleChatIO(ChatIO):
    def prompt_for_input(self, role) -> str:
        return input(f"{role}: ")

参数:   --model-path    是指模型权重存放路径,这个目录下包含tokenizer.model文件,请仔细核对

参数:    --device cpu   指定在cpu上运行

开始推理: 输入 who is Musk?    what is baidu?    china

要等待几分钟,看到几个词几个词的蹦出来

看回答,字数还不少,内容只能说是相关

看下cpu使用率

top

可以看到python3进程,推理时cpu使用率在81.1%,一直在波动。

换用v100有时候会到98%,甚至更高,速度会快很多,一次输出一小段文字

 

vicuna-7b-delta-v1.1

python3 -m cli --model-path /root/vicuna-7b/vicuna-7b-delta-v11 --device cpu

加载模型,中间过程要几分钟

python3 -m cli --model-path /root/vicuna-7b/vicuna-7b-delta-v11  --device cpu
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████| 2/2 [02:58<00:00, 89.16s/it]

开始推理:实现一个python斐波那契函数,可以看到能够写出函数,还简单介绍了怎么用

USER: hello
ASSISTANT: Hello! How can I help you today? Is there something you would like to know or talk about? I'm here to help answer any questions you may have.
USER: implement a python function to compute fibonacci numbers
ASSISTANT: Sure! Here's an implementation of a Python function that computes the Fibonacci sequence:
```python
def fibonacci(n):
    if n <= 1:
        return n
    else:
        return fibonacci(n-1) + fibonacci(n-2)
```
This function takes an integer `n` as input and returns the `n`-th Fibonacci number. The first two numbers in the sequence are 0 and 1, so the function handles these cases separately: if `n` is less than or equal to 1, it returns `n`, and otherwise it computes the sum of the previous two Fibonacci numbers and returns that.

To use the function, you can call it with an integer `n` and it will return the `n`-th Fibonacci number. For example:
```python
>>> fibonacci(5)
13
```
This would compute the 5-th Fibonacci number, which is 13.

USER: china
ASSISTANT: China is a country located in East Asia, bordered by several other countries, including Russia, Mongolia, North Korea, Vietnam, Laos, Myanmar (Burma), Bhutan, India, Nepal, and Pakistan. It is the world's most populous country, with over 1.4 billion people.

China has a long and complex history, dating back over 5,000 years. It is known for its rich cultural heritage, including its cuisine, literature, and arts. The country has a diverse range of landscapes, from the high plateaus in the west to the fertile river valleys in the east, and from the tropical beaches in the south to the frigid deserts in the north.

 

 

vicuna-7b-v1.3

 python3 -m cli --model-path /root//vicuna-7b-v13 --device cpu

参数:-m      后面指定cli.py文件,注意【.py】省略。python3 -m cli是python3执行cli.py文件,具体内容,要看cli.py写了什么

加载模型,等待几分钟

python3 -m cli --model-path /root//vicuna-7b-v13 --device cpu
Loading checkpoint shards: 100%|████████████████████████████████████████████████████████████| 2/2 [03:17<00:00, 98.73s/it]

推理:

USER: Introduce China

ASSISTANT: China, officially known as the People's Republic of China (PRC), is a sovereign state located in East Asia. It is the world's most populous country, with a population of over 1.4 billion people, and the third-largest country by land area, covering approximately 9.6 million square kilometers.

China has a long and complex history, dating back more than 5,000 years. It has been ruled by various dynasties, including the Zhou, Qin, Han, Tang, Song, Yuan, Ming, and Qing dynasties, among others. In 1949, the Communist Party of China (CPC) established the PRC on the Chinese mainland, while the Republic of China (ROC) retained control of Taiwan and other offshore islands.

The People's Republic of China is a single-party socialist state with a planned economy, guided by the CPC. The country is governed according to the Constitution of the People's Republic of China, which was adopted in 1982. The government is divided into various branches, including the National People's Congress (NPC), the State Council, the Supreme People's Court, and the Central Military Commission.

China has a diverse landscape and culture, encompassing various ethnic groups, including the Han, Tibetans, Uighurs, Mongols, and Manchus, among others. The official language is Standard Chinese (Mandarin), although there are numerous regional languages and dialects spoken throughout the country.

The People's Republic of China is a single-party socialist state with a planned economy, guided by the CPC. The country is governed according to the Constitution of the People's Republic of China, which was adopted in 1982. The government is divided into various branches, including the National People's Congress (NPC), the State Council, the Supreme People's Court, and the Central Military Commission.

China has a diverse landscape and culture, encompassing various ethnic groups, including the Han, Tibetans, Uighurs, Mongols, and Manchus, among others. The official language is Standard Chinese (Mandarin), although there are numerous regional languages and dialects spoken throughout the country.

The economy of China has experienced rapid growth in recent decades, making it the world's second-largest economy by nominal GDP and the largest by purchasing power parity (PPP). The country is a leading global exporter of goods and services, with industries such as electronics, textiles, automobiles, and telecommunications playing a significant role in its economic development.

China has been actively involved in international affairs, participating as a permanent member of the United Nations Security Council and a member of various multilateral organizations, including the World Trade Organization (WTO), the Asia-Pacific Economic Cooperation (APEC), and the Group of 20 (G20) major economies.

USER: china
ASSISTANT: China is a country located in East Asia, covering approximately 9.6 million square kilometers. With a population of over 1.4 billion people, it is the most populous country in the world. The official language is Mandarin Chinese, and the capital city is Beijing. China has a rich history and a diverse cultural heritage, with many different ethnic groups and over 56 recognized ethnic minorities.

 

目前尚不能支持中文提问和中文回答

提问方式很重要:输入china,回答的只能说是相关,文字就少很多。输入 Introduce China,输出大段的介绍

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/721251.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

MySQL安装失败starting the sever

MySQL安装失败starting the sever 如果电脑是第一次安装MySQL&#xff0c;一般不会出现这样的报错。starting the sever失败&#xff0c;通常是因为上次安装该软件没有清除干净。 第一种解决方法&#xff1a;完全卸载mysql&#xff0c;重新安装 完全卸载该软件的办法&#…

Linux基础开发工具(yum、vim、gcc/g++、Makefile、gdb、git)

目录 一. yum yum list yum install yum remove 二. vim 命令模式 底行模式 多文件操作 批量注释 三. gcc/g 四. make/Makefile 五.gdb 六. git git clone git commit git push 一. yum 作为一款操作系统&#xff0c;免不了需要一些定制化的内容&#xff0c;这…

工地为什么要做能耗监测?

随着全球气候变化的影响日益严重&#xff0c;环保意识逐渐深入人心&#xff0c;绿色建筑和节能减排成为了建筑行业的热门话题。而在建筑工地中&#xff0c;能耗监测成为了一项不可或缺的任务。本文将从以下几个方面来探讨工地为什么要做能耗监测。 首先&#xff0c;能耗监测有助…

【新星计划·2023】Linux目录与文件之权限意义讲解

作者&#xff1a;Insist-- 个人主页&#xff1a;insist--个人主页 作者会持续更新网络知识和python基础知识&#xff0c;期待你的关注 前言 通过上篇文章&#xff0c;我们知道了Linux 系统内文件的三种身份(拥有者、群组与其他人)&#xff0c;还知道每种身份都有三种权限(rwx)…

【小梦C嘎嘎——启航篇】C++ 基础中的精华(一)

C 基础中的精华&#xff08;一&#xff09;&#x1f60e; 前言&#x1f64c;1、namespace&#xff08;命名空间&#xff09;的经典知识1.1 namespace 日常如何正确使用&#xff1f;1.2 cout和cin来源&#xff0c;以及为什么相对于C语言中的printf和scanf有自动识别数据类型的功…

记一次用arthas解决springboot项目引入ShardingSphere后启动过慢的问题

背景&#xff1a; springboot项目中由于需要加入了ShardingSphere&#xff0c;之后就发现项目启动时间由之前的十多秒&#xff0c;延长到了70秒左右&#xff0c;去除ShardingSphere之后又恢复十多秒。一直以为是ShardingSphere的问题&#xff0c;网上搜罗了各种信息&#xff0c…

华安联大 | 蓝牙人员定位与UWB人员定位技术的应用案例分析

引言&#xff1a;随着物联网和定位技术的快速发展&#xff0c;蓝牙人员定位和UWB人员定位成为了人员定位领域的两种重要技术&#xff0c;两者都能在安防、工业、矿山、救灾、海航等领域得到广泛的应用。 在这有用户或会问蓝牙人员定位和UWB人员定位谁优谁劣&#xff0c;那么这…

2023.7.5例题:HCIA初级实验-2

一、题目要求&#xff1a; 1.在AR1左侧使用DHCP协议使左边可自动获得ip,左侧为192.168.1.0网段ip 2.右侧使用手动配置ip---右侧为192.168.2.0网段ip 3.telent客户端可远程登录到AR1 4.笔记本可以访问DNS获取文件 5.全网可达 二、解题步骤 第一步&#xff1a; 在AR1左侧使…

Charles 工具如何做断点测试?

在测试工作过程中&#xff0c;我们经常会在程序的某一行或者某一环节设置断点&#xff0c;在程序请求的过程中&#xff0c;修改断点处的参数、请求或者响应&#xff0c;借此定位问题&#xff0c;这就是所谓的断点测试。这类断点测试主要用于接口测试。 断点测试可以通过查看接…

高效制作财务报表的秘诀:探索财务报表工具和快速制作方法

财务报表是公司重要的财务信息输出形式&#xff0c;是反映公司经济活动和财务状况的一个重要工具。在日常业务运营中&#xff0c;财务报表可以帮助经理人与投资者了解企业的经营情况&#xff0c;为决策提供数据支持。 尽管Excel在制作各种类型的报表方面具有很好的功能&#xf…

记录力扣热题-100——从链表中找到刷题感觉

目录 一. &#x1f981; 前言二. &#x1f981; 解题过程1. 题目2. 思路一3. 思路二 三. &#x1f981; 文末活动内容简介本书结构关于代码 一. &#x1f981; 前言 狮子此前已经很久没有碰过算法题了&#xff0c;对于之前好不容易攒起来的题感又没了…最近准备面试&#xff0…

【Linux从入门到精通|开发工具】---gcc/g++的基本使用

个人主页&#xff1a;平行线也会相交 欢迎 点赞&#x1f44d; 收藏✨ 留言✉ 加关注&#x1f493;本文由 平行线也会相交 原创 收录于专栏【Linux专栏】&#x1f388; 本专栏旨在分享学习Linux的一点学习心得&#xff0c;欢迎大家在评论区讨论&#x1f48c; 接下来我们来学习L…

ROS:节点运行管理launch文件

目录 一、launch文件1.1概念1.2作用1.3实例1.新建launch文件2.调用 launch 文件 二、<launch>三、node四、include五、remap六、param七、rosparam八、group九、arg 一、launch文件 1.1概念 aunch 文件是一个 XML 格式的文件&#xff0c;可以启动本地和远程的多个节点&…

Redis从入门到精通【进阶篇】之对象机制详解

文章目录 0. 前言1. 详解1.1 redisObject 对象设计目的1.2 redisObject数据结构1.2 Redis 是如何使用redisObject1.2.1. 对象创建1.2.2. 对象引用计数1.2.3. 对象共享1.2.4. 对象的编码方式1.2.4. 对象的值 2. 总结2.1. redisObject对象如何实现数据共享和对象池技术&#xff1…

vue项目打包并配置到iOS工程中

一、修改vue项目的配置文件 将config文件夹里面的index.js中的 assetsPublicPath的值修改为“./” Webpack.prod.conf.js 中output添加参数publicPath:./ 在webpack.base.conf.js里 publicPath: process.env.NODE_ENV 生产 &#xff1f;./ config.build.assetsPublicPath :…

Compose编排工具应用

补充&#xff1a; Docker Compose 文件&#xff1a;Docker Compose 是一个用于定义和运行多个 Docker 容器的工具。它使用 YAML 文件格式来描述应用程序的各个组件和其配置。以下是一个简单的示例&#xff1a; 在上面的示例中&#xff0c;我们定义了两个服务&#xff1a;web 和…

SpringBoot 之实现 PDF 添加水印的方案

简介 PDF&#xff08;Portable Document Format&#xff0c;便携式文档格式&#xff09;是一种流行的文件格式&#xff0c;它可以在多个操作系统和应用程序中进行查看和打印。在某些情况下&#xff0c;我们需要对 PDF 文件添加水印&#xff0c;以使其更具有辨识度或者保护其版…

ChatGLM2-6B的P-Tuning微调

ChatGLM2-6B&#xff1a;https://github.com/THUDM/ChatGLM2-6B 模型地址&#xff1a;https://huggingface.co/THUDM/chatglm2-6b 详细步骤同&#xff1a;ChatGLM-6B的P-Tuning微调详细步骤及结果验证 环境可复用ChatGLM-6B&#xff08;上述部署教程&#xff09;&#xff0c;…

简要介绍 | 知识蒸馏:轻量级模型的智慧之源

注1&#xff1a;本文系“简要介绍”系列之一&#xff0c;仅从概念上对知识蒸馏进行非常简要的介绍&#xff0c;不适合用于深入和详细的了解。 知识蒸馏&#xff1a;轻量级模型的智慧之源 A Gentle Introduction to Hint Learning & Knowledge Distillation | by LA Tran | …

Some about RMI

&#xff08;备份防止忘掉&#xff09; 一开始编译javac所有文件 这个问题概率遇到 解决方法&#xff1a; 然后java编译impl文件 直到出现bound in registry这一句 然后这个cmd不要关掉 重新在eclipse这个类的工作路径打开一个cmd 看到这个之后回到eclipse里面运行app这个文…