【vLLM 学习】基础教程

vLLM官方中文教程:使用vLLM的两种方式(离线推理和vllm server) 本文介绍了使用vllm推理框架的两种方式,离线推理和vllm server 阅读详情

vLLM 是一款专为大语言模型推理加速而设计的框架,实现了 KV 缓存内存几乎零浪费,解决了内存管理瓶颈问题。

更多 vLLM 中文文档及教程可访问 →https://vllm.hyper.ai/

在线运行 vLLM 入门教程:零基础分步指南

源码 examples/offline_inference/basic

Basic

LLM 类提供了主要的 Python 接口,用于离线推理,即在不使用独立推理服务器的情况下与模型交互。

使用方法

示例中的第一个脚本展示了 vLLM 最基本的用法。如果你是 Python 和 vLLM 的新手,建议从这里开始。

python examples/offline_inference/basic/basic.py

其余的脚本包含一个参数解析器,你可以使用它来传递任何与 LLM 兼容的参数。尝试使用 --help 运行脚本,查看所有可用参数列表。

python examples/offline_inference/basic/classify.py
python examples/offline_inference/basic/embed.py
python examples/offline_inference/basic/score.py

聊天(chat)和文本生成(generate)脚本还支持采样参数: max_tokens, temperature, top_p 和 top_k。

python examples/offline_inference/basic/chat.py
python examples/offline_inference/basic/generate.py

功能

在支持参数传递的脚本中,你可以尝试以下功能。

默认生成配置
–generation-config 参数用于指定调用 LLM.get_default_sampling_params() 时加载生成配置的路径。若设置为 ‘auto’,则从模型路径加载生成配置。若设置为文件夹路径,则从指定路径加载配置。若不提供该参数,则使用 vLLM 默认值。

若生成配置中指定了 max_new_tokens,则会在服务器范围内对所有请求的输出 token 数量施加限制。

尝试以下参数进行测试:

--generation-config auto

量化

AQLM
vLLM 支持使用 AQLM 量化的模型。

可以使用 --model 参数测试以下任一模型:

ISTA-DASLab/Llama-2-7b-AQLM-2Bit-1x16-hf
ISTA-DASLab/Llama-2-7b-AQLM-2Bit-2x8-hf
ISTA-DASLab/Llama-2-13b-AQLM-2Bit-1x16-hf
ISTA-DASLab/Mixtral-8x7b-AQLM-2Bit-1x16-hf
BlackSamorez/TinyLlama-1_1B-Chat-v1_0-AQLM-2Bit-1x16-hf

部分模型可能过大,无法在单块 GPU 上运行。你可以通过设置 --tensor-parallel-size 来将其拆分到多块 GPU
上运行。

GGUF

vLLM 还支持使用 GGUF 量化的模型。

你可以下载一个 GGUF 量化模型,并使用以下参数进行测试:

from huggingface_hub import hf_hub_download
repo_id = "bartowski/Phi-3-medium-4k-instruct-GGUF"
filename = "Phi-3-medium-4k-instruct-IQ2_M.gguf"
print(hf_hub_download(repo_id, filename=filename))
--model {local-path-printed-above} --tokenizer microsoft/Phi-3-medium-4k-instruct

CPU 内存卸载

cpu-offload-gb 参数可以视作一种虚拟扩展 GPU 内存的方式。例如,如果你有一块 24GB 的 GPU,并将该参数设置为 10GB,则可以将其视为一块 34GB 的 GPU,从而加载一个 13B 规模的 BF16 模型(最低需要 26GB GPU 内存)。但需要注意,此方法依赖于高速的 CPU-GPU 互连,因为部分模型会在每次前向传播时从 CPU 内存动态加载到 GPU 内存。

尝试以下参数进行测试:

--model meta-llama/Llama-2-13b-chat-hf --cpu-offload-gb 10

示例材料

basic.py

# SPDX-License-Identifier: Apache-2.0

from vllm import LLM, SamplingParams

# Sample prompts.
# 样本提示。
prompts = [
    "Hello, my name is",
    "The president of the United States is",
    "The capital of France is",
    "The future of AI is",
]
# Create a sampling params object.
# 创建一个采样参数对象。
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)

