Commit
·
33e854a
1
Parent(s):
b1dcea3
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,43 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- ko
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: text2text-generation
|
7 |
---
|
8 |
+
|
9 |
+
# Chat T5
|
10 |
+
[SourceCode](https://github.com/paust-team/pko-t5/tree/main/pkot5/chat)
|
11 |
+
|
12 |
+
Chat T5 는 [pko-flan-t5-large](https://huggingface.co/paust/pko-flan-t5-large) 를 기반으로 만들었습니다.
|
13 |
+
|
14 |
+
[KoAlpaca](https://github.com/beomi/koalpaca) 에서 제공하는 데이터셋과 [evolve-instruct](https://github.com/lcw99/evolve-instruct) 에서 제공하는 데이터셋을 학습했습니다.
|
15 |
+
좋은 데이터를 공개해주셔서 감사합니다.
|
16 |
+
|
17 |
+
|
18 |
+
### Model
|
19 |
+
- [Huggingface](https://huggingface.co/paust/pko-chat-t5-large)
|
20 |
+
|
21 |
+
### Example
|
22 |
+
```python
|
23 |
+
from transformers import T5TokenizerFast, T5ForConditionalGeneration
|
24 |
+
tokenizer = T5TokenizerFast.from_pretrained("paust/pko-chat-t5-large")
|
25 |
+
model = T5ForConditionalGeneration.from_pretrained("paust/pko-chat-t5-large", device_map='cuda')
|
26 |
+
|
27 |
+
prompt_tpl = "사용자가 한 말을 읽고 그에 질문에 답하거나 명령에 응답하는 비서입니다.\n\n사용자:\n{text}\n\n비서:\n"
|
28 |
+
prompt = prompt_tpl.format(text="한국의 수도는 어디인가요?")
|
29 |
+
input_ids = tokenizer(prompt, return_tensors='pt').input_ids
|
30 |
+
logits = model.generate(
|
31 |
+
input_ids,
|
32 |
+
max_new_tokens=1024,
|
33 |
+
temperature=0.5,
|
34 |
+
no_repeat_ngram_size=6,
|
35 |
+
do_sample=True,
|
36 |
+
num_return_sequences=1,
|
37 |
+
)
|
38 |
+
text = tokenizer.batch_decode(logits, skip_special_tokens=True)[0]
|
39 |
+
print(text) # 한국의 수도는 서울입니다.
|
40 |
+
```
|
41 |
+
|
42 |
+
## License
|
43 |
+
[PAUST](https://paust.io)에서 만든 pko-t5는 [MIT license](https://github.com/paust-team/pko-t5/blob/main/LICENSE) 하에 공개되어 있습니다.
|