File size: 1,636 Bytes
c13093c
 
 
 
 
 
 
 
 
63bcbad
 
 
 
 
 
eb8f072
63bcbad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
base_model: GeneZC/MiniChat-2-3B
inference: True
model_type: Llama
---
#  MiniChat-2-3B
This repo contains pruned model files for [MiniChat-2-3B](https://huggingface.co/GeneZC/MiniChat-2-3B).

This model was pruned with [SparseGPT](https://arxiv.org/abs/2301.00774), using [SparseML](https://github.com/neuralmagic/sparseml).
```python

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
prompt = "How to make banana bread?"
formatted_prompt =  f"<s> [|User|]\n{prompt}</s>[|Assistant|]\n"
model_id = "nm-testing/MiniChat-2-3B-pruned50-24"
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.float16)
tokenizer = AutoTokenizer.from_pretrained(model_id)
inputs = tokenizer(formatted_prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.batch_decode(outputs)[0])

"""
<s><s> [|User|]
How to make banana bread?</s>[|Assistant|]
To make banana bread, follow these steps:

1. Start by preparing the ingredients. You will need banana bread mix, flour, water, and salt.
2. Mix the ingredients together and mix the mixture thoroughly.
3. Pour the mixture into a pan to cook.
4. Cook the mixture until it is cooked.
5. Once the bread is cooked, you can use it as a base for making banana bread.
6. Add the banana bread mix to the pan and mix it thoroughly.
7. Pour the mixture into a pan to cook.
8. Cook the mixture until it is cooked.
9. Once the bread is cooked, you can use it as a base for making banana bread.
10. Add the banana bread mix to the pan and mix it thoroughly.
11. Pour the mixture into a pan to cook.
12.
"""
```