ktransformers icon indicating copy to clipboard operation
ktransformers copied to clipboard

为什么我的输出速度很慢,只有0.04token/s

Open git-cuiry opened this issue 1 year ago • 6 comments

求助 我这个输出速度这么慢,是硬件的原因吗?我看网上大家速度至少还是有1token/s 的

Image

我运行的模型 DeepseekR1_Q4_K_M

我的CPU CPU:Intel(R) Xeon(R) Gold 6240R CPU @ 2.40GHz

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 96 On-line CPU(s) list: 0-95 Thread(s) per core: 2 Core(s) per socket: 24 Sockets: 2 NUMA 节点: 2 厂商 ID: GenuineIntel CPU 系列: 6 型号: 85 型号名称: Intel(R) Xeon(R) Gold 6240R CPU @ 2.40GHz 步进: 7 CPU MHz: 999.902 CPU max MHz: 4000.0000 CPU min MHz: 1000.0000 BogoMIPS: 4800.00 虚拟化: VT-x L1d 缓存: 32K L1i 缓存: 32K L2 缓存: 1024K L3 缓存: 36608K NUMA 节点0 CPU: 0-23,48-71 NUMA 节点1 CPU: 24-47,72-95 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 invpcid_single intel_ppin intel_pt ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke avx512_vnni md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities

我的内存

Memory: System RAM: total: 192 GiB available: 188.4 GiB used: 13.46 GiB (7.1%) Array-1: capacity: 9 TiB note: check slots: 24 modules: 6 EC: Single-bit ECC Device-1: CPU0_C0D0 type: DDR4 size: 32 GiB speed: spec: 3200 MT/s actual: 2933 MT/s Device-2: CPU0_C0D1 type: no module installed Device-3: CPU0_C1D0 type: no module installed Device-4: CPU0_C1D1 type: no module installed Device-5: CPU0_C2D0 type: no module installed Device-6: CPU0_C2D1 type: no module installed Device-7: CPU0_C3D0 type: DDR4 size: 32 GiB speed: 2933 MT/s Device-8: CPU0_C3D1 type: no module installed Device-9: CPU0_C4D0 type: DDR4 size: 32 GiB speed: 2933 MT/s Device-10: CPU0_C4D1 type: no module installed Device-11: CPU0_C5D0 type: no module installed Device-12: CPU0_C5D1 type: no module installed Device-13: CPU1_C0D0 type: DDR4 size: 32 GiB speed: 2933 MT/s Device-14: CPU1_C0D1 type: no module installed Device-15: CPU1_C1D0 type: DDR4 size: 32 GiB speed: 2933 MT/s Device-16: CPU1_C1D1 type: no module installed Device-17: CPU1_C2D0 type: no module installed Device-18: CPU1_C2D1 type: no module installed Device-19: CPU1_C3D0 type: DDR4 size: 32 GiB speed: spec: 3200 MT/s actual: 2933 MT/s Device-20: CPU1_C3D1 type: no module installed Device-21: CPU1_C4D0 type: no module installed Device-22: CPU1_C4D1 type: no module installed Device-23: CPU1_C5D0 type: no module installed Device-24: CPU1_C5D1 type: no module installed

运行后GPU占用

Image

内存和CPU占用

Image

运行时用的命令

numactl -N 1 -m 1 python ./ktransformers/local_chat.py --model_path /home/qwen/ktransformer-models/DeepSeek-V3/ --gguf_path /home/qwen/ktransformer-models/DeepSeek-R1-GGUF/DeepSeek-R1-Q4_K_M --optimize_rule_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat-multi-gpu.yaml --cpu_infer 64 --max_new_tokens 10000

git-cuiry avatar Feb 23 '25 08:02 git-cuiry

减少一下max tokens的数量看一下,我在本地一张NVIDIA A10(24G)+单路Intel Platinum 8255C,400G内存,1000MaxTokens下也有6tps的速度

ArSrNa avatar Feb 23 '25 10:02 ArSrNa

你的内存不够,Q4_K_M至少要400G

jzw02 avatar Feb 24 '25 01:02 jzw02

内存太小了,虽然能跑起来,但是频繁从磁盘读数据导致很慢。

xwzheng1020 avatar Feb 24 '25 02:02 xwzheng1020

prompt eval count:    29 token(s)
prompt eval duration: 137.19098472595215s
prompt eval rate:     0.21138415223077064 tokens/s
eval count:           300 token(s)
eval duration:        964.1179256439209s
eval rate:            0.3111652548101252 tokens/s

我的硬件环境是: CPU:61332 双路 RAM:128G (DDR4 2933 64g2) GPU:40902 (24g2),部署的Deepseek-R1-671B-Q2,处理速度 0.31 tokens/s。 资源占用:CPU 2800%,GPU 13g。估计也是内存不够频繁从磁盘读数据导致很慢。

zhangJoel avatar Feb 25 '25 06:02 zhangJoel

你的内存不够,Q4_K_M至少要400G

我的是500G内存,但是加载模型内存使用率极低

xieyongshuai avatar Feb 26 '25 05:02 xieyongshuai

This issue has been automatically closed due to inactivity for 60 days.

If you believe this issue is still relevant, please feel free to reopen it with additional information or context.

Thank you for your contribution to KTransformers!


此 issue 因超过 60 天无活动而被自动关闭。

如果您认为此问题仍然存在,请随时重新打开并提供更多信息或上下文。

感谢您对 KTransformers 的贡献!

ErvinXie avatar Dec 11 '25 03:12 ErvinXie