Commit
·
905330c
1
Parent(s):
8202a71
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,6 +88,8 @@ def evaluate(
|
|
| 88 |
max_new_tokens=128,
|
| 89 |
**kwargs,
|
| 90 |
):
|
|
|
|
|
|
|
| 91 |
prompt = generate_prompt(instruction, input)
|
| 92 |
inputs = tokenizer(prompt, return_tensors="pt")
|
| 93 |
input_ids = inputs["input_ids"].to(device)
|
|
@@ -115,15 +117,19 @@ g = gr.Interface(
|
|
| 115 |
fn=evaluate,
|
| 116 |
inputs=[
|
| 117 |
gr.components.Textbox(
|
| 118 |
-
lines=2, label="Instruction", placeholder="
|
|
|
|
|
|
|
| 119 |
),
|
| 120 |
-
gr.components.Textbox(lines=2, label="Input", placeholder="
|
|
|
|
|
|
|
| 121 |
gr.components.Slider(minimum=0, maximum=1, value=0.1, label="Temperature"),
|
| 122 |
gr.components.Slider(minimum=0, maximum=1, value=0.75, label="Top p"),
|
| 123 |
gr.components.Slider(minimum=0, maximum=100, step=1, value=40, label="Top k"),
|
| 124 |
gr.components.Slider(minimum=1, maximum=4, step=1, value=4, label="Beams"),
|
| 125 |
gr.components.Slider(
|
| 126 |
-
minimum=1, maximum=
|
| 127 |
),
|
| 128 |
],
|
| 129 |
outputs=[
|
|
@@ -133,9 +139,10 @@ g = gr.Interface(
|
|
| 133 |
)
|
| 134 |
],
|
| 135 |
title="Llama2_7b_chat_Japanese_Lora",
|
| 136 |
-
description="Llama-2-7b-chat-Japanese-LoRA is a multi-purpose large language model for Japanese text.\n\
|
| 137 |
This model is presented by the joint effort of Sparticle Inc. and A. I. Hakusan Inc.\n\n\
|
| 138 |
-
Llama-2-7b-chat-Japanese-LoRAは日本語テキストのための多目的大規模言語モデルです。\n\
|
|
|
|
| 139 |
このモデルは、Sparticle株式会社と株式会社白山人工知能の共同開発により発表されました。",
|
| 140 |
)
|
| 141 |
g.queue(concurrency_count=1)
|
|
|
|
| 88 |
max_new_tokens=128,
|
| 89 |
**kwargs,
|
| 90 |
):
|
| 91 |
+
if instruction == None:
|
| 92 |
+
return 'Instruction not found. Please enter your instruction.\nInstructionを入力してください。'
|
| 93 |
prompt = generate_prompt(instruction, input)
|
| 94 |
inputs = tokenizer(prompt, return_tensors="pt")
|
| 95 |
input_ids = inputs["input_ids"].to(device)
|
|
|
|
| 117 |
fn=evaluate,
|
| 118 |
inputs=[
|
| 119 |
gr.components.Textbox(
|
| 120 |
+
lines=2, label="Instruction", placeholder="例1:日本語から英語に翻訳してください。\n\
|
| 121 |
+
例2:このテキストを要約してください。\n\
|
| 122 |
+
例3:英語から日本語に翻訳してください。"
|
| 123 |
),
|
| 124 |
+
gr.components.Textbox(lines=2, label="Input", placeholder="例1:日本語のテキスト\n\
|
| 125 |
+
例2:日本語の長いテキスト"\n\
|
| 126 |
+
例3:英語のテキスト),
|
| 127 |
gr.components.Slider(minimum=0, maximum=1, value=0.1, label="Temperature"),
|
| 128 |
gr.components.Slider(minimum=0, maximum=1, value=0.75, label="Top p"),
|
| 129 |
gr.components.Slider(minimum=0, maximum=100, step=1, value=40, label="Top k"),
|
| 130 |
gr.components.Slider(minimum=1, maximum=4, step=1, value=4, label="Beams"),
|
| 131 |
gr.components.Slider(
|
| 132 |
+
minimum=1, maximum=1000, step=1, value=128, label="Max tokens"
|
| 133 |
),
|
| 134 |
],
|
| 135 |
outputs=[
|
|
|
|
| 139 |
)
|
| 140 |
],
|
| 141 |
title="Llama2_7b_chat_Japanese_Lora",
|
| 142 |
+
description="Llama-2-7b-chat-Japanese-LoRA is a multi-purpose large language model for Japanese text.\n\n\
|
| 143 |
This model is presented by the joint effort of Sparticle Inc. and A. I. Hakusan Inc.\n\n\
|
| 144 |
+
Llama-2-7b-chat-Japanese-LoRAは日本語テキストのための多目的大規模言語モデルです。\n\n\
|
| 145 |
+
このモデルは日本語が話せる。日本語での指示や入力が可能です。\n\n
|
| 146 |
このモデルは、Sparticle株式会社と株式会社白山人工知能の共同開発により発表されました。",
|
| 147 |
)
|
| 148 |
g.queue(concurrency_count=1)
|