Upload folder using huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model:
|
3 |
+
- TinyLlama/TinyLlama_v1.1
|
4 |
+
- TinyLlama/TinyLlama_v1.1
|
5 |
+
tags:
|
6 |
+
- merge
|
7 |
+
- mergekit
|
8 |
+
- lazymergekit
|
9 |
+
- TinyLlama/TinyLlama_v1.1
|
10 |
+
---
|
11 |
+
|
12 |
+
# experiment-19
|
13 |
+
|
14 |
+
experiment-19 is a merge of the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
15 |
+
* [TinyLlama/TinyLlama_v1.1](https://huggingface.co/TinyLlama/TinyLlama_v1.1)
|
16 |
+
* [TinyLlama/TinyLlama_v1.1](https://huggingface.co/TinyLlama/TinyLlama_v1.1)
|
17 |
+
|
18 |
+
## 🧩 Configuration
|
19 |
+
|
20 |
+
```yaml
|
21 |
+
slices:
|
22 |
+
- sources:
|
23 |
+
- layer_range: [0, 16]
|
24 |
+
model: TinyLlama/TinyLlama_v1.1
|
25 |
+
- sources:
|
26 |
+
- layer_range: [6, 22]
|
27 |
+
model: TinyLlama/TinyLlama_v1.1
|
28 |
+
merge_method: passthrough
|
29 |
+
dtype: bfloat16
|
30 |
+
```
|
31 |
+
|
32 |
+
## 💻 Usage
|
33 |
+
|
34 |
+
```python
|
35 |
+
!pip install -qU transformers accelerate
|
36 |
+
|
37 |
+
from transformers import AutoTokenizer
|
38 |
+
import transformers
|
39 |
+
import torch
|
40 |
+
|
41 |
+
model = "KingNish/experiment-19"
|
42 |
+
messages = [{"role": "user", "content": "What is a large language model?"}]
|
43 |
+
|
44 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
45 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
46 |
+
pipeline = transformers.pipeline(
|
47 |
+
"text-generation",
|
48 |
+
model=model,
|
49 |
+
torch_dtype=torch.float16,
|
50 |
+
device_map="auto",
|
51 |
+
)
|
52 |
+
|
53 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
54 |
+
print(outputs[0]["generated_text"])
|
55 |
+
```
|