Please analyze this codebase and create an AGENTS.md file containing: 1. Build/lint/test…
- User
Please analyze this codebase and create an AGENTS.md file containing:
- Build/lint/test commands - especially for running a single test
- Code style guidelines including imports, formatting, types, naming conventions, error handling, etc.
The file you create will be given to agentic coding agents (such as yourself) that operate in this repository. Make it about 150 lines long. If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include them.
If there's already an AGENTS.md, improve it if it's located in /
Assistant
Created
/user_0a329be7/Downloads/vllm-omni-main/AGENTS.md(173 lines). It includes:- Build/lint/test commands - Installation, ruff/mypy/pre-commit, running tests (including single test with
pytest tests/path/test_file.py::test_func), test markers - Code style guidelines - Import organization, naming conventions (snake_case, CapWords), type hints (modern Python 3.10+ syntax), error handling, ruff/mypy configuration, pre-commit hooks, testing patterns, async code
No Cursor rules (
.cursor/rules/or.cursorrules) or Copilot rules (.github/copilot-instructions.md) were found in the repository.- Build/lint/test commands - Installation, ruff/mypy/pre-commit, running tests (including single test with
- User
给我仔细讲一讲这个项目 尤其是在fp8支持 以及text encoder\dit互斥加载在vram上的适配性和优化 给我仔细讲讲这个工作
Assistant
- User
Model-Level Offload和 Layer-wise Offload 不考虑显存峰值问题 谁会更快?
Assistant
Layer-wise Offload 更快,原因如下:
对比分析
维度 Model-Level Offload Layer-wise Offload 切换粒度 整个 DiT / Text Encoder 单个 DiT block 切换次数 少(每阶段一次) 多(每个 block 一次) 每次切换开销 高(加载整个模型) 低(加载一个 block) 传输 overlap 无 有(独立 CUDA Stream) Text Encoder 加载 每个 request 多次 通常只需一次 关键原因
Layer-wise Offload 的优势:
-
开销更小:每次只需加载一个 block(~100MB 级),而非整个 DiT(~5-20GB)
-
异步预取:使用独立 CUDA Stream,在当前 block 计算时异步加载下一个 block:
# layerwise_backend.py with torch.cuda.stream(self.copy_stream): # 独立 stream gpu_weight.copy_(cpu_weight, non_blocking=True) -
Text Encoder 稳定驻留:如果显存足够,Text Encoder 可以一直待在 GPU 上,不用反复卸载/加载
Model-Level Offload 的问题:
- Text Encoder 和 DiT 必须交替执行,无法 overlap
- 每次切换都需要完整的模型加载/卸载,延迟高
结论
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.