llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3——使用体验
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.
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,输出大段的介绍
相关文章:
llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3——使用体验
Chatgpt的出现给NLP领域带来了让人振奋的消息,可以很逼真的模拟人的对话,回答人们提出的问题,不过Chatgpt参数量,规模,训练代价都很昂贵。 幸运的是,出现了开源的一些相对小的模型,可以在本地或…...
深入理解JVM虚拟机第十九篇:JVM字节码中方法内部的结构和与局部变量表中变量槽的介绍
大神链接:作者有幸结识技术大神孙哥为好友,获益匪浅。现在把孙哥视频分享给大家。 孙哥链接:孙哥个人主页 作者简介:一个颜值99分,只比孙哥差一点的程序员 本专栏简介:话不多说,让我们一起干翻JVM 本文章简介:话不多说,让我们讲清楚虚拟机栈存储结构和运行原理 文章目…...

windows好玩的cmd命令
颜色 后边的数字查表吧,反正我是喜欢一个随机的数字 color 01MAC getmac /v更新主机IP地址 通过DHCP更新 ipconfig /release ipconfig /renew改标题 title code with 你想要的标题...

线扫相机DALSA--常见问题四:修改相机参数,参数保存无效情况
该问题是操作不当,未按照正常步骤保存参数所致,相机为RAM机制,参数需保存在采集卡的ROM内。 保存参数步骤: ①首先将相机参数保存至User Set1; ②然后回到Board(采集卡)参数设置区,鼠标选中Basic Timing&a…...
linux中用date命令获取昨天、明天或多天前后的日期
在实际操作中,一些脚本中会调用明天,或者昨天,或更多天前的日期,本文将叙述讲述用date命令实现时间的显示。在Linux系统中用man date -d 查询的参数说的比较模糊,以下举例进一步说明: # man date -d, --da…...

【无标题】360压缩软件怎么用?超级好用!
360压缩是一款功能强大的解压缩软件,如何用它压缩文件呢?下面给出了详细的操作步骤。 一、360压缩详细步骤 1、下载软件后,在电脑上右击需要压缩的文件,在弹出的菜单中点击【添加到压缩文件】选项。 2、在360压缩窗口中按需设置相…...

一图搞懂傅里叶变换(FT)、DTFT、DFS和DFT之间的关系
自然界中的信号都是模拟信号,计算机无法处理,因此我们会基于奈奎斯特定理对模拟信号采样得到数字信号。 但是我们发现,即便是经过采样,在时域上得到了数字信号,而在频域上还是连续信号。 因此我们可以在时域中选取N点…...

行情分析——加密货币市场大盘走势(11.7)
大饼昨日下跌过后开始有回调的迹象,现在还是在做指标修复,大饼的策略保持逢低做多。稳健的依然是不碰,目前涨不上去,跌不下来。 以太昨天给的策略,依然有效,现在以太坊开始回调。 目前来看,回踩…...

阿里微服务质量保障系列:故障演练
对于很多大型企业(如阿里巴巴)来说,经过多年的技术演进,系统工具和架构已经高度垂直化,服务器规模也达到了比较大的体量。当服务规模大于一定量(如10000台)时,小概率的硬件故障每天都会发生。这时如果需要人的干预,系统就无法可靠的伸缩。 为此每一层的系统都会面向失…...

