赤兔(Chitu)是什么?
赤兔(Chitu)是由清华大学团队开源的一个高性能大语言模型推理框架,专注于提升推理效率、降低成本,并支持多种硬件平台和部署场景。它可以让DeepSeek推理成本降一半,性能翻番。赤兔(Chitu)的目标是为企业和开发者提供一个高效、灵活且易于部署的推理引擎,加速大语言模型(LLM)在实际应用中的落地。
赤兔(Chitu)功能特点
多元算力适配:支持 NVIDIA 最新旗舰到旧款的多系列产品,并为国产芯片提供优化支持。
全场景可伸缩:从纯 CPU 部署、单 GPU 部署到大规模集群部署,提供灵活的可扩展解决方案。
长期稳定运行:适用于实际生产环境,能够稳定承载并发业务流量。
高效推理性能:在 A800 集群测试中,相比部分国外开源框架,GPU 使用量减少 50% 的情况下推理速度提升 3.15 倍。
降低成本:通过优化硬件资源使用,降低了企业部署 ai 模型的门槛和成本。
赤兔(Chitu)应用场景
企业级 AI 应用:需要高性能、低延迟和高吞吐量的推理服务。
大规模集群部署:需要在多 GPU 或多节点环境中高效运行的场景。
资源受限的环境:需要在有限的硬件资源下实现高效推理的场景。
国产芯片适配:需要在国产硬件平台上运行大语言模型的场景。
赤兔(Chitu)使用方法
1. 源码安装
gitclone–recursivehttps://github.com/thu-pacman/chitu&&cdchitu
pipinstall-rrequirements-build.txt
pipinstall-Utorch–index-urlhttps://download.pytorch.org/whl/cu124#根据CUDA版本调整
TORCH_CUDA_ARCH_LIST=8.6CHITU_SETUP_JOBS=4MAX_JOBS=4pipinstall–no-build-isolation
2.单 GPU 推理
torchrun–nproc_per_node8test/single_req_test.pyrequest.max_new_tokens=64models=DeepSeek-R1models.ckpt_dir=/data/DeepSeek-R1infer.pp_size=1infer.tp_size=8
3.混合并行 (TP+PP)
torchrun–nnodes2–nproc_per_node8test/single_req_test.pyrequest.max_new_tokens=64infer.pp_size=2infer.tp_size=8models=DeepSeek-R1models.ckpt_dir=/data/DeepSeek-R1
4.启动服务
exportWORLD_SIZE=8
torchrun–nnodes1\
–nproc_per_node8\
–master_port=22525\
example/serve.py\
serve.port=21002\
infer.stop_with_eos=False\
infer.cache_type=paged\
infer.pp_size=1\
infer.tp_size=8\
models=DeepSeek-R1\
models.ckpt_dir=/data/DeepSeek-R1\
keep_dtype_in_checkpoint=True\
infer.mla_absorb=absorb-without-precomp\
infer.soft_fp8=True\
infer.do_load=True\
infer.max_reqs=1\
scheduler.prefill_first.num_tasks=100\
infer.max_seq_len=4096\
request.max_new_tokens=100\
infer.use_cuda_graph=True
5.性能测试
pythonbenchmarks/benchmark_serving.py\
–model"deepseek-r1"\
–iterations10\
–seq-len10\
–warmup3\
–base-urlhttp://localhost:21002
GitHub仓库:https://github.com/thu-pacman/chitu

