Update README.md
Browse files
README.md
CHANGED
|
@@ -8,9 +8,9 @@ tags:
|
|
| 8 |
- udkai/Turdus
|
| 9 |
---
|
| 10 |
|
| 11 |
-
#
|
| 12 |
|
| 13 |
-
|
| 14 |
* [fblgit/UNA-TheBeagle-7b-v1](https://huggingface.co/fblgit/UNA-TheBeagle-7b-v1)
|
| 15 |
* [udkai/Turdus](https://huggingface.co/udkai/Turdus)
|
| 16 |
|
|
@@ -33,4 +33,44 @@ base_model: madatnlp/marcoroni-7b-v3-safetensor
|
|
| 33 |
parameters:
|
| 34 |
normalize: true
|
| 35 |
dtype: float16
|
| 36 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
- udkai/Turdus
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Marcoroni-7b-DPO-Merge
|
| 12 |
|
| 13 |
+
Marcoroni-7b-DPO-Merge is a merge of the following models using [mergekit](https://github.com/cg123/mergekit) and inspired by [Maxime Labonne's work](https://medium.com/@mlabonne):
|
| 14 |
* [fblgit/UNA-TheBeagle-7b-v1](https://huggingface.co/fblgit/UNA-TheBeagle-7b-v1)
|
| 15 |
* [udkai/Turdus](https://huggingface.co/udkai/Turdus)
|
| 16 |
|
|
|
|
| 33 |
parameters:
|
| 34 |
normalize: true
|
| 35 |
dtype: float16
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
## 💻 Example Python Code
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 42 |
+
|
| 43 |
+
model_name_or_path = "nfaheem/Marcoroni-7b-DPO-Merge"
|
| 44 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
| 45 |
+
device_map="auto",
|
| 46 |
+
revision="main")
|
| 47 |
+
|
| 48 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
| 49 |
+
|
| 50 |
+
prompt = "Write a story about llamas"
|
| 51 |
+
system_message = "You are a story writing assistant"
|
| 52 |
+
prompt_template=f'''{prompt}
|
| 53 |
+
'''
|
| 54 |
+
|
| 55 |
+
print("\n\n*** Generate:")
|
| 56 |
+
|
| 57 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
| 58 |
+
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
|
| 59 |
+
print(tokenizer.decode(output[0]))
|
| 60 |
+
|
| 61 |
+
# Inference can also be done using transformers' pipeline
|
| 62 |
+
|
| 63 |
+
print("*** Pipeline:")
|
| 64 |
+
pipe = pipeline(
|
| 65 |
+
"text-generation",
|
| 66 |
+
model=model,
|
| 67 |
+
tokenizer=tokenizer,
|
| 68 |
+
max_new_tokens=512,
|
| 69 |
+
do_sample=True,
|
| 70 |
+
temperature=0.7,
|
| 71 |
+
top_p=0.95,
|
| 72 |
+
top_k=40,
|
| 73 |
+
repetition_penalty=1.1
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
print(pipe(prompt_template)[0]['generated_text'])
|