# Create an LLM.
# 创建一个 LLM。
llm = LLM(model="facebook/opt-125m")
# Generate texts from the prompts. The output is a list of RequestOutput objects
# that contain the prompt, generated text, and other information.
# 从提示中生成文本。输出是 RequestOutput 的包含提示,生成的文本和其他信息对象列表。
outputs = llm.generate(prompts, sampling_params)
# Print the outputs.
# 打印输出。
print("\nGenerated Outputs:\n" + "-" * 60)
for output in outputs:
    prompt = output.prompt
    generated_text = output.outputs[0].text
    print(f"Prompt:    {prompt!r}")
    print(f"Output:    {generated_text!r}")
    print("-" * 60)

chat.py

# SPDX-License-Identifier: Apache-2.0

from vllm import LLM, EngineArgs
from vllm.utils import FlexibleArgumentParser


def main(args: dict):
    # Pop arguments not used by LLM
    # 弹出 LLM 未使用的参数
    max_tokens = args.pop("max_tokens")
    temperature = args.pop("temperature")
    top_p = args.pop("top_p")
    top_k = args.pop("top_k")
    chat_template_path = args.pop("chat_template_path")

    # Create an LLM
    # 创建一个 LLM
    llm = LLM(**args)

    # Create sampling params object
    # 创建采样参数对象
    sampling_params = llm.get_default_sampling_params()
    if max_tokens is not None:
        sampling_params.max_tokens = max_tokens
    if temperature is not None:
        sampling_params.temperature = temperature
    if top_p is not None:
        sampling_params.top_p = top_p
    if top_k is not None:
        sampling_params.top_k = top_k

    def print_outputs(outputs):
        print("\nGenerated Outputs:\n" + "-" * 80)
        for output in outputs:
            prompt = output.prompt
            generated_text = output.outputs[0].text
            print(f"Prompt: {prompt!r}\n")
            print(f"Generated text: {generated_text!r}")
            print("-" * 80)

    print("=" * 80)

    # In this script, we demonstrate how to pass input to the chat method:
    # 在此脚本中,我们演示了如何将输入传递到 chat 方法:
    conversation = [
        {
            "role": "system",
            "content": "You are a helpful assistant"
        },
        {
            "role": "user",
            "content": "Hello"
        },
        {
            "role": "assistant",
            "content": "Hello! How can I assist you today?"
        },
        {
            "role": "user",
            "content":
            "Write an essay about the importance of higher education.",
        },
    ]
    outputs = llm.chat(conversation, sampling_params, use_tqdm=False)
    print_outputs(outputs)

    # You can run batch inference with llm.chat API
    # 您可以使用 llm.chat API 进行批处理推断
    conversations = [conversation for _ in range(10)]

    # We turn on tqdm progress bar to verify it's indeed running batch inference
    # 我们打开 tqdm 进度栏以验证其确实正在运行批处理推断
    outputs = llm.chat(conversations, sampling_params, use_tqdm=True)
    print_outputs(outputs)

    # A chat template can be optionally supplied.
    # If not, the model will use its default chat template.
    # 可以选择提供聊天模板。
    # 如果没有,该模型将使用其默认聊天模板。
    if chat_template_path is not None:
        with open(chat_template_path) as f:
            chat_template = f.read()

        outputs = llm.chat(
            conversations,
            sampling_params,
            use_tqdm=False,
            chat_template=chat_template,
        )


if __name__ == "__main__":
    parser = FlexibleArgumentParser()
    # Add engine args
    # 添加引擎 Args
    engine_group = parser.add_argument_group("Engine arguments")
    EngineArgs.add_cli_args(engine_group)
    engine_group.set_defaults(model="meta-llama/Llama-3.2-1B-Instruct")
    # Add sampling params
    # 添加采样参数
    sampling_group = parser.add_argument_group("Sampling parameters")
    sampling_group.add_argument("--max-tokens", type=int)
    sampling_group.add_argument("--temperature", type=float)
    sampling_group.add_argument("--top-p", type=float)
    sampling_group.add_argument("--top-k", type=int)
    # Add example params
    # 添加示例参数
    parser.add_argument("--chat-template-path", type=str)
    args: dict = vars(parser.parse_args())
    main(args)

