-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathchat_settings.py
31 lines (28 loc) · 1.04 KB
/
chat_settings.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
"""
ChatSettings class
"""
import copy
class ChatSettings(object):
"""Contains settings for a chat session.
"""
def __init__(self, model_hparams, inference_hparams):
"""
Args:
inference_hparams: the loaded InferenceHparams instance to use as default for this chat session
"""
self.show_question_context = False
self.show_all_beams = False
self.enable_auto_punctuation = True
self.model_hparams = None
self.inference_hparams = None
self._default_model_hparams = model_hparams
self._default_inference_hparams = inference_hparams
self.reset_to_defaults()
def reset_to_defaults(self):
"""Reset all settings to defaults
"""
self.show_question_context = False
self.show_all_beams = False
self.enable_auto_punctuation = True
self.model_hparams = copy.copy(self._default_model_hparams)
self.inference_hparams = copy.copy(self._default_inference_hparams)