|
--- |
|
base_model: |
|
- TechxGenus/starcoder2-3b-instruct |
|
tags: |
|
- merge |
|
- mergekit |
|
- lazymergekit |
|
- TechxGenus/starcoder2-3b-instruct |
|
--- |
|
|
|
# tinyllama-merged-3 |
|
|
|
tinyllama-merged-3 is a merge of the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing): |
|
* [TechxGenus/starcoder2-3b-instruct](https://huggingface.co./TechxGenus/starcoder2-3b-instruct) |
|
|
|
## 🧩 Configuration |
|
|
|
```yaml |
|
models: |
|
- model: bigcode/starcoder2-3b |
|
# no parameters necessary for base model |
|
- model: TechxGenus/starcoder2-3b-instruct # follow user intent |
|
parameters: |
|
density: |
|
- filter: mlp.down_proj.4 # specifically targets the 5th layer |
|
value: 0 # assign value of 0 for the 5th layer of down_proj |
|
- value: 1 |
|
weight: |
|
- filter: mlp.down_proj |
|
value: [0.3, 0.25, 0.25, 0.15, 0.1] |
|
- filter: mlp.gate_proj |
|
value: [0.7, 0.25, 0.5, 0.45, 0.4] |
|
- filter: mlp.up_proj |
|
value: [0.7, 0.25, 0.5, 0.45, 0.4] |
|
- filter: self_attn |
|
value: [0.7, 0.25, 0.5, 0.45, 0.4] |
|
- value: 1 # fallback for rest of tensors. |
|
tokenizer_source: union |
|
merge_method: dare_ties |
|
base_model: bigcode/starcoder2-3b |
|
parameters: |
|
normalize: true |
|
int8_mask: true |
|
dtype: bfloat16 |
|
``` |
|
|
|
## 💻 Usage |
|
|
|
```python |
|
!pip install -qU transformers accelerate |
|
|
|
from transformers import AutoTokenizer |
|
import transformers |
|
import torch |
|
|
|
model = "choprahetarth/tinyllama-merged-3" |
|
messages = [{"role": "user", "content": "What is a large language model?"}] |
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model) |
|
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) |
|
pipeline = transformers.pipeline( |
|
"text-generation", |
|
model=model, |
|
torch_dtype=torch.float16, |
|
device_map="auto", |
|
) |
|
|
|
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95) |
|
print(outputs[0]["generated_text"]) |
|
``` |