forked from atselousov/transformer_chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwild.py
42 lines (34 loc) · 1.25 KB
/
wild.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from ParlAI.projects.convai.convai_world import ConvAIWorld
from parlai.core.params import ParlaiParser
from agent import TransformerAgent
def main():
parser = ParlaiParser(True, True)
parser.set_defaults(batchsize=10,
sample=True,
wild_mode=False,
replace_repeat=True,
replace_ngram=True,
detokenize=True,
emoji_prob=0.3,
add_questions=0.4,
clean_emoji=True,
check_grammar=True,
correct_generative=True,
split_into_sentences=True,
max_seq_len=256,
beam_size=3,
annealing_topk=None,
annealing=0.6,
length_penalty=0.7)
ConvAIWorld.add_cmdline_args(parser)
TransformerAgent.add_cmdline_args(parser)
opt = parser.parse_args()
agent = TransformerAgent(opt)
world = ConvAIWorld(opt, [agent])
while True:
try:
world.parley()
except Exception as e:
print('Exception: {}'.format(e))
if __name__ == '__main__':
main()