File size: 910 Bytes
1306c46
 
 
 
 
 
 
8bb5a2d
 
1306c46
 
d13cdbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
license: apache-2.0
language:
- fr
- en
tags:
- code
widget:
- text: "<s> [|User|] Comment faire un bon plat ? </s>[|Assistant|]"
---
SFT on a synthetic custom (french) dataset (2k), from general question answering, problem solving to code question.
It's a POC.


```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch

model = AutoModelForCausalLM.from_pretrained(
    "teilomillet/MiniMerlin-3B",
    revision="0.1",
    return_dict=True,
    torch_dtype=torch.bfloat16,
    device_map='auto'
)

tokenizer = AutoTokenizer.from_pretrained("teilomillet/MiniMerlin-3B")
tokenizer.pad_token = tokenizer.eos_token

text = "[|User|] Comment faire un bon plat ? </s>[|Assistant|]"
inputs = tokenizer(text, return_tensors="pt").to(0)

outputs = model.generate(**inputs, max_new_tokens=800)
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
```