uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
TinyLlama-NoPE-1.1B - AWQ
|
11 |
+
- Model creator: https://huggingface.co/AntNLP/
|
12 |
+
- Original model: https://huggingface.co/AntNLP/TinyLlama-NoPE-1.1B/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
license: mit
|
20 |
+
---
|
21 |
+
|
22 |
+
# TinyLlama-NoPE-1.1B
|
23 |
+
|
24 |
+
NoPE is a transformer model without positional encoding.
|
25 |
+
|
26 |
+
The model is trained following TinyLlama code base (https://github.com/jzhang38/TinyLlama)
|
27 |
+
|
28 |
+
## Usage
|
29 |
+
|
30 |
+
```python
|
31 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
32 |
+
from transformers.models.llama import modeling_llama
|
33 |
+
|
34 |
+
|
35 |
+
def nope_monkey_patch(q, k, cos, sin, position_ids, unsqueeze_dim=1):
|
36 |
+
return q, k
|
37 |
+
|
38 |
+
|
39 |
+
modeling_llama.apply_rotary_pos_emb = nope_monkey_patch
|
40 |
+
|
41 |
+
model_path = "AntNLP/TinyLlama-NoPE-1.1B"
|
42 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
43 |
+
model = AutoModelForCausalLM.from_pretrained(model_path).cuda()
|
44 |
+
|
45 |
+
input_ids = tokenizer("Hello, TinyLlama-NoPE", return_tensors="pt").input_ids.cuda()
|
46 |
+
output = model.generate(input_ids, do_sample=True, max_length=50)
|
47 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
48 |
+
```
|
49 |
+
|
50 |
+
## Citation
|
51 |
+
|
52 |
+
```
|
53 |
+
@misc{wang2024length,
|
54 |
+
title={Length Generalization of Causal Transformers without Position Encoding},
|
55 |
+
author={Jie Wang and Tao Ji and Yuanbin Wu and Hang Yan and Tao Gui and Qi Zhang and Xuanjing Huang and Xiaoling Wang},
|
56 |
+
year={2024},
|
57 |
+
eprint={2404.12224},
|
58 |
+
archivePrefix={arXiv},
|
59 |
+
primaryClass={cs.CL}
|
60 |
+
}
|
61 |
+
```
|
62 |
+
|