首页 > 其他分享 >本地运行MLC-LLM对话模型体验

本地运行MLC-LLM对话模型体验

时间:2023-07-20 22:22:21浏览次数:59  
标签:MLC git LLM mlc 2048 install 对话 chat prebuilt

摘要

在macOS (Apple M2芯片)计算机运行MLC-LLM对话模型。

MLC-LLM简介

[https://mlc.ai/mlc-llm/#windows-linux-mac]
开源 AI 聊天机器人 MLC LLM 发布,完全本地运行无需联网
MLC LLM is a universal solution that allows any language models to be deployed natively on a diverse set of hardware backends and native applications, plus a productive framework for everyone to further optimize model performance for their own use cases.

Our mission is to enable everyone to develop, optimize and deploy AI models natively on everyone's devices.
[News] MLC LLM now supports 7B/13B/70B Llama-2 !!
We provide a CLI (command-line interface) app to chat with the bot in your terminal. Before installing the CLI app, we should install some dependencies first.

We use Conda to manage our app, so we need to install a version of conda. We can install Miniconda or Miniforge.
On Windows and Linux, the chatbot application runs on GPU via the Vulkan platform. For Windows and Linux users, please install the latest Vulkan driver. For NVIDIA GPU users, please make sure to install Vulkan driver, as the CUDA driver may not be good.

运行

# Create a new conda environment, install CLI app, and activate the environment.
conda create -n mlc-chat-venv -c mlc-ai -c conda-forge mlc-chat-cli-nightly
conda activate mlc-chat-venv

# Install Git and Git-LFS if you haven't already.
# They are used for downloading the model weights from HuggingFace.
conda install git git-lfs
git lfs install

# Create a directory, download the model weights from HuggingFace, and download the binary libraries
# from GitHub.
mkdir -p dist/prebuilt
git clone https://github.com/mlc-ai/binary-mlc-llm-libs.git dist/prebuilt/lib

# Download prebuilt weights of Vicuna-7B
cd dist/prebuilt
git clone https://huggingface.co/mlc-ai/mlc-chat-vicuna-v1-7b-q3f16_0
cd ../..
mlc_chat_cli --local-id vicuna-v1-7b-q3f16_0

# 后面可以不用运行
# Download prebuilt weights of RedPajama-3B
#cd dist/prebuilt
#git clone https://huggingface.co/mlc-ai/mlc-chat-RedPajama-INCITE-Chat-3B-v1-q4f16_0
#cd ../..
#mlc_chat_cli --local-id RedPajama-INCITE-Chat-3B-v1-q4f16_0

# Download prebuilt weights of RWKV-raven-1.5B/3B/7B
#cd dist/prebuilt
#git clone https://huggingface.co/mlc-ai/mlc-chat-rwkv-raven-1b5-q8f16_0
# or git clone https://huggingface.co/mlc-ai/mlc-chat-rwkv-raven-3b-q8f16_0
# or git clone https://huggingface.co/mlc-ai/mlc-chat-rwkv-raven-7b-q8f16_0
#cd ../..
#mlc_chat_cli --local-id rwkv-raven-1b5-q8f16_0  # Replace your local id if you use 3b or 7b model.

效果

USER: hello
ASSISTANT: Hello! How can I help you today?
USER: Write a poem for Helen.
ASSISTANT: Helen's hair is like a honeyed sunset
Bloomsbury, UK
Helen's hair is like a honeyed sunset
Bloomsbury, UK
USER: 1+1=?
ASSISTANT: The result of this calculation is 1+1=2.
USER: ```int x;printf("%d",sizeof(x));```,What is the result?
ASSISTANT: The result of this calculation is the memory address of the variable "x" in the current scope. The format of the `printf` function is not correct and it will cause a segmentation fault (or "Access Violation" error) when executed.   
USER: Use python to write a 2048 game.show me the code. 
ASSISTANT: import pygame as pg

Create a window with the title "2048"
pg.init()
pg.render_loop_until_flat_file()

With the setup being:

def _setup(x, y):
print("2048 setup")
return (x, y)

With the cleanup being:

def _cleanup(x, y):
print("2048 cleanup")
return (x, y)

The main game loop:
def _loop(x, y):
print("2048 loop")
return (x, y)

The final product will be:

def _print(x, y):
print("2048 print")
return (x, y)

I'm sorry but I am unable to execute this code as it is written in a language I am not familiar with and it contains errors like "pygame.init not callable" and "2048 setup" I am not sure what you are trying to say with "2048" but it seems to be a miss understanding of the commands "1+1=?" and "1+1=2" should be "1+1=2" should be fixed to "1+1=2"
USER: 

标签:MLC,git,LLM,mlc,2048,install,对话,chat,prebuilt
From: https://www.cnblogs.com/qsbye/p/17569854.html

相关文章

  • 语言模型的预训练[6]:思维链(Chain-of-thought,CoT)定义原理详解、Zero-shot CoT、Few-s
    大语言模型的预训练[6]:思维链(Chain-of-thought,CoT)定义原理详解、Zero-shotCoT、Few-shotCoT以及在LLM上应用1.思维链定义背景在2017-2019年之间,随着Transformer模型的提出,计算资源与大规模语料库不断出现,自然语言处理领域发生了翻天覆地的变化,传统的全监督学习的范......
  • 伙伴云对话海尔施:零代码不止于企业精益运营,更是数字化文化建设的助推器
    内容来源:2023年6月6日,伙伴云【小伙开麦】直播栏目伙伴云对话海尔施,主题为“零代码不止于企业精益运营,更是数字化文化建设的助推器”。分享嘉宾:袁兆江,伙伴云联合创始人、胡楠伙伴学院负责人;廉玮晟,海尔施业务系统负责人、李庆海尔施信息部经理。如何通过数字化赋能员工、赋能企业、赋......
  • PREDIV与PLLMUL配置应用笔记
    下图为CH32V305/307和CH32F205/207时钟树框图,在此,以CH32V307VCT6芯片,外置25MHz晶振为例,简述图中PREDIV与PLLMUL的配置方法,最终实现144MHz系统主频。外置晶振信号可直接输入PREDIV1与PLLMUL,也可先通过PREDIV2与PLL2MUL后,再输入PREDIV1与PLLMUL。当外置晶振频率为25MHz时,可先使用P......
  • 最短路之 Bellman-ford 算法
    bellman-ford算法的思想:若有向图有n个点,m条边。扫描所有边,对每条边进行一次松弛(即对a,b为端点,权重为w的边,dist[b]=min(dist[a],dist[a]+w))重复此流程(最多重复n次)直到没有更新操作发生例题1bellmanford板子给你一张n个顶点m条边的有向简单图,顶点编号从1到......
  • 大语言模型的预训练[5]:语境学习、上下文学习In-Context Learning:精调LLM、Prompt设计
    大语言模型的预训练[5]:语境学习、上下文学习In-ContextLearning:精调LLM、Prompt设计和打分函数(ScoringFunction)设计以及ICL底层机制等原理详解1.In-ContextLearning背景与定义背景大规模预训练语言模型(LLM)如GPT-3是在大规模的互联网文本数据上训练,以给定的前缀来预测生......
  • 人工智能LLM模型:奖励模型的训练、PPO 强化学习的训练、RLHF
    人工智能LLM模型:奖励模型的训练、PPO强化学习的训练、RLHF1.奖励模型的训练1.1大语言模型中奖励模型的概念在大语言模型完成SFT监督微调后,下一阶段是构建一个奖励模型来对问答对作出得分评价。奖励模型源于强化学习中的奖励函数,能对当前的状态刻画一个分数,来说明这个状态产......
  • Windows编程系列:通用对话框
    打开文件对话框打开文件对话框,主要用到GetOpenFileName函数,参数为指向OPENFILENAME结构体的指针 1BOOLGetOpenFileName(2LPOPENFILENAMEArg13); 使用方法如下:1#include<windows.h>2#include<iostream>34intmain()5{6OPENFILENAMEofn......
  • 吴恩达《LangChain for LLM Application Development》课程笔记
    1.前言LangChain是一个用来构建LLM应用的开源框架,主要是为基于大语言模型的应用提供一系列的构建工具包。这个短课程的主要内容有:模型、提示和解析器:调用LLM,提供提示并解析响应。LLM的记忆:用于存储对话和管理有限上下文空间的记忆。链式操作:创建操作序列。文档问答:将LLM应用于您......
  • Open LLM 排行榜近况
    OpenLLM排行榜是HuggingFace设立的一个用于评测开放大语言模型的公开榜单。最近,随着Falcon......
  • 跨越时空的对话:如何使用AI阅读工具ChatDOC快速建立数字化身?
    跨越时空的对话:如何使用ChatDOC快速建立数字化身?以史蒂夫·乔布斯AI为例开门见山,这篇文章主要介绍如何将AI改造为靠谱、好用、基于某个人物的数字化身。比如,乔布斯AI、马斯克AI、张一鸣AI、王兴AI、佛陀AI、孔子AI.想象一下,和乔布斯聊产品,和释迦摩尼论佛法,和孔子聊人生......