Pedram Rostami
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -47,17 +47,17 @@ Use the code below to get started with the model.
|
|
47 |
Note that you need to install <code><b>sentencepiece</b></code> and <code><b>accelerate</b></code> libraries along with <code><b>PyTorch</b></code> and <code><b>🤗Transformers</b></code> to run this code.
|
48 |
|
49 |
```python
|
50 |
-
from transformers import
|
51 |
import torch
|
52 |
|
53 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
54 |
-
model =
|
55 |
"universitytehran/PersianMind-v1.0",
|
56 |
torch_dtype=torch.bfloat16,
|
57 |
low_cpu_mem_usage=True,
|
58 |
device_map={"": device},
|
59 |
)
|
60 |
-
tokenizer =
|
61 |
"universitytehran/PersianMind-v1.0",
|
62 |
)
|
63 |
|
@@ -84,7 +84,7 @@ To quantize the model, you should install the <code><b>bitsandbytes</b></code> l
|
|
84 |
In order to quantize the model in 8-bit (`INT8`), use the code below.
|
85 |
|
86 |
```python
|
87 |
-
model =
|
88 |
"universitytehran/PersianMind-v1.0",
|
89 |
device_map="auto",
|
90 |
low_cpu_mem_usage=True,
|
@@ -102,7 +102,7 @@ quantization_config = BitsAndBytesConfig(
|
|
102 |
bnb_4bit_use_double_quant=True,
|
103 |
bnb_4bit_quant_type="nf4",
|
104 |
)
|
105 |
-
model =
|
106 |
"universitytehran/PersianMind-v1.0",
|
107 |
quantization_config=quantization_config,
|
108 |
device_map="auto"
|
|
|
47 |
Note that you need to install <code><b>sentencepiece</b></code> and <code><b>accelerate</b></code> libraries along with <code><b>PyTorch</b></code> and <code><b>🤗Transformers</b></code> to run this code.
|
48 |
|
49 |
```python
|
50 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
51 |
import torch
|
52 |
|
53 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
54 |
+
model = AutoModelForCausalLM.from_pretrained(
|
55 |
"universitytehran/PersianMind-v1.0",
|
56 |
torch_dtype=torch.bfloat16,
|
57 |
low_cpu_mem_usage=True,
|
58 |
device_map={"": device},
|
59 |
)
|
60 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
61 |
"universitytehran/PersianMind-v1.0",
|
62 |
)
|
63 |
|
|
|
84 |
In order to quantize the model in 8-bit (`INT8`), use the code below.
|
85 |
|
86 |
```python
|
87 |
+
model = AutoModelForCausalLM.from_pretrained(
|
88 |
"universitytehran/PersianMind-v1.0",
|
89 |
device_map="auto",
|
90 |
low_cpu_mem_usage=True,
|
|
|
102 |
bnb_4bit_use_double_quant=True,
|
103 |
bnb_4bit_quant_type="nf4",
|
104 |
)
|
105 |
+
model = AutoModelForCausalLM.from_pretrained(
|
106 |
"universitytehran/PersianMind-v1.0",
|
107 |
quantization_config=quantization_config,
|
108 |
device_map="auto"
|