Update usage
Browse files
README.md
CHANGED
@@ -60,12 +60,14 @@ Quantization parameters are controlled from the `BitsandbytesConfig`
|
|
60 |
quantization datatypes `fp4` (four bit float) and `nf4` (normal four bit float). The latter is theoretically optimal
|
61 |
for normally distributed weights and we recommend using `nf4`.
|
62 |
|
|
|
63 |
```python
|
64 |
import torch
|
65 |
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
66 |
|
|
|
67 |
model = AutoModelForCausalLM.from_pretrained(
|
68 |
-
pretrained_model_name_or_path=
|
69 |
load_in_4bit=True,
|
70 |
device_map='auto',
|
71 |
torch_dtype=torch.bfloat16,
|
@@ -77,7 +79,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
77 |
),
|
78 |
)
|
79 |
|
80 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
81 |
|
82 |
question = "What is the market cap of apple?"
|
83 |
input = "" # context if needed
|
@@ -95,6 +97,7 @@ with torch.no_grad():
|
|
95 |
do_sample=True,
|
96 |
top_p=0.9,
|
97 |
temperature=0.8,
|
|
|
98 |
)
|
99 |
|
100 |
generated_text = tokenizer.decode(
|
@@ -102,6 +105,7 @@ generated_text = tokenizer.decode(
|
|
102 |
)
|
103 |
```
|
104 |
|
|
|
105 |
## Dataset for FIN-LLAMA
|
106 |
|
107 |
The dataset is released under bigscience-openrail-m.
|
|
|
60 |
quantization datatypes `fp4` (four bit float) and `nf4` (normal four bit float). The latter is theoretically optimal
|
61 |
for normally distributed weights and we recommend using `nf4`.
|
62 |
|
63 |
+
|
64 |
```python
|
65 |
import torch
|
66 |
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
67 |
|
68 |
+
pretrained_model_name_or_path = "bavest/fin-llama-33b-merge"
|
69 |
model = AutoModelForCausalLM.from_pretrained(
|
70 |
+
pretrained_model_name_or_path=pretrained_model_name_or_path,
|
71 |
load_in_4bit=True,
|
72 |
device_map='auto',
|
73 |
torch_dtype=torch.bfloat16,
|
|
|
79 |
),
|
80 |
)
|
81 |
|
82 |
+
tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path)
|
83 |
|
84 |
question = "What is the market cap of apple?"
|
85 |
input = "" # context if needed
|
|
|
97 |
do_sample=True,
|
98 |
top_p=0.9,
|
99 |
temperature=0.8,
|
100 |
+
max_length=128
|
101 |
)
|
102 |
|
103 |
generated_text = tokenizer.decode(
|
|
|
105 |
)
|
106 |
```
|
107 |
|
108 |
+
|
109 |
## Dataset for FIN-LLAMA
|
110 |
|
111 |
The dataset is released under bigscience-openrail-m.
|