Add How to use
Browse files
README.md
CHANGED
@@ -8,24 +8,60 @@ language:
|
|
8 |
# Korean Style Transfer
|
9 |
|
10 |
This model is a fine-tuned version of [Synatra-7B-v0.3-dpo](https://huggingface.co/maywell/Synatra-7B-v0.3-dpo) using a Korean style dataset provided by Smilegate AI (https://github.com/smilegate-ai/korean_smile_style_dataset/tree/main).
|
11 |
-
Since the original dataset is tabular and not fit for training the LLM, I have preprocessed it into instruction-input-output format, which can be found (
|
12 |
The dataset is then fed into the ChatML template. Feel free to use my version of the dataset as needed.
|
13 |
|
14 |
ν΄λΉ λͺ¨λΈμ [Synatra-7B-v0.3-dpo](https://huggingface.co/maywell/Synatra-7B-v0.3-dpo) λͺ¨λΈμ μ€λ§μΌκ²μ΄νΈ AIμμ μ 곡νλ Smile style λ°μ΄ν°μ
μΌλ‘ νμΈνλ νμ΅λλ€.
|
15 |
-
κΈ°μ‘΄ λ°μ΄ν°μ
μ ν
μ΄λΈ ννλ‘ λμ΄μμ΄ ν΄λΉ λ°μ΄ν°λ₯Ό instruction-input-output ννλ‘ λ§λ€μκ³ , (
|
16 |
λ°μ΄ν°μ
μ λΆλ¬μ¨ λ€ ChatML νμμ λ§μΆ° νλ ¨ λ°μ΄ν° ꡬμΆμ ν λ€ μ§ννμ΅λλ€. νμνμλ€λ©΄ μμ λ‘κ² μ¬μ©νμκΈ° λ°λλλ€.
|
17 |
|
18 |
-
# Intended use & limitations
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
μΆκ°μμ
|
29 |
|
30 |
---
|
31 |
license: apache-2.0
|
|
|
8 |
# Korean Style Transfer
|
9 |
|
10 |
This model is a fine-tuned version of [Synatra-7B-v0.3-dpo](https://huggingface.co/maywell/Synatra-7B-v0.3-dpo) using a Korean style dataset provided by Smilegate AI (https://github.com/smilegate-ai/korean_smile_style_dataset/tree/main).
|
11 |
+
Since the original dataset is tabular and not fit for training the LLM, I have preprocessed it into an instruction-input-output format, which can be found [here](https://huggingface.co/datasets/brian-lim/smile_style_orca).
|
12 |
The dataset is then fed into the ChatML template. Feel free to use my version of the dataset as needed.
|
13 |
|
14 |
ν΄λΉ λͺ¨λΈμ [Synatra-7B-v0.3-dpo](https://huggingface.co/maywell/Synatra-7B-v0.3-dpo) λͺ¨λΈμ μ€λ§μΌκ²μ΄νΈ AIμμ μ 곡νλ Smile style λ°μ΄ν°μ
μΌλ‘ νμΈνλ νμ΅λλ€.
|
15 |
+
κΈ°μ‘΄ λ°μ΄ν°μ
μ ν
μ΄λΈ ννλ‘ λμ΄μμ΄ ν΄λΉ λ°μ΄ν°λ₯Ό instruction-input-output ννλ‘ λ§λ€μκ³ , [μ¬κΈ°](https://huggingface.co/datasets/brian-lim/smile_style_orca)μμ νμΈ κ°λ₯ν©λλ€.
|
16 |
λ°μ΄ν°μ
μ λΆλ¬μ¨ λ€ ChatML νμμ λ§μΆ° νλ ¨ λ°μ΄ν° ꡬμΆμ ν λ€ μ§ννμ΅λλ€. νμνμλ€λ©΄ μμ λ‘κ² μ¬μ©νμκΈ° λ°λλλ€.
|
17 |
|
|
|
18 |
|
19 |
+
# How to use
|
20 |
|
21 |
+
```python
|
22 |
+
>>> import torch
|
23 |
+
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
|
24 |
|
25 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
26 |
+
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained('brian-lim/smile-style-transfer')
|
28 |
+
model = AutoModelForCausalLM.from_pretrained('brian-lim/smile-style-transfer', device_map = device)
|
29 |
+
|
30 |
+
prompts = {'informal': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν νμμ μ΄μ§ μκ³ λ±λ±νμ§ μμ λνμ²΄λ‘ λ°κΏμ€.',
|
31 |
+
'android': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μλλ‘μ΄λ λ‘λ΄κ³Ό κ°μ λνμ²΄λ‘ λ°κΏμ€.',
|
32 |
+
'azae': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μμ μ¨κ°μ λ§ν¬λ‘ λ°κΏμ€.',
|
33 |
+
'chat': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μΈν°λ·μμ μ¬μ©νλ λ§ν¬λ‘ λ°κΏμ€.',
|
34 |
+
'choding': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μ΄λ±νμμ²λΌ μ§§κ² μ€μΈ λνμ²΄λ‘ λ°κΏμ€.',
|
35 |
+
'emoticon': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μ΄λͺ¨ν°μ½μ΄ λ€μ΄κ° λνμ²΄λ‘ λ°κΏμ€.',
|
36 |
+
'enfp': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν νκΈ°μ°¨λ©΄μ 곡κ°μ λ§μ΄ νλ μΉμ ν λνμ²΄λ‘ λ°κΏμ€.',
|
37 |
+
'gentle' : 'μ£Όμ΄μ§ κΈμ κ°λ₯ν βμβλ‘ λλμ§ μμΌλ©΄μ κΉλν λνμ²΄λ‘ λ°κΏμ€.',
|
38 |
+
'halbae' : 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μ°λ₯μ΄ μλ ν μλ²μ§ κ°μ 맑ν¬λ‘ λ°κΏμ€.',
|
39 |
+
'halmae' : 'μ£Όμ΄μ§ κΈμ κ°λ₯ν λΉμμ΄κ° λ€μ΄κ°λ ν λ¨Έλ κ°μ 맑ν¬λ‘ λ°κΏμ€.',
|
40 |
+
'joongding': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μ€νκ΅ 2νλ
μ λ§ν¬λ‘ λ°κΏμ€.',
|
41 |
+
'king': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μ‘°μ μλ μμ λ§ν¬λ‘ λ°κΏμ€.',
|
42 |
+
'seonbi': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μ‘°μ μλ μ λΉμ λ§ν¬λ‘ λ°κΏμ€.',
|
43 |
+
'sosim': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μμ£Ό μμ¬νκ³ μ‘°μ¬μ€λ¬μ΄ λ§ν¬λ‘ λ°κΏμ€.',
|
44 |
+
'translator': 'μ£Όμ΄μ§ κΈμ κ°λ₯ν μ΄μν νκ΅μ΄ λ²μ λ§ν¬λ‘ λ°κΏμ€.',
|
45 |
+
}
|
46 |
+
query = '[INPUT]: μλ
νμΈμ. μμ¦ λ μ¨κ° λ§μ΄ μμνλ€μ \n[OUTPUT]: '
|
47 |
+
|
48 |
+
input_query = prompts['king'] + query
|
49 |
+
input_tokenized = tokenizer(input_query,return_tensors="pt").to(device)
|
50 |
|
51 |
+
g_config = GenerationConfig(temperature=0.3,
|
52 |
+
repetition_penalty=1.2,
|
53 |
+
max_new_tokens=768,
|
54 |
+
do_sample=True,
|
55 |
+
)
|
56 |
+
output = model.generate(**input_tokenized,
|
57 |
+
generation_config=g_config,
|
58 |
+
pad_token_id=tokenizer.eos_token_id,
|
59 |
+
eos_token_id=tokenizer.eos_token_id,)
|
60 |
+
output_text = tokenizer.decode(output.detach().cpu().numpy()[0])
|
61 |
+
output_text = output_text[output_text.find('[OUTPUT]'):]
|
62 |
+
print(output_text)
|
63 |
+
```
|
64 |
|
|
|
65 |
|
66 |
---
|
67 |
license: apache-2.0
|