FredrikBL commited on
Commit
8a03436
·
verified ·
1 Parent(s): 36fdbf4

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +34 -0
README.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ {}
3
+ ---
4
+
5
+ # SwedishBeagle-dareDPO
6
+
7
+ SwedishBeagle-dareDPO
8
+
9
+ Swedish DPO fine tune of SwedishBeagle-dare on the dataset neph1/truthy-dpo-v0.1-swe
10
+
11
+ ## 💻 Usage
12
+
13
+ ```python
14
+ !pip install -qU transformers accelerate
15
+
16
+ from transformers import AutoTokenizer
17
+ import transformers
18
+ import torch
19
+
20
+ model = "FredrikBL/SwedishBeagle-dareDPO"
21
+ messages = [{"role": "user", "content": "What is a large language model?"}]
22
+
23
+ tokenizer = AutoTokenizer.from_pretrained(model)
24
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
25
+ pipeline = transformers.pipeline(
26
+ "text-generation",
27
+ model=model,
28
+ torch_dtype=torch.float16,
29
+ device_map="auto",
30
+ )
31
+
32
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
33
+ print(outputs[0]["generated_text"])
34
+ ```