asiansoul commited on
Commit
1420cb4
β€’
1 Parent(s): b0bc822

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -0
README.md CHANGED
@@ -18,6 +18,52 @@ pipeline_tag: text-generation
18
 
19
  There is no such thing as a flawless system. It's about using it appropriately and reasonably without pushing it to its limits.
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  ```
23
  @article{Llama3.2KoEnMerged3BInstruct,
 
18
 
19
  There is no such thing as a flawless system. It's about using it appropriately and reasonably without pushing it to its limits.
20
 
21
+ ```
22
+ import torch
23
+ from transformers import AutoTokenizer, AutoModelForCausalLM
24
+
25
+ model_id = 'asiansoul/llama-3.2-koen-merged-3b-instruct'
26
+
27
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
28
+ model = AutoModelForCausalLM.from_pretrained(
29
+ model_id,
30
+ torch_dtype=torch.bfloat16,
31
+ device_map="auto",
32
+ )
33
+ instruction = "μ² μˆ˜κ°€ 20개의 연필을 가지고 μžˆμ—ˆλŠ”λ° μ˜ν¬κ°€ μ ˆλ°˜μ„ κ°€μ Έκ°€κ³  λ―Όμˆ˜κ°€ 남은 5개λ₯Ό κ°€μ Έκ°”μœΌλ©΄ μ² μˆ˜μ—κ²Œ 남은 μ—°ν•„μ˜ κ°―μˆ˜λŠ” λͺ‡κ°œμΈκ°€μš”?"
34
+
35
+ messages = [
36
+ {"role": "user", "content": f"{instruction}"}
37
+ ]
38
+
39
+ input_ids = tokenizer.apply_chat_template(
40
+ messages,
41
+ add_generation_prompt=True,
42
+ return_tensors="pt"
43
+ ).to(model.device)
44
+
45
+ terminators = [
46
+ tokenizer.convert_tokens_to_ids("<|end_of_text|>"),
47
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
48
+ ]
49
+
50
+ outputs = model.generate(
51
+ input_ids,
52
+ max_new_tokens=1024,
53
+ eos_token_id=terminators,
54
+ do_sample=True,
55
+ temperature=0.6,
56
+ top_p=0.9
57
+ )
58
+
59
+
60
+
61
+ μ² μˆ˜κ°€ 20개의 연필을 가지고 μžˆμ—ˆκ³ , μ˜ν¬κ°€ 절반(20/2 = 10)을 κ°€μ Έκ°”μŠ΅λ‹ˆλ‹€. λ”°λΌμ„œ μ² μˆ˜κ°€ 남은 μ—°ν•„μ˜ κ°―μˆ˜λŠ” 20 - 10 = 10μž…λ‹ˆλ‹€.
62
+
63
+ λ―Όμˆ˜κ°€ 남은 5개λ₯Ό κ°€μ Έκ°”μœΌλ‹ˆ, μ² μˆ˜κ°€ 남은 μ—°ν•„μ˜ κ°―μˆ˜λŠ” 10 - 5 = 5μž…λ‹ˆλ‹€.
64
+
65
+ λ”°λΌμ„œ μ² μˆ˜κ°€ 남은 μ—°ν•„μ˜ κ°―μˆ˜λŠ” 5κ°œμž…λ‹ˆλ‹€.
66
+ ```
67
 
68
  ```
69
  @article{Llama3.2KoEnMerged3BInstruct,