Update README.md
Browse files
README.md
CHANGED
@@ -1,9 +1,23 @@
|
|
1 |
---
|
2 |
library_name: peft
|
3 |
---
|
4 |
-
##
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
### Framework versions
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
- PEFT 0.5.0
|
|
|
1 |
---
|
2 |
library_name: peft
|
3 |
---
|
4 |
+
## Inference
|
5 |
+
``` python
|
6 |
+
from datasets import load_dataset
|
7 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
8 |
+
from peft import PeftModel
|
9 |
|
|
|
10 |
|
11 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
12 |
+
'meta-llama/Llama-2-7b-chat-hf',
|
13 |
+
trust_remote_code=True,
|
14 |
+
device_map="auto",
|
15 |
+
torch_dtype=torch.float16, # optional if you have enough VRAM
|
16 |
+
)
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained('FinGPT/fingpt-forecaster_dow30_llama2-7b_lora')
|
18 |
+
|
19 |
+
model = PeftModel.from_pretrained('FinGPT/fingpt-forecaster_dow30_llama2-7b_lora')
|
20 |
+
model = model.eval()
|
21 |
+
```
|
22 |
|
23 |
- PEFT 0.5.0
|