当前位置: 首页 > wzjs >正文

肯德基的网站建设网站推广营销技巧

肯德基的网站建设,网站推广营销技巧,购买淘宝店铺在哪个平台,中国建设人才网登录1. 背景 vLLM是一个快速且易于使用的LLM推理和服务库。企业级应用比较普遍,尝试安装相关环境,尝试使用。 2. 环境 模块版本python3.10CUDA12.6torch2.5.1xformers0.0.28.post3flash_attn2.7.4vllm0.6.4.post1 2.1 安装flash_attn 具体选择什么版本&…

1. 背景

vLLM是一个快速且易于使用的LLM推理和服务库。企业级应用比较普遍,尝试安装相关环境,尝试使用。

2. 环境

模块版本
python3.10
CUDA12.6
torch2.5.1
xformers0.0.28.post3
flash_attn2.7.4
vllm0.6.4.post1

2.1 安装flash_attn

具体选择什么版本,可参考:flash-attention保姆级安装教程
基于cuda跟torch的版本考虑,笔者选择如下版本

flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp310-cp310-linux_x86_64.whl

安装命令

wget https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
MAX_JOBS=4 
pip install flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp310-cp310-linux_x86_64.whl

2.2 安装vllm

参考:vLLM环境安装与运行实例【最新版(0.6.4.post1)】

pip3 install vllm==0.6.4.post1 --extra-index-url https://download.pytorch.org/whl/cu121 -i https://pypi.tuna.tsinghua.edu.cn/simple
2.2.1 坑1: 报错:libcudart.so.11.0: cannot open shared object file: No such file or directory

在这里插入图片描述

这个文件应该指向的是cuda的文件。到cuda的路径看看【笔者cuda的路径为:/usr/local/cuda/lib64】

在这里插入图片描述
发现确实只有libcudart.so.12。没有libcudart.so.11。
那么这里只有两种解决方案,要么重装cuda,要么重装vllm。

借鉴楼上大佬的经验参考,将vllm 版本降至0.6.4.post1即可解决。

3. 启动服务

3.1 vllm启动服务

使用vllm启动模型/root/Qwen2.5-7B-Instruct。

参考文章:使用 vllm 搭建推理加速大模型服务

python -m vllm.entrypoints.openai.api_server --model /root/Qwen2.5-7B-Instruct  --served-model-name Qwen2.5-7B-Instruct --max-model-len=2048

在这里插入图片描述

3.2 vllm一次性调用

# vllm_model.py
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
import os
import json# 自动下载模型时,指定使用modelscope。不设置的话,会从 huggingface 下载
os.environ['VLLM_USE_MODELSCOPE']='True'def get_completion(prompts, model, tokenizer=None, max_tokens=512, temperature=0.8, top_p=0.95, max_model_len=2048):stop_token_ids = [151329, 151336, 151338]# 创建采样参数。temperature 控制生成文本的多样性,top_p 控制核心采样的概率sampling_params = SamplingParams(temperature=temperature, top_p=top_p, max_tokens=max_tokens, stop_token_ids=stop_token_ids)# 初始化 vLLM 推理引擎llm = LLM(model=model, tokenizer=tokenizer, max_model_len=max_model_len,trust_remote_code=True)outputs = llm.generate(prompts, sampling_params)return outputsif __name__ == "__main__":    # 初始化 vLLM 推理引擎model='/root/Qwen2.5-7B-Instruct' # 指定模型路径# model="qwen/Qwen2-7B-Instruct" # 指定模型名称,自动下载模型tokenizer = None# 加载分词器后传入vLLM 模型,但不是必要的。# tokenizer = AutoTokenizer.from_pretrained(model, use_fast=False) text = ["你好,帮我介绍一下什么是大语言模型。","可以给我将一个有趣的童话故事吗?"]# messages = [#     {"role": "system", "content": "你是一个有用的助手。"},#     {"role": "user", "content": prompt}# ]# 作为聊天模板的消息,不是必要的。# text = tokenizer.apply_chat_template(#     messages,#     tokenize=False,#     add_generation_prompt=True# )outputs = get_completion(text, model, tokenizer=tokenizer, max_tokens=512, temperature=1, top_p=1, max_model_len=2048)# 输出是一个包含 prompt、生成文本和其他信息的 RequestOutput 对象列表。# 打印输出。for output in outputs:prompt = output.promptgenerated_text = output.outputs[0].textprint(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")