classify.py

# SPDX-License-Identifier: Apache-2.0

from argparse import Namespace

from vllm import LLM, EngineArgs
from vllm.utils import FlexibleArgumentParser


def main(args: Namespace):
    # Sample prompts.
    # 样本提示。
    prompts = [
        "Hello, my name is",
        "The president of the United States is",
        "The capital of France is",
        "The future of AI is",
    ]

    # Create an LLM.
    # You should pass task="classify" for classification models
    # 创建一个 LLM。
    # 您应该传递 task="classify" 给分类模型
    model = LLM(**vars(args))

    # Generate logits. The output is a list of ClassificationRequestOutputs.
    # 生成 logits。输出是 ClassificationRequestOutputs 的列表。
    outputs = model.classify(prompts)

    # Print the outputs.
    # 打印输出。
    print("\nGenerated Outputs:\n" + "-" * 60)
    for prompt, output in zip(prompts, outputs):
        probs = output.outputs.probs
        probs_trimmed = ((str(probs[:16])[:-1] +
                          ", ...]") if len(probs) > 16 else probs)
        print(f"Prompt: {prompt!r} \n"
              f"Class Probabilities: {probs_trimmed} (size={len(probs)})")
        print("-" * 60)


if __name__ == "__main__":
    parser = FlexibleArgumentParser()
    parser = EngineArgs.add_cli_args(parser)
    # Set example specific arguments
    # 设置示例特定参数
    parser.set_defaults(model="jason9693/Qwen2.5-1.5B-apeach",
                        task="classify",
                        enforce_eager=True)
    args = parser.parse_args()
    main(args)

embed.py

# SPDX-License-Identifier: Apache-2.0

from argparse import Namespace

from vllm import LLM, EngineArgs
from vllm.utils import FlexibleArgumentParser


def main(args: Namespace):
    # Sample prompts.
    # 样本提示。
    prompts = [
        "Hello, my name is",
        "The president of the United States is",
        "The capital of France is",
        "The future of AI is",
    ]

    # Create an LLM.
    # You should pass task="embed" for embedding models
    # 创建一个 LLM。
    # 您应该传递 task="embed 给嵌入模型"
    model = LLM(**vars(args))

    # Generate embedding. The output is a list of EmbeddingRequestOutputs.
    # 生成嵌入。输出是 EmbeddingRequestOutputs 的列表。
    outputs = model.embed(prompts)

    # Print the outputs.
    # 打印输出。
    print("\nGenerated Outputs:\n" + "-" * 60)
    for prompt, output in zip(prompts, outputs):
        embeds = output.outputs.embedding
        embeds_trimmed = ((str(embeds[:16])[:-1] +
                           ", ...]") if len(embeds) > 16 else embeds)
        print(f"Prompt: {prompt!r} \n"
              f"Embeddings: {embeds_trimmed} (size={len(embeds)})")
        print("-" * 60)


if __name__ == "__main__":
    parser = FlexibleArgumentParser()
    parser = EngineArgs.add_cli_args(parser)
    # Set example specific arguments
    # 设置示例特定参数
    parser.set_defaults(model="intfloat/e5-mistral-7b-instruct",
                        task="embed",
                        enforce_eager=True)
    args = parser.parse_args()
    main(args)

generate.py

# SPDX-License-Identifier: Apache-2.0

from vllm import LLM, EngineArgs
from vllm.utils import FlexibleArgumentParser


