Update README.md
Browse files
README.md
CHANGED
@@ -6,17 +6,50 @@ tags:
|
|
6 |
- peft
|
7 |
library_name: transformers
|
8 |
widget:
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
license: other
|
|
|
|
|
|
|
|
|
13 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Model Trained Using AutoTrain
|
16 |
|
17 |
This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
|
18 |
|
19 |
-
# Usage
|
20 |
|
21 |
```python
|
22 |
|
|
|
6 |
- peft
|
7 |
library_name: transformers
|
8 |
widget:
|
9 |
+
- messages:
|
10 |
+
- role: user
|
11 |
+
content: What is your favorite condiment?
|
12 |
license: other
|
13 |
+
datasets:
|
14 |
+
- timdettmers/openassistant-guanaco
|
15 |
+
language:
|
16 |
+
- en
|
17 |
---
|
18 |
+
# Model Details
|
19 |
+
|
20 |
+
This model is a finetuned Meta-Llama-3-8b-Instruct model on the openassistant dataset. It was finetuned using PEFT, a library for efficiently adapting pre-trained language models to various downstream applications without fine-tuning all the model’s parameters.
|
21 |
+
|
22 |
+
# Inference with PEFT Models:
|
23 |
+
|
24 |
+
```python
|
25 |
+
|
26 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
27 |
+
from peft import PeftModel, PeftConfig
|
28 |
+
|
29 |
+
base_model = "meta-llama/Meta-Llama-3-8B"
|
30 |
+
adapter_model = "pantelnm/llama3-openassistant"
|
31 |
+
|
32 |
+
prompt = "Write your prompt here!"
|
33 |
+
|
34 |
+
model = AutoModelForCausalLM.from_pretrained(base_model)
|
35 |
+
model = PeftModel.from_pretrained(model, adapter_model)
|
36 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model)
|
37 |
+
|
38 |
+
model = model.to("cuda")
|
39 |
+
model.eval()
|
40 |
+
|
41 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
42 |
+
|
43 |
+
with torch.no_grad():
|
44 |
+
outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"), max_new_tokens=10)
|
45 |
+
print(tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0])
|
46 |
+
```
|
47 |
|
48 |
# Model Trained Using AutoTrain
|
49 |
|
50 |
This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
|
51 |
|
52 |
+
# General Usage
|
53 |
|
54 |
```python
|
55 |
|