Commit
·
aa0bebf
1
Parent(s):
9de1d53
Update README.md
Browse files
README.md
CHANGED
|
@@ -18,6 +18,30 @@ Opt-6.7B-lora-caramelo is further pre-train [Facebook's OPT-6.78](https://huggin
|
|
| 18 |
This model is intended to be used with fine-tuning, supervision, and/or moderation.
|
| 19 |
I recommend having a human curate or filter the outputs.
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
### License
|
| 22 |
|
| 23 |
The model is licensed under the OPT-6.75B license, Copyright (c) Meta Platforms, Inc. All Rights Reserved.
|
|
|
|
| 18 |
This model is intended to be used with fine-tuning, supervision, and/or moderation.
|
| 19 |
I recommend having a human curate or filter the outputs.
|
| 20 |
|
| 21 |
+
|
| 22 |
+
### How to use
|
| 23 |
+
|
| 24 |
+
```py
|
| 25 |
+
import torch
|
| 26 |
+
from peft import PeftModel, PeftConfig
|
| 27 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 28 |
+
|
| 29 |
+
peft_model_id = "arthurangelici/opt-6.7b-lora-caramelo"
|
| 30 |
+
config = PeftConfig.from_pretrained(peft_model_id)
|
| 31 |
+
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
|
| 32 |
+
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
| 33 |
+
|
| 34 |
+
# Load the Lora model
|
| 35 |
+
model = PeftModel.from_pretrained(model, peft_model_id)
|
| 36 |
+
|
| 37 |
+
batch = tokenizer("Caramelo é um simbolo do: ", return_tensors='pt')
|
| 38 |
+
|
| 39 |
+
with torch.cuda.amp.autocast():
|
| 40 |
+
output_tokens = model.generate(**batch, max_new_tokens=50)
|
| 41 |
+
|
| 42 |
+
print('\n\n', tokenizer.decode(output_tokens[0], skip_special_tokens=True))
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
### License
|
| 46 |
|
| 47 |
The model is licensed under the OPT-6.75B license, Copyright (c) Meta Platforms, Inc. All Rights Reserved.
|