def main(args: dict):
    # Pop arguments not used by LLM
    # 弹出 LLM 未使用的参数
    max_tokens = args.pop("max_tokens")
    temperature = args.pop("temperature")
    top_p = args.pop("top_p")
    top_k = args.pop("top_k")

    # Create an LLM
    # 创建一个 LLM
    llm = LLM(**args)

    # Create a sampling params object
    # 创建一个采样参数对象
    sampling_params = llm.get_default_sampling_params()
    if max_tokens is not None:
        sampling_params.max_tokens = max_tokens
    if temperature is not None:
        sampling_params.temperature = temperature
    if top_p is not None:
        sampling_params.top_p = top_p
    if top_k is not None:
        sampling_params.top_k = top_k

    # Generate texts from the prompts. The output is a list of RequestOutput
    # objects that contain the prompt, generated text, and other information.
    # 从提示中生成文本。输出是 RequestOutput 的包含提示,生成文本和其他信息的对象列表。
    prompts = [
        "Hello, my name is",
        "The president of the United States is",
        "The capital of France is",
        "The future of AI is",
    ]
    outputs = llm.generate(prompts, sampling_params)
    # Print the outputs.
    # 打印输出。
    for output in outputs:
        prompt = output.prompt
        generated_text = output.outputs[0].text
        print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")


if __name__ == "__main__":
    parser = FlexibleArgumentParser()
    # Add engine args
    # 添加引擎 Args
    engine_group = parser.add_argument_group("Engine arguments")
    EngineArgs.add_cli_args(engine_group)
    engine_group.set_defaults(model="meta-llama/Llama-3.2-1B-Instruct")
    # Add sampling params
    # 添加采样参数
    sampling_group = parser.add_argument_group("Sampling parameters")
    sampling_group.add_argument("--max-tokens", type=int)
    sampling_group.add_argument("--temperature", type=float)
    sampling_group.add_argument("--top-p", type=float)
    sampling_group.add_argument("--top-k", type=int)
    args: dict = vars(parser.parse_args())
    main(args)

score.py

# SPDX-License-Identifier: Apache-2.0

from argparse import Namespace

from vllm import LLM, EngineArgs
from vllm.utils import FlexibleArgumentParser


def main(args: Namespace):
    # Sample prompts.
    # 样本提示。
    text_1 = "What is the capital of France?"
    texts_2 = [
        "The capital of Brazil is Brasilia.",
        "The capital of France is Paris.",
    ]

    # Create an LLM.
    # You should pass task="score" for cross-encoder models
    # 创建一个 LLM。
    # 您应该传递 task="score" 给跨编码模型
    model = LLM(**vars(args))

    # Generate scores. The output is a list of ScoringRequestOutputs.
    # 生成分数。输出是 ScoringRequestOutputs 的列表。
    outputs = model.score(text_1, texts_2)

    # Print the outputs.
    # 打印输出。
    print("\nGenerated Outputs:\n" + "-" * 60)
    for text_2, output in zip(texts_2, outputs):
        score = output.outputs.score
        print(f"Pair: {[text_1, text_2]!r} \nScore: {score}")
        print("-" * 60)


if __name__ == "__main__":
    parser = FlexibleArgumentParser()
    parser = EngineArgs.add_cli_args(parser)
    # Set example specific arguments
    # 设置示例特定参数
    parser.set_defaults(model="BAAI/bge-reranker-v2-m3",
                        task="score",
                        enforce_eager=True)
    args = parser.parse_args()
    main(args)
vllm的使用方式,入门教程 vLLM是一个强大且易于使用的推理框架,适用于多种场景。通过上述步骤,您可以快速上手并开始使用vLLM进行大语言模型推理。如果遇到问题,可以参考官方文档或社区资源进行解决。全参数微调(Full-Parameter Fine-Tuning)vLLM支持对预训练模型进行全参数微调,以适应特定任务或数据集。这种方法通过调整所有模型参数来优化性能,适用于需要大量数据和计算资源的场景。LoRA是一种高效、快速且参数效率高的微调方法,特别适用于资源有限的环境,如移动应用或边缘设备。 阅读详情

相关推荐

vLLM官方中文教程:用vllm实现所有的模型量化

本文讲解了使用vLLM框架实现模型量化的所有方法

my_name_is_learn的博客 9019

如何使用vllm在服务器上部署模型并调用

