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

这篇具有很好参考价值的文章主要介绍了试运行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

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

看回答,字数还不少,内容只能说是相关试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3,llama,人工智能,机器学习

看下cpu使用率

top

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

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

试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3,llama,人工智能,机器学习

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.

试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3,llama,人工智能,机器学习

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.

试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3,llama,人工智能,机器学习

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.

试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3,llama,人工智能,机器学习

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.

试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3,llama,人工智能,机器学习

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.

试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3,llama,人工智能,机器学习

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.

试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3,llama,人工智能,机器学习

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

提问方式很重要:输入china,回答的只能说是相关,文字就少很多。输入 Introduce China,输出大段的介绍文章来源地址https://www.toymoban.com/news/detail-541434.html

到了这里,关于试运行llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • [llama懒人包]ChatGPT本地下位替代llama-7b,支持全平台显卡/CPU运行

    LLAMA的懒人包: 链接: https://pan.baidu.com/s/1xOw8-eP8QB--u6y644_UPg?pwd=0l08  提取码:0l08 模型来源:elinas/llama-7b-hf-transformers-4.29 模型来源(LoRA):ymcui/Chinese-LLaMA-Alpaca 侵权请通知作者删除 也可以进我的群下载哦:904511841 下面是llama的输入样例   自我介绍一下llama 您好,我是llama。

    2024年02月12日
    浏览(40)
  • 【ChatGPT】Web LLM:你的本地的ChatGPT —— 完全在您的浏览器中运行 vicuna-7b 大型语言模型,它非常令人印象深刻

    目录 Web LLM—— 完全在您的浏览器中运行 vicuna-7b 大型语言模型,它非常令人印象深刻 指示 聊天演示 链接 免责声明 Instructions Chat Demo Links Disclaimer

    2024年02月05日
    浏览(52)
  • LLM:Vicuna 7B模型简单部署体验

    随着ChatGPT的火热,科技公司们各显神通,针对大语言模型LLM通常需要极大的算力支持,且没有开源,阻碍了进一步的研究和应用落地。受 Meta LLaMA 和 Stanford Alpaca 项目的启发,来自加州大学伯克利分校、CMU、斯坦福大学和加州大学圣地亚哥分校的成员,共同推出了一个 Vicun

    2024年02月07日
    浏览(52)
  • Fastchat实战部署vicuna-7b-v1.3(小羊驼)

    FastChat 是一个开放平台,用于训练、服务和评估基于大型语言模型的聊天机器人。核心功能包括: 最先进模型(例如,Vicuna)的权重、训练代码和评估代码。 具有 Web UI 和 OpenAI 兼容 RESTful API 的分布式多模型服务系统。 Fastchat项目持续更新中,后续还未跟进,有兴趣请参看项

    2024年02月08日
    浏览(35)
  • Fastchat安装vicuna-7b-v1.3(小羊驼) ——超详细版

    FastChat 是一个开放平台,用于训练、服务和评估基于大型语言模型的聊天机器人。核心功能包括: 最先进模型(例如,Vicuna)的权重、训练代码和评估代码。 具有 Web UI 和 OpenAI 兼容 RESTful API 的分布式多模型服务系统。 Fastchat项目持续更新中,后续还未跟进,有兴趣请参看项

    2024年02月05日
    浏览(37)
  • MPT-7B:开源,商业可用,性能堪比LLaMA-7B的LLM新成员

    Meta开源了LLama,不过有很多限制,很难商业运用。于是现在MosaicML开发了MPT-7B模型,它是一个基于Transformer在1T文本/代码Token上训练出来的模型。该模型 开源,与LLaMA-7B模型效果相匹配,而且可用于商业用途 。 代码:https://github.com/mosaicml/llm-foundry/ 模型:mosaicml/mpt-7b-instruct ·

    2024年02月11日
    浏览(37)
  • LLaMA-7B微调记录

    Alpaca(https://github.com/tatsu-lab/stanford_alpaca)在70亿参数的LLaMA-7B上进行微调,通过52k指令数据(https://github.com/tatsu-lab/stanford_alpaca/blob/main/alpaca_data.json),在8个80GB A100上训练3小时,在对话上的性能比肩GPT-3.5。 52k数据所对应的alpaca_data.json是一个字典列表,每个字典包含以下字段

    2024年02月12日
    浏览(37)
  • llama.cpp 部署 llama-2-7b 测试 Llama 2

    首先进入这里 https://github.com/facebookresearch/llama  点击下载 填写注册信息  接受后继续  上面的按钮点击后,应该邮箱就收到链接了,几乎是很快的 把下面的链接复制后备用,注意24小时后会失效 提前先了解一下有3种模型 7b  13b  70b   7b就是有70亿参数,文件夹里面有3个文件

    2024年02月10日
    浏览(39)
  • 提高LLaMA-7B的数学推理能力

    这篇文章探讨了利用多视角微调方法提高数学推理的泛化能力。数学推理在相对较小的语言模型中仍然是一个挑战,许多现有方法倾向于依赖庞大但效率低下的大语言模型进行知识蒸馏。研究人员提出了一种避免过度依赖大语言模型的新方法,该方法通过有效利用具有不同注

    2024年02月16日
    浏览(36)
  • LLM__llama-7B模型试验

    llama模型已经开源很久了,所以拿做小的模型做了个简单尝试 因为做简单尝试并不打算长期持有,所以以便宜、够用、好退货为主要参考依据购买阿里云服务器、 我看7B的模型权重大小就13GB,所以先购入一个 32GB内存的虚拟机 CPU内存: 4核(vCPU) 32 GiB ~ 操作系统: Alibaba Cloud Lin

    2024年02月09日
    浏览(41)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包