Skip to content

Commit 6a1182c

Browse files
committed
update readme
1 parent cade567 commit 6a1182c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
11
# SnapKV
2+
## Quick Start
3+
### Use SnapKV-optimized Models
4+
SnapKV-optimized models are all under models file, which could be directly imported and used the same like baseline models.
5+
For example:
6+
```python
7+
from models.modeling_mistral import MistralForCausalLM as SnapKVMistralForCausalLM
8+
model = SnapKVMistralForCausalLM.from_pretrained(
9+
model_name,
10+
torch_dtype=torch.float16,
11+
low_cpu_mem_usage=True,
12+
device_map="auto",
13+
use_flash_attention_2=True
14+
)
15+
tokenizer = transformers.AutoTokenizer.from_pretrained(
16+
model_name,
17+
padding_side="right",
18+
use_fast=False,
19+
)
20+
```
21+
22+
### Customize Your SnapKV-optimized Models
23+
SnapKV can be easily integrate with other models. You can follow the comment marked with `[SnapKV]` in [existing models](./models) to constrcut your own models. The algorithm of SnapKV is in [snapkv_utils.py](./snapkv_utils.py)

0 commit comments

Comments
 (0)