如果网络超时或者报错。可以选择从魔塔社区下载,vllm默认是从huggingface去下载的。环境准备:python3.10,cuda12.1。在魔塔社区找到自己要下载的模型。如果没有下载模型,会先下载模型的。

程序源的博客 6493

vllm学习

shm-size=1g 是设置共享内存为 1GB,适用于大多数情况,但深度学习任务可能需要更大值(如 2g 或 4g)。如果遇到 CUDA OOM 或数据库崩溃,优先检查 shm-size 是否足够。启动容器时设置,运行后无法修改。

小白菜的博客 1264

使用 vLLM 部署本地 LLM 指南

我们输入以下命令启动服务器,–model 为本地模型的路径,–served-model-name 是模型在服务器中的别名,这里我们取简称 openchat,其他都是默认值,当然也可以自己设置。在这里我们不演示了,直接将 vLLM 部署为模仿 OpenAI API 协议的服务器,这使得 vLLM 可以用作使用 OpenAI API 的应用程序的直接替代品。当然,你也可以试一试 ChatCompletions 格式的请求,ChatCompletions API 的请求内容如下,两种的格式还是有一些区别的。

spicy_chicken123的博客 4万+

【vLLM】使用 vLLM 对自定义实现模型进行高速推理

在本文中,我们将解释如何使用 vLLM 使用视频生成模型推断独特的多模式模型。vLLM 是一个用于高速推理和服务的 LLM 库,它非常易于使用,支持 Llama 和 Qwen 等知名模型。另一方面,除了官方文档之外,关于如何合并自定义实现模型的信息非常少,甚至官方文档也没有特别的信息,因此很难上手。因此,在本文中,我们将仔细解释将您自己的多模态模型合并到 vLLM 中的具体步骤,包括官方文档中未包含的信息。

欧阳天涵的专栏 3361

vLLM在Ascend上的适配解析

通过图片可以看到,vllm-ascend plugin使Ascend社区开发的能够让大模型推理框架vLLM无缝运行在华为NPU上的硬件后端插件。Plugin方法优点类似于面向对象思想当中的继承和多态,官方考虑通用性和定义框架标准(父类),由Ascend通过继承PlatForm,自己实现Worker、ModelRunner、AttentionBackend等子类。Ascend通过优化,将vLLM的核心计算图对接到了自己的CANN算子库上。

weixin_43549643的博客 3711

【vLLM学习笔记】:vLLM 参数说明

vLLM 是一个高性能的语言模型推理框架,提供丰富的参数配置选项。主要参数包括:模型相关(--model、--tokenizer、--dtype等)、分布式部署(--worker-use-ray、-pp、-tp等)、性能优化(--block-size、--gpu-memory-utilization等)、量化支持(--quantization)、LoRA适配(--enable-lora)以及硬件配置(--device)。

一只努力学习的小碗~ 2031

【win11+vs 2017+OpenCV4.5.5+Qt5.12配置】详细安装过程+小问题解决

由于Qt5无法与最新的vs2022兼容,扩展工具中一直显示不可用,所以将vs降级成vs2017。在安装Qt的过程中,会选择安装Qt套件,其中就的MCVS 2017,说明vs2017是与qt兼容的。当然也可以用qt creator这一原生IDE。OpenCV版本目前是最新的4.8.0,使用过程中没有什么问题,但是还是安装低版本大概率避免一些玄学问题。

qq_45306739的博客 3350

vLLM学习1

只要理解了。

xnuscd的博客 4778

微信群消息监控系统实战:从零搭建Python自动化监控平台

本文详细介绍了如何从零搭建Python微信群消息监控系统,实现自动化监控和记录群消息。通过wxauto库模拟人工操作微信,结合MySQL数据库存储和智能去重策略,系统能高效处理大量消息并支持关键词监控。文章还分享了性能优化、安全合规等实战经验,帮助开发者快速构建高效稳定的监控平台。

weixin_29091105的博客 320

从零到一:AIGC+Unity3D打造动态天空盒的实战指南

