Spaces:
Running
on
Zero
Running
on
Zero
tori29umai
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -109,14 +109,14 @@ class Settings:
|
|
109 |
settings['DEFAULT_GEN_MODEL'] = config['Models'].get('DEFAULT_GEN_MODEL', '')
|
110 |
if 'ChatParameters' in config:
|
111 |
settings['chat_n_gpu_layers'] = int(config['ChatParameters'].get('n_gpu_layers', '-1'))
|
112 |
-
settings['chat_temperature'] = float(config['ChatParameters'].get('temperature', '0.
|
113 |
settings['chat_top_p'] = float(config['ChatParameters'].get('top_p', '0.9'))
|
114 |
settings['chat_top_k'] = int(config['ChatParameters'].get('top_k', '40'))
|
115 |
settings['chat_rep_pen'] = float(config['ChatParameters'].get('repetition_penalty', '1.2'))
|
116 |
settings['chat_n_ctx'] = int(config['ChatParameters'].get('n_ctx', '10000'))
|
117 |
if 'GenerateParameters' in config:
|
118 |
settings['gen_n_gpu_layers'] = int(config['GenerateParameters'].get('n_gpu_layers', '-1'))
|
119 |
-
settings['gen_temperature'] = float(config['GenerateParameters'].get('temperature', '0.
|
120 |
settings['gen_top_p'] = float(config['GenerateParameters'].get('top_p', '0.9'))
|
121 |
settings['gen_top_k'] = int(config['GenerateParameters'].get('top_k', '40'))
|
122 |
settings['gen_rep_pen'] = float(config['GenerateParameters'].get('repetition_penalty', '1.2'))
|
@@ -138,7 +138,7 @@ class Settings:
|
|
138 |
}
|
139 |
config['ChatParameters'] = {
|
140 |
'n_gpu_layers': str(settings.get('chat_n_gpu_layers', -1)),
|
141 |
-
'temperature': str(settings.get('chat_temperature', 0.
|
142 |
'top_p': str(settings.get('chat_top_p', 0.9)),
|
143 |
'top_k': str(settings.get('chat_top_k', 40)),
|
144 |
'repetition_penalty': str(settings.get('chat_rep_pen', 1.2)),
|
@@ -146,7 +146,7 @@ class Settings:
|
|
146 |
}
|
147 |
config['GenerateParameters'] = {
|
148 |
'n_gpu_layers': str(settings.get('gen_n_gpu_layers', -1)),
|
149 |
-
'temperature': str(settings.get('gen_temperature', 0.
|
150 |
'top_p': str(settings.get('gen_top_p', 0.9)),
|
151 |
'top_k': str(settings.get('gen_top_k', 40)),
|
152 |
'repetition_penalty': str(settings.get('gen_rep_pen', 1.2)),
|
@@ -175,13 +175,13 @@ class Settings:
|
|
175 |
'DEFAULT_CHAT_MODEL': 'EZO-Common-9B-gemma-2-it.f16.gguf',
|
176 |
'DEFAULT_GEN_MODEL': 'EZO-Common-9B-gemma-2-it.f16.gguf',
|
177 |
'chat_n_gpu_layers': -1,
|
178 |
-
'chat_temperature': 0.
|
179 |
'chat_top_p': 0.9,
|
180 |
'chat_top_k': 40,
|
181 |
'chat_rep_pen': 1.2,
|
182 |
'chat_n_ctx': 10000,
|
183 |
'gen_n_gpu_layers': -1,
|
184 |
-
'gen_temperature': 0.
|
185 |
'gen_top_p': 0.9,
|
186 |
'gen_top_k': 40,
|
187 |
'gen_rep_pen': 1.2,
|
@@ -197,13 +197,13 @@ class Settings:
|
|
197 |
class GenTextParams:
|
198 |
def __init__(self):
|
199 |
self.gen_n_gpu_layers = -1
|
200 |
-
self.gen_temperature = 0.
|
201 |
self.gen_top_p = 0.9
|
202 |
self.gen_top_k = 40
|
203 |
self.gen_rep_pen = 1.2
|
204 |
self.gen_n_ctx = 10000
|
205 |
self.chat_n_gpu_layers = -1
|
206 |
-
self.chat_temperature = 0.
|
207 |
self.chat_top_p = 0.9
|
208 |
self.chat_top_k = 40
|
209 |
self.chat_rep_pen = 1.2
|
@@ -626,7 +626,7 @@ def apply_settings():
|
|
626 |
if 'ChatParameters' in new_config:
|
627 |
params.update_chat_parameters(
|
628 |
int(new_config['ChatParameters'].get('n_gpu_layers', '-1')),
|
629 |
-
float(new_config['ChatParameters'].get('temperature', '0.
|
630 |
float(new_config['ChatParameters'].get('top_p', '0.9')),
|
631 |
int(new_config['ChatParameters'].get('top_k', '40')),
|
632 |
float(new_config['ChatParameters'].get('repetition_penalty', '1.2')),
|
@@ -635,7 +635,7 @@ def apply_settings():
|
|
635 |
if 'GenerateParameters' in new_config:
|
636 |
params.update_generate_parameters(
|
637 |
int(new_config['GenerateParameters'].get('n_gpu_layers', '-1')),
|
638 |
-
float(new_config['GenerateParameters'].get('temperature', '0.
|
639 |
float(new_config['GenerateParameters'].get('top_p', '0.9')),
|
640 |
int(new_config['GenerateParameters'].get('top_k', '40')),
|
641 |
float(new_config['GenerateParameters'].get('repetition_penalty', '1.2')),
|
@@ -719,7 +719,7 @@ def build_gradio_interface():
|
|
719 |
gen_input_char_count = gr.HTML(value="文字数: 0")
|
720 |
with gr.Column(scale=1):
|
721 |
gen_characters = gr.Slider(minimum=10, maximum=10000, value=500, step=10, label="出力文字数", info="出力文字数の目安")
|
722 |
-
gen_token_multiplier = gr.Slider(minimum=0.
|
723 |
|
724 |
generate_button = gr.Button("文章生成開始")
|
725 |
generated_output = gr.Textbox(label="生成された文章")
|
|
|
109 |
settings['DEFAULT_GEN_MODEL'] = config['Models'].get('DEFAULT_GEN_MODEL', '')
|
110 |
if 'ChatParameters' in config:
|
111 |
settings['chat_n_gpu_layers'] = int(config['ChatParameters'].get('n_gpu_layers', '-1'))
|
112 |
+
settings['chat_temperature'] = float(config['ChatParameters'].get('temperature', '0.35'))
|
113 |
settings['chat_top_p'] = float(config['ChatParameters'].get('top_p', '0.9'))
|
114 |
settings['chat_top_k'] = int(config['ChatParameters'].get('top_k', '40'))
|
115 |
settings['chat_rep_pen'] = float(config['ChatParameters'].get('repetition_penalty', '1.2'))
|
116 |
settings['chat_n_ctx'] = int(config['ChatParameters'].get('n_ctx', '10000'))
|
117 |
if 'GenerateParameters' in config:
|
118 |
settings['gen_n_gpu_layers'] = int(config['GenerateParameters'].get('n_gpu_layers', '-1'))
|
119 |
+
settings['gen_temperature'] = float(config['GenerateParameters'].get('temperature', '0.35'))
|
120 |
settings['gen_top_p'] = float(config['GenerateParameters'].get('top_p', '0.9'))
|
121 |
settings['gen_top_k'] = int(config['GenerateParameters'].get('top_k', '40'))
|
122 |
settings['gen_rep_pen'] = float(config['GenerateParameters'].get('repetition_penalty', '1.2'))
|
|
|
138 |
}
|
139 |
config['ChatParameters'] = {
|
140 |
'n_gpu_layers': str(settings.get('chat_n_gpu_layers', -1)),
|
141 |
+
'temperature': str(settings.get('chat_temperature', 0.35)),
|
142 |
'top_p': str(settings.get('chat_top_p', 0.9)),
|
143 |
'top_k': str(settings.get('chat_top_k', 40)),
|
144 |
'repetition_penalty': str(settings.get('chat_rep_pen', 1.2)),
|
|
|
146 |
}
|
147 |
config['GenerateParameters'] = {
|
148 |
'n_gpu_layers': str(settings.get('gen_n_gpu_layers', -1)),
|
149 |
+
'temperature': str(settings.get('gen_temperature', 0.35)),
|
150 |
'top_p': str(settings.get('gen_top_p', 0.9)),
|
151 |
'top_k': str(settings.get('gen_top_k', 40)),
|
152 |
'repetition_penalty': str(settings.get('gen_rep_pen', 1.2)),
|
|
|
175 |
'DEFAULT_CHAT_MODEL': 'EZO-Common-9B-gemma-2-it.f16.gguf',
|
176 |
'DEFAULT_GEN_MODEL': 'EZO-Common-9B-gemma-2-it.f16.gguf',
|
177 |
'chat_n_gpu_layers': -1,
|
178 |
+
'chat_temperature': 0.35,
|
179 |
'chat_top_p': 0.9,
|
180 |
'chat_top_k': 40,
|
181 |
'chat_rep_pen': 1.2,
|
182 |
'chat_n_ctx': 10000,
|
183 |
'gen_n_gpu_layers': -1,
|
184 |
+
'gen_temperature': 0.35,
|
185 |
'gen_top_p': 0.9,
|
186 |
'gen_top_k': 40,
|
187 |
'gen_rep_pen': 1.2,
|
|
|
197 |
class GenTextParams:
|
198 |
def __init__(self):
|
199 |
self.gen_n_gpu_layers = -1
|
200 |
+
self.gen_temperature = 0.35
|
201 |
self.gen_top_p = 0.9
|
202 |
self.gen_top_k = 40
|
203 |
self.gen_rep_pen = 1.2
|
204 |
self.gen_n_ctx = 10000
|
205 |
self.chat_n_gpu_layers = -1
|
206 |
+
self.chat_temperature = 0.35
|
207 |
self.chat_top_p = 0.9
|
208 |
self.chat_top_k = 40
|
209 |
self.chat_rep_pen = 1.2
|
|
|
626 |
if 'ChatParameters' in new_config:
|
627 |
params.update_chat_parameters(
|
628 |
int(new_config['ChatParameters'].get('n_gpu_layers', '-1')),
|
629 |
+
float(new_config['ChatParameters'].get('temperature', '0.35')),
|
630 |
float(new_config['ChatParameters'].get('top_p', '0.9')),
|
631 |
int(new_config['ChatParameters'].get('top_k', '40')),
|
632 |
float(new_config['ChatParameters'].get('repetition_penalty', '1.2')),
|
|
|
635 |
if 'GenerateParameters' in new_config:
|
636 |
params.update_generate_parameters(
|
637 |
int(new_config['GenerateParameters'].get('n_gpu_layers', '-1')),
|
638 |
+
float(new_config['GenerateParameters'].get('temperature', '0.35')),
|
639 |
float(new_config['GenerateParameters'].get('top_p', '0.9')),
|
640 |
int(new_config['GenerateParameters'].get('top_k', '40')),
|
641 |
float(new_config['GenerateParameters'].get('repetition_penalty', '1.2')),
|
|
|
719 |
gen_input_char_count = gr.HTML(value="文字数: 0")
|
720 |
with gr.Column(scale=1):
|
721 |
gen_characters = gr.Slider(minimum=10, maximum=10000, value=500, step=10, label="出力文字数", info="出力文字数の目安")
|
722 |
+
gen_token_multiplier = gr.Slider(minimum=0.35, maximum=3, value=1.75, step=0.01, label="文字/トークン数倍率", info="文字/最大トークン数倍率")
|
723 |
|
724 |
generate_button = gr.Button("文章生成開始")
|
725 |
generated_output = gr.Textbox(label="生成された文章")
|