Chryslerx10
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -57,4 +57,24 @@ Libraries Used:
|
|
57 |
<li>Transformers</li>
|
58 |
<li>PEFT</li>
|
59 |
<li>TRL</li>
|
60 |
-
<li>BitsAndBytes</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
<li>Transformers</li>
|
58 |
<li>PEFT</li>
|
59 |
<li>TRL</li>
|
60 |
+
<li>BitsAndBytes</li>
|
61 |
+
|
62 |
+
|
63 |
+
## How to Use
|
64 |
+
|
65 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
66 |
+
from peft import PeftModel, PeftConfig
|
67 |
+
|
68 |
+
peft_model_id = "Chryslerx10/Llama-3.2-1B-finetuned-generalQA-peft-4bit"
|
69 |
+
config = PeftConfig.from_pretrained(peft_model_id, device_map='auto')
|
70 |
+
|
71 |
+
model = AutoModelForCausalLM.from_pretrained(
|
72 |
+
config.base_model_name_or_path,
|
73 |
+
device_map='auto',
|
74 |
+
return_dict=True
|
75 |
+
)
|
76 |
+
|
77 |
+
tokenizer = AutoTokenizer.from_pretrained(peft_model_id)
|
78 |
+
tokenizer.pad_token = tokenizer.eos_token
|
79 |
+
|
80 |
+
peft_loaded_model = PeftModel.from_pretrained(model, peft_model_id, device_map='auto')
|