Update README.md
Browse files
README.md
CHANGED
|
@@ -43,6 +43,7 @@ Below shows a code example on how to use this model in default(bf16) format
|
|
| 43 |
|
| 44 |
```python
|
| 45 |
from transformers import AutoModel, AutoTokenizer
|
|
|
|
| 46 |
model_slug = "pankajmathur/orca_mini_v8_0_70b"
|
| 47 |
model = AutoModel.from_pretrained(model_slug)
|
| 48 |
tokenizer = AutoTokenizer.from_pretrained(model_slug)
|
|
@@ -54,14 +55,16 @@ gen_input = tokenizer.apply_chat_template(messages, return_tensors="pt")
|
|
| 54 |
model.generate(**gen_input)
|
| 55 |
```
|
| 56 |
|
| 57 |
-
Below shows a code example on how to use this model in
|
| 58 |
|
| 59 |
```python
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
model_slug = "pankajmathur/orca_mini_v8_0_70b"
|
| 62 |
-
quantization_config = BitsAndBytesConfig(
|
| 63 |
quantized_model = AutoModelForCausalLM.from_pretrained(
|
| 64 |
-
|
| 65 |
tokenizer = AutoTokenizer.from_pretrained(model_slug)
|
| 66 |
messages = [
|
| 67 |
{"role": "system", "content": "You are Orca Mini, a helpful AI assistant."},
|
|
|
|
| 43 |
|
| 44 |
```python
|
| 45 |
from transformers import AutoModel, AutoTokenizer
|
| 46 |
+
|
| 47 |
model_slug = "pankajmathur/orca_mini_v8_0_70b"
|
| 48 |
model = AutoModel.from_pretrained(model_slug)
|
| 49 |
tokenizer = AutoTokenizer.from_pretrained(model_slug)
|
|
|
|
| 55 |
model.generate(**gen_input)
|
| 56 |
```
|
| 57 |
|
| 58 |
+
Below shows a code example on how to use this model in 8-bit format via bitsandbytes library
|
| 59 |
|
| 60 |
```python
|
| 61 |
+
import torch
|
| 62 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 63 |
+
|
| 64 |
model_slug = "pankajmathur/orca_mini_v8_0_70b"
|
| 65 |
+
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
| 66 |
quantized_model = AutoModelForCausalLM.from_pretrained(
|
| 67 |
+
model_slug, device_map="auto", torch_dtype=torch.bfloat16, quantization_config=quantization_config)
|
| 68 |
tokenizer = AutoTokenizer.from_pretrained(model_slug)
|
| 69 |
messages = [
|
| 70 |
{"role": "system", "content": "You are Orca Mini, a helpful AI assistant."},
|