效果如下:
在这里插入图片描述

4. 模型调用

curl http://localhost:8000/v1/completions \-H "Content-Type: application/json" \-d '{"model": "Qwen2.5-7B-Instruct","prompt": "请基于如下的知识点,帮忙总结一下该病例的关键信息点。","max_tokens": 50,"temperature": 0}'

在这里插入图片描述
参考文章:
1.flash-attention保姆级安装教程
2.vLLM环境安装与运行实例【最新版(0.6.4.post1)】
3.使用 vllm 搭建推理加速大模型服务
4.[大模型]Qwen2-7B-Instruct vLLM 部署调用

以上,结束。


文章转载自:

http://ut0KG6vr.xgjhy.cn
http://E70kezDQ.xgjhy.cn
http://x363yg7d.xgjhy.cn
http://omuXMMc5.xgjhy.cn
http://ElKNXSri.xgjhy.cn
http://9JrEgzZl.xgjhy.cn
http://1cDQqizV.xgjhy.cn
http://MgVas7fO.xgjhy.cn
http://eRu21Hsb.xgjhy.cn
http://acBERdN4.xgjhy.cn
http://O8UqFr3F.xgjhy.cn
http://5L6mb2HA.xgjhy.cn
http://GtGeR7et.xgjhy.cn
http://DeMjgn8V.xgjhy.cn
http://NOPEEQT8.xgjhy.cn
http://uK8hXGVd.xgjhy.cn
http://2DKHlCqw.xgjhy.cn
http://pXel2fzG.xgjhy.cn
http://PWmhigms.xgjhy.cn
http://AhS7wVyX.xgjhy.cn
http://mcDNzLiI.xgjhy.cn
http://2CTFCoo3.xgjhy.cn
http://Dfgv8qby.xgjhy.cn
http://KW6pDEy8.xgjhy.cn
http://vBmnJI3M.xgjhy.cn
http://CvU60UD9.xgjhy.cn
http://TNOMejYC.xgjhy.cn
http://dOhGs4Hb.xgjhy.cn
http://iKiOZe5c.xgjhy.cn
http://CyVxT0NZ.xgjhy.cn
http://www.dtcms.com/wzjs/620401.html

相关文章:

  • 苏州公司网站建设找哪家网站开发案例详解下载
  • 建设部网站公民服务网页布局技巧
  • 网页设计成品网站云南省建设厅官网
  • 大连网站建设公司领超科技怎么样高端电子商务网站建设
  • 汕头多语种网站制作做什么地方网站
  • 企业网站在哪里建中航网站建设
  • 建设领域工人管理网站苏州展示型网站建设
  • 做服装必须看的十大网站微商城小程序商城
  • 做网站的品牌公司有哪些wix做的网站在国内访问不
  • 建设部网站 信用诚信评分标准制作照片的软件app
  • 重庆网网站建设公司展览展示展厅设计
  • 做数据图网站可以在手机上编程的软件
  • 山西建设网官方网站文库网站建设开发
  • 网站专题页面开发安阳市设计
  • 上海网站制作公司多少钱网络培训的心得体会
  • 兰州建网站的重庆二级站seo整站优化排名
  • 怎么建设手机网站小企网站建设解决方案
  • 网站备案好处网站建设的公司怎么收费
  • 企业网站建站之星wordpress建站 云打印
  • 番禺制作网站企业洛阳制作网站公司
  • 郑州哪家做网站好旅游企业网站开发
  • 免费网站的手机版本源码模板网站开发行业前景
  • 制作公司网站源代码怎么弄怎么上传网站
  • 定制制作网站哪家好网络文化经营许可证变更
  • 怎样免费做网站视频讲解自己做的网站用在博客上
  • 哈尔滨学校网站建设企业在公司做的网站遇到的问题
  • 福建住房和城建设网站培训机构需要哪些证件
  • 网站可以建几个人html编辑器代码
  • 医疗网站前置审批取消英语学习软件
  • 网站推广目标app开发流程表