Gabriel Tan
commited on
Commit
•
f1c95e4
1
Parent(s):
319527a
Update README.md
Browse files
README.md
CHANGED
@@ -3,8 +3,41 @@ tags:
|
|
3 |
- conversational
|
4 |
- tagalog
|
5 |
- filipino
|
|
|
|
|
6 |
- tl
|
7 |
|
8 |
---
|
9 |
|
10 |
-
# Tagalog DialoGPT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
- conversational
|
4 |
- tagalog
|
5 |
- filipino
|
6 |
+
|
7 |
+
language:
|
8 |
- tl
|
9 |
|
10 |
---
|
11 |
|
12 |
+
# Tagalog DialoGPT
|
13 |
+
|
14 |
+
A DialoGPT model fine-tuned on Tagalog conversational data scraped from the web. This model is an output of a research on BERT-based data augmentation for low resource languages. The base model used is DialoGPT-medium.
|
15 |
+
|
16 |
+
# Latest release: July 25, 2021
|
17 |
+
* As of the moment, the model is only able to respond based on the history of 3 previous utterances before being limited. This is a result of the scarcity of Tagalog conversations in our dataset.
|
18 |
+
|
19 |
+
|
20 |
+
# Usage
|
21 |
+
|
22 |
+
```
|
23 |
+
for step in range(2):
|
24 |
+
# encode the new user input, add the eos_token and return a tensor in Pytorch
|
25 |
+
new_user_input_ids = tokenizer.encode(input(">> User:") + tokenizer.eos_token, return_tensors='pt')
|
26 |
+
|
27 |
+
# append the new user input tokens to the chat history
|
28 |
+
bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids
|
29 |
+
|
30 |
+
# we limit the generation to 512 tokens, each utterance in training had a maximum of 128 tokens
|
31 |
+
chat_history_ids = model.generate(
|
32 |
+
bot_input_ids, max_length=512,
|
33 |
+
pad_token_id=tokenizer.eos_token_id,
|
34 |
+
num_beams=5,
|
35 |
+
no_repeat_ngram_size=3
|
36 |
+
)
|
37 |
+
|
38 |
+
# pretty print last ouput tokens from bot
|
39 |
+
print("DialoGPT: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)))
|
40 |
+
```
|
41 |
+
|
42 |
+
# Dataset and Scripts
|
43 |
+
To be released
|