hyunjae commited on
Commit
658a043
β€’
1 Parent(s): bcacb21

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md CHANGED
@@ -9,3 +9,29 @@ pipeline_tag: text-generation
9
  - base_model: polyglot-ko-3.8b1
10
  - train_data: 12 instruction fine-tuned dataset
11
  - train method: SFT
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  - base_model: polyglot-ko-3.8b1
10
  - train_data: 12 instruction fine-tuned dataset
11
  - train method: SFT
12
+
13
+
14
+ ```python
15
+ from transformers import AutoModelForCausalLM, AutoTokenizer
16
+
17
+ device = "cuda" # the device to load the model onto
18
+
19
+ model = AutoModelForCausalLM.from_pretrained("hyunjae/polyglot-ko-3.8b-total")
20
+ tokenizer = AutoTokenizer.from_pretrained("hyunjae/polyglot-ko-3.8b-total")
21
+
22
+ messages = [
23
+ {"role": "system", "content": "당신은 μ‚¬λžŒλ“€μ΄ 정보λ₯Ό 찾을 수 μžˆλ„λ‘ λ„μ™€μ£ΌλŠ” 인곡지λŠ₯ λΉ„μ„œμž…λ‹ˆλ‹€."},
24
+ {"role": "user", "content": "λŒ€ν•œλ―Όκ΅­μ˜ μˆ˜λ„λŠ” μ–΄λ””μ•Ό?"},
25
+ {"role": "assistant", "content": "λŒ€ν•œλ―Όκ΅­μ˜ μˆ˜λ„λŠ” μ„œμšΈμž…λ‹ˆλ‹€."},
26
+ {"role": "user", "content": "μ„œμšΈ μΈκ΅¬λŠ” 총 λͺ‡ λͺ…이야?"}
27
+ ]
28
+
29
+ encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
30
+
31
+ model_inputs = encodeds.to(device)
32
+ model.to(device)
33
+
34
+ generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
35
+ decoded = tokenizer.batch_decode(generated_ids)
36
+ print(decoded[0])
37
+ ```