mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #374] 使用volta和turing架构显卡运行的可能办法 #248
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#248
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @20000419 on GitHub (Feb 16, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/374
首先,git下载最新的源码。
然后,修改源码中的DeepSeek-V3-Chat-multi-gpu-4.yaml,和其他所有相关的yaml文件,将里面所有的KLinearMarlin换成KLinearTorch;
然后,你需要从ktransformer的源码进行编译,直到在本机编译成功。
然后,安装flash-attn,不会用到,但是不安装会报错。
然后,修改local_chat.py,将里面所有的flash_attention_2换成eager;
然后,运行locai_chat.py,务必按照官方教程的命令来,根据本机参数调整;
然后,在运行过程中检查内存占用,通过top命令观察其调用情况,单路cpu上的内存容量一定要大于模型的完整大小。(多路也只是复制)
最后,确认模型完整加载到内存,特定权重层完整加载到显存后,在chat界面尝试输入内容,观察是否还有报错出现。
@20000419 commented on GitHub (Feb 16, 2025):
欢迎大家补充更多细节。
@ShinoharaHare commented on GitHub (Feb 16, 2025):
在 Linux 上
KDeepseekV2Attention還是會使用 FA2github.com/kvcache-ai/ktransformers@65d73ea3f8/ktransformers/operators/attention.py (L310-L316)要強制使用
forward_windows才行github.com/kvcache-ai/ktransformers@65d73ea3f8/ktransformers/operators/attention.py (L393-L425)@20000419 commented on GitHub (Feb 17, 2025):
请问您现在跑通了吗?在解决了这个报错之后。
@ShinoharaHare commented on GitHub (Feb 17, 2025):
是的,有成功運行
@1986smalltiger commented on GitHub (Feb 17, 2025):
这个是怎么修改的?还有指导? @ShinoharaHare
@20000419 commented on GitHub (Feb 18, 2025):
@tonyeatsm commented on GitHub (Feb 18, 2025):
感谢,你的修改方案+ “20000419” 的方案 可以在v100 的四张卡上运行, 但是太慢了48 Core的CPU已经打满了,但是4张GPU 利用率跳跃 只利用15%
Chat: nihao
Nihao! (你好!) That means "hello" in Chinese. How can I assist you today? 😊
prompt eval count: 5 token(s)
prompt eval duration: 5.843478202819824s
prompt eval rate: 0.8556547704049283 tokens/s
eval count: 25 token(s)
eval duration: 16.465613842010498s
eval rate: 1.5183156996075544 tokens/s
@bluezd commented on GitHub (Feb 18, 2025):
@tonyeatsm 能分享下具体是怎么改的吗?
我修改后报如下错误:
@bluezd commented on GitHub (Feb 18, 2025):
main 分支中并没有
forward_linux()这个方法 https://github.com/kvcache-ai/ktransformers/blob/main/ktransformers/operators/attention.py#L549-L593@ShinoharaHare commented on GitHub (Feb 19, 2025):
分享另一種改法,會比強制使用
forward_windows快 1.5~2.0 倍github.com/kvcache-ai/ktransformers@89f8218a2a/ktransformers/operators/attention.py (L274-L279)github.com/kvcache-ai/ktransformers@89f8218a2a/ktransformers/operators/attention.py (L320-L326)@chaucerling commented on GitHub (Feb 19, 2025):
按 https://github.com/kvcache-ai/ktransformers/issues/374#issuecomment-2667520838 的修改,有提升,不知道是不是带宽瓶颈了
@Dielianss commented on GitHub (Feb 21, 2025):
是的,V100+Cuda 11.8可以成功运行
@JimiZhou commented on GitHub (Feb 21, 2025):
使用8卡T4可以跑起来了,有一处报错需要额外修改:
报错信息:
triton.runtime.autotuner.0utofResources: out of resource: shared memory, Required: 89088, Hardware limit:65536. Reducing block sizes or'num stagesmay help.`解决方法:
在triton_attention.py内把num_stages改成1
@youde2000 commented on GitHub (Feb 22, 2025):
为什么我跑出来的结果都是be~~~~或者in [[ be~~~~这种?
@jcheunglin commented on GitHub (Feb 24, 2025):
4*t4的机器改完可以运行,q2kl版本,回答有模有样
@bones7456 commented on GitHub (Feb 26, 2025):
我这边4块V100,用这个办法解决了问题,跑起来了,谢谢🙏
@hubuwch commented on GitHub (Mar 20, 2025):
按照这个修改,我的T4的单卡16G显存就爆了~~
按照这个修改,我的单卡T4 16G显存就爆了~~
@jeffrey4l commented on GitHub (Mar 26, 2025):
@jcheunglin @JimiZhou how many T4 GPU memory used when running Q2? thanks.
@MaomaoMAo-17 commented on GitHub (Mar 31, 2025):
p5000出现同样的问题 爆显存 是我哪里没改对吗。。。
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 224.00 MiB. GPU 0 has a total capacity of 15.88 GiB of which 195.88 MiB is free. Including non-PyTorch memory, this process has 15.68 GiB memory in use. Of the allocated memory 15.53 GiB is allocated by PyTorch, and 37.10 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True已启用
@20000419 commented on GitHub (Apr 2, 2025):
应该不是没改对,是因为Volta和Turing架构不支持marlin算子,这会导致实际需求的显存翻倍,我是双卡2080ti各占用17个g才跑起来,T4的话最好是四卡。。。
@morphishk commented on GitHub (Apr 6, 2025):
我使用两张2080ti,128G内存跑1.58bit的R1,能跑但是内存没有任何占用,128G内存是空的只能跑0.44token,加到160可以跑3.5token,但是内存还是没有任何占用,问问大佬知道这事什么情况嘛?
@MaomaoMAo-17 commented on GitHub (Apr 8, 2025):
是的 已经换卡了
@jercylew commented on GitHub (Nov 9, 2025):
我这里也是V100 x 16, 试了两天没跑起来,请问你装的是哪个版本的CUDA和哪个版本的PyTorch?