Update README.md
Browse files
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,
|