本文详细介绍了如何利用AIGC技术结合Unity3D打造动态天空盒的实战指南。通过AIGC生成360全景图,再集成到Unity3D中,实现高效、多样化的天空盒效果。文章涵盖了从AIGC全景图生成、工作流搭建到Unity场景集成的完整流程,并提供了代码示例和优化建议,帮助开发者快速掌握这一技术。

weixin_29021291的博客 603

【vLLM 学习】调试技巧

vLLM 是一款专为大语言模型推理加速而设计的框架,实现了 KV 缓存内存几乎零浪费,解决了内存管理瓶颈问题。更多 vLLM 中文文档及教程可访问 →。

HyperAI超神经 2735

小白的MatSWMM使用心路(二)——用matlab修改INP文件参数/使用matlab查找txt内容并修改多行内容

说是修改inp,但是里面的内容大部分还是讲怎么修改txt的……(?)。包含如何找到需要的参数(关键字)位置,以及修改那个位置的txt这样的内容。希望能帮助大家吧……Matlab你要多出好用的功能啊!

weixin_44276743的博客 4530

【vLLM 学习】安装

vLLM 是一款专为大语言模型推理加速而设计的框架,实现了 KV 缓存内存几乎零浪费,解决了内存管理瓶颈问题。更多 vLLM 中文文档及教程可访问 →https://vllm.hyper.ai/vLLM 是一个 Python 库,包含预编译的 C++ 和 CUDA (12.1) 二进制文件。

HyperAI超神经 3613

YOLO11实战:手把手教你优化钢材表面缺陷识别模型(基于NEU-DET数据集)

本文详细介绍了如何使用YOLO11优化钢材表面缺陷识别模型,基于NEU-DET数据集进行实战训练。从数据增强、模型架构优化到训练过程控制,全面解析提升钢材缺陷检测性能的关键技术,特别针对裂纹、划痕等典型缺陷提出针对性解决方案。

weixin_29081163的博客 379

deepfake detection数据集

最全Deepfake数据集总结,包含各个数据集下载链接: https://github.com/deepfakeinthewild/deepfake_in_the_wild Dataset name Download Generate method Deepfake videos Actors Deepfake-TIMIT low download De...

where_is_horse的博客 1万+

vLLM 教程:使用 vLLM 加载大模型进行少样本学习

选择「NVIDIA GeForce RTX 4090」以及「vLLM」镜像,OpenBayes 平台上线了新的计费方式,大家可以按照需求选择「按量付费」或「包日/周/月」,点击「继续执行」。进入到工作空间后,打开左侧目录中的「README.ipynb」文件即可查看教程的运行步骤。,在「公共教程」页面,选择「使用 vLLM 加载大模型进行少样本学习」教程。稍等片刻,待系统分配好资源,当状态变为「运行中」后,点击「打开工作空间」。页面跳转后,点击右上角「克隆」,将该教程克隆至自己的容器中。

XLionXxxx的博客 1335

芒果YOLOv8改进160:姿态估计Head篇:即插即用|轻量化非对称多级压缩LOADH旋转检测头,原创改进适配YOLOv8高效检测头,检测头新颖改进,全网首发独一份

芒果YOLOv8改进159:OBB旋转检测头Head篇:即插即用|轻量化非对称多级压缩LOADH旋转检测头,原创改进适配YOLOv8高效检测头,检测头新颖改进,全网首发独一份

包括YOLOv5、YOLOv7、YOLOv8等模型改进 812

【vLLM 学习】使用 CPU 安装

vLLM 是一款专为大语言模型推理加速而设计的框架,实现了 KV 缓存内存几乎零浪费,解决了内存管理瓶颈问题。更多 vLLM 中文文档及教程可访问 →vLLM 最初支持在 x86 CPU 平台上的基本模型推理和服务,数据类型为 FP32 和 BF16。

HyperAI超神经 4732

Livox激光雷达传感器在Python3中的完整驱动程序:深入剖析OpenPyLivox库的实现和应用

当我们提到激光雷达或激光扫描技术时,Livox激光雷达传感器无疑是业界的佼佼者。尽管Livox提供了基于C++的官方软件和API,但现在,有了OpenPyLivox (OPL) 库,Python开发者们也能够轻松地接入和控制这些高级的激光雷达设备。

