Update README.md
Browse files
README.md
CHANGED
@@ -30,7 +30,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
30 |
)
|
31 |
```
|
32 |
|
33 |
-
To run this model, you may need to load it in a lower precision in order for it to fit onto your GPU. We found for a T4 GPU, it requires loading the model in 8-bit precision. To load the model in 8-bit, please install the following pip packages:
|
34 |
|
35 |
```bash
|
36 |
pip install bitsandbytes accelerate
|
@@ -55,6 +55,23 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
55 |
)
|
56 |
```
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
</details>
|
59 |
|
60 |
|
|
|
30 |
)
|
31 |
```
|
32 |
|
33 |
+
To run this model, you may need to load it in a lower precision in order for it to fit onto your GPU. We found for a T4 GPU, it requires loading the model in 8-bit precision. To load the model in 8-bit and 4-bit, please install the following pip packages:
|
34 |
|
35 |
```bash
|
36 |
pip install bitsandbytes accelerate
|
|
|
55 |
)
|
56 |
```
|
57 |
|
58 |
+
</details><details>
|
59 |
+
<summary><b>Code to load the model in 4 bit</b></summary>
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
```python
|
64 |
+
from transformers import AutoModelForCausalLM
|
65 |
+
|
66 |
+
model_name = "lightblue/japanese-mpt-7b"
|
67 |
+
model = AutoModelForCausalLM.from_pretrained(
|
68 |
+
model_name,
|
69 |
+
torch_dtype='auto',
|
70 |
+
load_in_4bit=True,
|
71 |
+
trust_remote_code=True
|
72 |
+
)
|
73 |
+
```
|
74 |
+
|
75 |
</details>
|
76 |
|
77 |
|