nroggendorff
commited on
Commit
•
a94c217
1
Parent(s):
c979c0c
Update README.md
Browse files
README.md
CHANGED
@@ -39,33 +39,6 @@ response = pipe(conv, max_new_tokens=32)[0]['generated_text'][-1]['content']
|
|
39 |
print(response)
|
40 |
```
|
41 |
|
42 |
-
To use the model with quantization:
|
43 |
-
|
44 |
-
```python
|
45 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
46 |
-
import torch
|
47 |
-
|
48 |
-
bnb_config = BitsAndBytesConfig(
|
49 |
-
load_in_4bit=True,
|
50 |
-
bnb_4bit_use_double_quant=True,
|
51 |
-
bnb_4bit_quant_type="nf4",
|
52 |
-
bnb_4bit_compute_dtype=torch.bfloat16
|
53 |
-
)
|
54 |
-
|
55 |
-
model_id = "nroggendorff/vegetarian-mayo"
|
56 |
-
|
57 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
58 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config)
|
59 |
-
|
60 |
-
prompt = "[INST] What color is the sky? [/INST]"
|
61 |
-
inputs = tokenizer(prompt, return_tensors="pt")
|
62 |
-
|
63 |
-
outputs = model.generate(**inputs, max_new_tokens=32)
|
64 |
-
|
65 |
-
generated_text = tokenizer.batch_decode(outputs)[0]
|
66 |
-
print(generated_text)
|
67 |
-
```
|
68 |
-
|
69 |
## License
|
70 |
|
71 |
This project is licensed under the MIT License.
|
|
|
39 |
print(response)
|
40 |
```
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
## License
|
43 |
|
44 |
This project is licensed under the MIT License.
|