qq_38334677的博客 1002

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

【vLLM 学习】使用 Neuron 安装

vLLM 是一款专为大语言模型推理加速而设计的框架,实现了 KV 缓存内存几乎零浪费,解决了内存管理瓶颈问题。更多 vLLM 中文文档及教程可访问 →从 vLLM 0.3.3 版本起,支持在带有 Neuron SDK 的 AWS Trainium/Inferentia 上进行模型推理和服务。目前 Neuron SDK 不支持分页注意力 (Paged Attention),但 Transformers-neuronx 支持简单的连续批处理。Neuron SDK 目前支持的数据类型为 FP16 和 BF16。

HyperAI超神经 950

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

用vllm快速部署大模型

在迅速发展的AI领域中,高效部署大型语言模型(LLM)对于许多应用程序至关重要。对于希望利用LLM力量的开发人员和组织来说,vLLM提供了一种简单、快速且经济高效的解决方案,用于在GPU上运行模型。本文将指导您完成vLLM的安装、在服务器上运行它以及将其集成到应用程序中的步骤。vLLM专为希望在其GPU上托管大型语言模型的人设计,这对于高吞吐量、并行处理和流式输出至关重要。无论您是在计算机上本地部署模型,还是在基于云的实例上部署,vLLM都提供了一个强大且可扩展的解决方案。

weixin_58753619的博客 4316

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

【vLLM 学习】欢迎来到 vLLM!

vLLM 是一款专为大语言模型推理加速而设计的框架,实现了 KV 缓存内存几乎零浪费,解决了内存管理瓶颈问题。更多 vLLM 中文文档及教程可访问 →vLLM 是一个快速且易于使用的库,专为大型语言模型 (LLM) 的推理和部署而设计。vLLM 的灵活性和易用性体现在以下方面:无缝集成流行的 HuggingFace 模型具有高吞吐量服务以及各种解码算法,包括并行采样、束搜索等支持张量并行和流水线并行的分布式推理流式输出提供与 OpenAI 兼容的 API 服务器。

HyperAI超神经 1483

vllm学习笔记

因为最近需要学习vllm的原因,准备从vllm实现mamba的代码看起,学习page attention,rms norm等一些量化和加速方法,争取可以用mamba的方法搓出来一个linear attention。这样的好处就是几乎不会有碎片化的内存被浪费,并且不用提前申请一大块内存,可以一边自回归,一边储存。自回归transformer中kv不需要重复计算,因为casual mask的出现,当前q只需要和之前token的kv相乘,所以需要把之前的k和v储存下来减少运算量,这就是kv cache。

gdhsss的博客 1323

vLLM框架入门基础教程(保姆级详解),vLLM从入门到精通,收藏这一篇就够了!

作为vLLM源码的开发者、框架的使用者,刚接触vLLM框架时会有这样的问题“如何快速地了解vLLM全貌?”。推荐的一个学习步骤: 先大致了解整体运行流程,接着理解关键模块逻辑,然后学习关键特性。同时,逐步理解源码。

m0_59164520的博客 1286

Nano-vLLM 源码学习

Nano-vLLM是一个轻量级vLLM实现项目,具有高效推理、代码可读性强等特点。项目包含引擎管理和基础层实现两大核心模块:引擎目录(engine)通过LLMEngine、ModelRunner等组件构建推理流程,支持序列管理、块缓存优化和并行计算;基础层目录(layers)提供注意力机制、激活函数等基础组件,采用Triton优化KV缓存和Flash Attention加速计算。测试显示在RTX 4070笔记本上吞吐量优于原版vLLM,适用于需要高效离线推理的场景。项目结构清晰,包含bench测试、示例代码

haohaifeng002的博客 2331
上一篇: 在线教程丨9 秒处理一张图!In-Context Edit 高效图像编辑框架上线
下一篇: 首次实现纳米晶体端到端解析,哥大团队提出PXRDnet,成功解析200种复杂模拟纳米晶体
HyperAI超神经
博客等级 码龄7年 8873粉丝 1753原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值