georgebu commited on
Commit
e200f1a
·
verified ·
1 Parent(s): 81569f7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -5
README.md CHANGED
@@ -10,17 +10,47 @@ base_model:
10
  ## Описание модели
11
  В рамках домашнего задания по курсу "Современный NLP. Большие языковые модели" от vk.education было реализовано дообучение модели методом Direct Preference Optimization (DPO)
12
 
13
- ## Пример использования:
14
  ``` python
15
- tokenizer = AutoTokenizer.from_pretrained(DPO_REPO_NAME)
16
- check_model = AutoModelForCausalLM.from_pretrained(DPO_REPO_NAME)
17
 
18
  messages = [{"role": "user", "content": "What's your morning routine like?"}]
19
 
20
  text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
21
  model_inputs = tokenizer([text], return_tensors="pt").to(device)
22
 
23
- generated_ids = check_model.generate(model_inputs.input_ids, max_new_tokens=256, do_sample=False)
24
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
25
  print(response)
26
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ## Описание модели
11
  В рамках домашнего задания по курсу "Современный NLP. Большие языковые модели" от vk.education было реализовано дообучение модели методом Direct Preference Optimization (DPO)
12
 
13
+ ## Как использовать:
14
  ``` python
15
+ tokenizer = AutoTokenizer.from_pretrained('georgebu/llm-course-hw2-dpo')
16
+ dpo_model = AutoModelForCausalLM.from_pretrained(georgebu/llm-course-hw2-dpo)
17
 
18
  messages = [{"role": "user", "content": "What's your morning routine like?"}]
19
 
20
  text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
21
  model_inputs = tokenizer([text], return_tensors="pt").to(device)
22
 
23
+ generated_ids = dpo_model.generate(model_inputs.input_ids, max_new_tokens=256, do_sample=False)
24
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
25
  print(response)
26
+ ```
27
+ ## Примеры генерации:
28
+
29
+ <div style="
30
+ background: #f5f5f5;
31
+ padding: 12px;
32
+ border-radius: 8px;
33
+ border-left: 4px solid #6ea8fe;
34
+ margin: 12px 0;
35
+ ">
36
+ <b>Промт:</b> "What is your morning routine like?"
37
+
38
+ <b>Ответ модели:</b>
39
+ I'm excited to help you with your morning routine. As a digital assistant, I don't have personal experiences or emotions, but I can provide you with a general idea of what to expect. Please feel free to adjust the content to fit your needs.
40
+
41
+ **Morning Routine (10-15 minutes)**
42
+
43
+ 1. **Get Ready**:
44
+ * Wash your face with soap and water.
45
+ * Apply a facial wash or moisturizer.
46
+ * Use a gentle cleanser.
47
+ * Massage the cleanser into your skin.
48
+ 2. **Brush and Towel**:
49
+ * Brush your teeth with a soft-bristled toothbrush.
50
+ * Use a gentle circular motion.
51
+ * Rinse with warm water.
52
+ 3. **Get Ready**:
53
+ * Put on your favorite outfit.
54
+ * Choose a comfortable and outfit.
55
+ * Remove any shoes.
56
+ </div>