TGI(Text Generation Inference)是 Hugging Face 专为生产环境优化的文本生成服务,相比直接使用 transformers​ 库的 pipeline​,它在性能、功能和部署效率上有显著提升。以下是主要改进点:


1. 性能优化

  • 连续批处理(Continuous Batching)
    TGI 支持动态批处理,将不同长度的请求合并计算,显著提高 GPU 利用率(尤其适合长短不一的请求)。而 pipeline​ 的批处理是静态的,同一批次内的输入必须填充到相同长度,浪费计算资源。
  • Flash Attention 和 Paged Attention
    通过优化注意力机制减少显存占用,支持更长上下文(如 100K tokens)。transformers​ 需手动启用这些功能且依赖特定硬件。
  • 量化支持
    TGI 内置 GPTQ、bitsandbytes 等量化技术,降低显存需求;pipeline​ 需额外配置。

阅读全文 »

Rust GUI 图形渲染

public:: true

[^1]: # wgpu

- ![big-picture.png](https://github.com/gfx-rs/wgpu/blob/trunk/etc/big-picture.png?raw=true)
阅读全文 »

public:: true
type:: 笔记
item-type:: 软件分享
plane:: done

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

阅读全文 »
0%