mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2025-09-14 00:59:42 +00:00
optimize GPU
This commit is contained in:
parent
cf4da5fd47
commit
7e1fe256c8
8 changed files with 677 additions and 156 deletions
|
@ -5,6 +5,18 @@
|
|||
kwargs:
|
||||
generate_device: "cuda"
|
||||
prefill_device: "cuda"
|
||||
|
||||
- match:
|
||||
name: "^lm_head$" # regular expression
|
||||
class: torch.nn.Linear # only match modules matching name and class simultaneously
|
||||
replace:
|
||||
class: ktransformers.operators.linear.KTransformersLinear # optimized Kernel on quantized data types
|
||||
kwargs:
|
||||
generate_device: "cuda"
|
||||
prefill_device: "cuda"
|
||||
generate_op: "KLinearMarlin"
|
||||
prefill_op: "KLinearTorch"
|
||||
|
||||
- match:
|
||||
name: "^model\\.layers\\.(?!.*self_attn\\.kv_b_proj).*$" # regular expression
|
||||
class: torch.nn.Linear # only match modules matching name and class simultaneously
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue