Spaces:
Paused
Paused
ElPlaguister
commited on
Commit
Β·
47eae50
1
Parent(s):
c8a4b93
Feat Generalize Special Token Replacement
Browse files
model.py
CHANGED
@@ -9,6 +9,7 @@ class Model:
|
|
9 |
self.tokenizer = None
|
10 |
self.gen_config = None
|
11 |
self.INPUT_FORMAT = None
|
|
|
12 |
|
13 |
def generate(self, inputs:str) -> str:
|
14 |
outputs = inputs
|
@@ -16,7 +17,7 @@ class Model:
|
|
16 |
|
17 |
def chat(self, message, chat_history):
|
18 |
response = self.generate(message)
|
19 |
-
|
20 |
-
|
21 |
chat_history.append((message, response))
|
22 |
return "", gr.Chatbot(chat_history, label=self.name, bubble_full_width=False)
|
|
|
9 |
self.tokenizer = None
|
10 |
self.gen_config = None
|
11 |
self.INPUT_FORMAT = None
|
12 |
+
self.SPETIAL_TOKENS = ["#νμ#", "#μ²μ#", "#(λ¨μ)μ²μ#", "#(λ¨μ)νμ#", "#(μ¬μ)μ²μ#", "(μ¬μ)νμ"]
|
13 |
|
14 |
def generate(self, inputs:str) -> str:
|
15 |
outputs = inputs
|
|
|
17 |
|
18 |
def chat(self, message, chat_history):
|
19 |
response = self.generate(message)
|
20 |
+
for special_token in self.SPETIAL_TOKENS:
|
21 |
+
response = response.replace(special_token, 'λ')
|
22 |
chat_history.append((message, response))
|
23 |
return "", gr.Chatbot(chat_history, label=self.name, bubble_full_width=False)
|