轻量级大模型推理工具,专注于模型推理延迟,注重框架易用性和可拓展性。
Project description
OSC-LLM
轻量级大模型推理工具,专注于模型推理延迟。
特性
🚀 高性能推理
- CUDA Graph: 编译优化,减少推理延迟
- PagedAttention: 高效的KV缓存管理,支持长序列推理
- 连续批处理: 支持动态批量推理优化
🛠️ 易用性
- 轻量级设计: 专注于推理性能,减少依赖
- 简单API: 简洁的Python接口
- 模型管理: 内置下载和管理工具
安装
- 安装最新版本pytorch
- 安装flash-attn: 建议下载官方构建好的whl包,避免编译问题
- 安装osc-llm
pip install osc-llm --upgrade
快速开始
下载模型
llm download Qwen/Qwen3-0.6B
基本使用
from osc_llm import Qwen3ForCausalLM, Message
# 初始化模型
llm = Qwen3ForCausalLM("checkpoints/Qwen/Qwen3-0.6B")
llm.setup(device="cuda:0", gpu_memory_utilization=0.9)
# 对话
messages = [Message(role="user", content="介绍一下北京")]
messages = llm.chat(messages=messages, enable_thinking=True)
print(messages)
流式生成
messages = [Message(role="user", content="介绍一下北京")]
for token in llm.chat(messages=messages, stream=True):
print(token, end="", flush=True)
支持的模型
- Qwen3ForCausalLM (支持思考模式)
CLI 工具
llm download <repo_id> [--endpoint hf-mirror|modelscope]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
osc_llm-0.2.0.tar.gz
(11.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
osc_llm-0.2.0-py3-none-any.whl
(14.9 kB
view details)
File details
Details for the file osc_llm-0.2.0.tar.gz.
File metadata
- Download URL: osc_llm-0.2.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b45b0d56bbb2a23c02b3fc5cdbaa002bcf7a6c12ac2f4c14ff1b2f5849dafb38
|
|
| MD5 |
8fa7e20bb70fc4127725920242f7bc99
|
|
| BLAKE2b-256 |
ac5f0217ab6a2aded264142dec8bbd5fc7e5cf42a1b87121095c805a1a92df81
|
File details
Details for the file osc_llm-0.2.0-py3-none-any.whl.
File metadata
- Download URL: osc_llm-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f35bf389deaa315f24a146e7a6b98057f162d7ad0b828b1222df9c337501497c
|
|
| MD5 |
81f2d0f83684a2f542ed37cd5d00f86f
|
|
| BLAKE2b-256 |
b7307b7f1c67791b209f044939dd3d69d1e1b377ede6d236169a31373bb45309
|