基于springboot+vue开发的教师工作量管理系
教师工作量管理系 springboot31 源码合集:www.yuque.com/mick-hanyi/javaweb 源码下载:博主私 摘要 随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。本文介绍了教师工作量管理系统的开发全过程。通过…...
【NI-DAQmx入门】NI-DAQmx之C、C++、VB、VB.net与C#支持
DAQmx应用程序编程接口(API) DAQmx附带数据采集编程所需的API。DAQmx API只是一组库,其中包含关于如何执行所有数据采集操作的函数。这些API支持LabWindows/CVI、C、C、Visual Basic 6.0、VB.NET和C#。 DAQmx API随DAQmx驱动程序一起安装,包含以下参考…...
python转xml为json
以下代码取自获取PA防火墙策略XML文件并转为JSON文件的场景: 通过PA防火墙API获取防火墙策略 防火墙策略xpath为./result/security/rules/entry 以下代码实现将所有entry即策略与策略相关属性转为json对象并存储至文件 import xml.etree.ElementTree as ET import …...
PHP Curl请求封装
php 中curl请求模块封装 <?php namespace App\Utils;/*** http 工具类* author Administrator**/ class HttpUtils {private static $_instance;private function __construct(){}public static function getInstance(){if( null self::$_instance ){self::$_instance n…...
java list set 特性
List的常用实现类 ArrayList (常用) JDK1.2 底层数组实现 查询快,增删慢 线程不安全,效率高 LinkedList JDK1.2 底层链表实现 查询慢,增删快 线程不安全,效率高 Vector JDK1.0 底层数组实现 都慢 线程安全,效率低 List 集合名new 实现类(); 常用方法 集合名.方法名(实参列表…...
Docker 用centos 编译安装apache
Docker 用centos 编译安装apache 前提条件: 安装docker 如果想安装docker请查阅:安装docker 环境准备:centos8 拉取centos镜像 [rootlvs docker]# docker pull centos:8 8: Pulling from library/centos a1d0c7532777: Pull complete Di…...

专访虚拟人科技:如何利用 3DCAT 实时云渲染打造元宇宙空间
自古以来,人们对理想世界的探索从未停止,而最近元宇宙的热潮加速了这一步伐,带来了许多新的应用。作为元宇宙的关键入口,虚拟现实(VR)将成为连接虚拟和现实的桥梁。苹果发布的VISION PRO头戴设备将人们对VR…...

第三章:人工智能深度学习教程-基础神经网络(第二节-ANN 和 BNN 的区别)
在本文中,我们将了解单层感知器及其使用 TensorFlow 库在Python中的实现。神经网络的工作方式与我们的生物神经元的工作方式相同。 生物神经元的结构 生物神经元具有三个基本功能 接收外部信号。 处理信号并增强是否需要发送信息。 将信号传递给目标细胞&#x…...

回归模型原理总结及代码实现
前言 本文将介绍回归模型算法,并总结了一些常用的除线性回归模型之外的模型,其中包括一些单模型及集成学习器。 保序回归、多项式回归、多输出回归、多输出K近邻回归、决策树回归、多输出决策树回归、AdaBoost回归、梯度提升决策树回归、人工神经网络、…...

游戏开发中的“御用中介“
点击上方亿元程序员关注和★星标 引言 大家好,我是亿元程序员,一位有着8年游戏行业经验的主程。 本系列是《和8年游戏主程一起学习设计模式》,让糟糕的代码在潜移默化中升华,欢迎大家关注分享收藏订阅。 游戏开发中的"御用…...
flink1.15报错 processElement_split
flink sql 完整报错 Caused by: java.lang.NullPointerExceptionat StreamExecCalc$1148.processElement_split178(Unknown Source) ~[?:?]at StreamExecCalc$1148.processElement(Unknown Source) ~[?:?]at org.apache.flink.streaming.runtime.tasks.CopyingChainingOutp…...
基于算法竞赛的c++编程(28)结构体的进阶应用
结构体的嵌套与复杂数据组织 在C中,结构体可以嵌套使用,形成更复杂的数据结构。例如,可以通过嵌套结构体描述多层级数据关系: struct Address {string city;string street;int zipCode; };struct Employee {string name;int id;…...

【OSG学习笔记】Day 18: 碰撞检测与物理交互
物理引擎(Physics Engine) 物理引擎 是一种通过计算机模拟物理规律(如力学、碰撞、重力、流体动力学等)的软件工具或库。 它的核心目标是在虚拟环境中逼真地模拟物体的运动和交互,广泛应用于 游戏开发、动画制作、虚…...

ESP32读取DHT11温湿度数据
芯片:ESP32 环境:Arduino 一、安装DHT11传感器库 红框的库,别安装错了 二、代码 注意,DATA口要连接在D15上 #include "DHT.h" // 包含DHT库#define DHTPIN 15 // 定义DHT11数据引脚连接到ESP32的GPIO15 #define D…...
Frozen-Flask :将 Flask 应用“冻结”为静态文件
Frozen-Flask 是一个用于将 Flask 应用“冻结”为静态文件的 Python 扩展。它的核心用途是:将一个 Flask Web 应用生成成纯静态 HTML 文件,从而可以部署到静态网站托管服务上,如 GitHub Pages、Netlify 或任何支持静态文件的网站服务器。 &am…...

ArcGIS Pro制作水平横向图例+多级标注
今天介绍下载ArcGIS Pro中如何设置水平横向图例。 之前我们介绍了ArcGIS的横向图例制作:ArcGIS横向、多列图例、顺序重排、符号居中、批量更改图例符号等等(ArcGIS出图图例8大技巧),那这次我们看看ArcGIS Pro如何更加快捷的操作。…...

Redis数据倾斜问题解决
Redis 数据倾斜问题解析与解决方案 什么是 Redis 数据倾斜 Redis 数据倾斜指的是在 Redis 集群中,部分节点存储的数据量或访问量远高于其他节点,导致这些节点负载过高,影响整体性能。 数据倾斜的主要表现 部分节点内存使用率远高于其他节…...
关于uniapp展示PDF的解决方案
在 UniApp 的 H5 环境中使用 pdf-vue3 组件可以实现完整的 PDF 预览功能。以下是详细实现步骤和注意事项: 一、安装依赖 安装 pdf-vue3 和 PDF.js 核心库: npm install pdf-vue3 pdfjs-dist二、基本使用示例 <template><view class"con…...

Ubuntu Cursor升级成v1.0
0. 当前版本低 使用当前 Cursor v0.50时 GitHub Copilot Chat 打不开,快捷键也不好用,当看到 Cursor 升级后,还是蛮高兴的 1. 下载 Cursor 下载地址:https://www.cursor.com/cn/downloads 点击下载 Linux (x64) ,…...
6️⃣Go 语言中的哈希、加密与序列化:通往区块链世界的钥匙
Go 语言中的哈希、加密与序列化:通往区块链世界的钥匙 一、前言:离区块链还有多远? 区块链听起来可能遥不可及,似乎是只有密码学专家和资深工程师才能涉足的领域。但事实上,构建一个区块链的核心并不复杂,尤其当你已经掌握了一门系统编程语言,比如 Go。 要真正理解区…...

图解JavaScript原型:原型链及其分析 | JavaScript图解
忽略该图的细节(如内存地址值没有用二进制) 以下是对该图进一步的理解和总结 1. JS 对象概念的辨析 对象是什么:保存在堆中一块区域,同时在栈中有一块区域保存其在堆中的地址(也就是我们通常说的该变量指向谁&…...