Skip to content

Commit

Permalink
Merge branch 'main' into release/1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintao-Huang committed Mar 10, 2024
2 parents 1d60b37 + 781ec7d commit 43f6a75
Show file tree
Hide file tree
Showing 6 changed files with 579 additions and 42 deletions.
2 changes: 1 addition & 1 deletion swift/ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def run_ui():
LLMInfer.build_ui(LLMInfer)

port = os.environ.get('WEBUI_PORT', None)
app.queue().launch(
app.queue(concurrency_count=5).launch(
server_name=os.environ.get('WEBUI_SERVER', None),
server_port=port if port is None else int(port),
height=800,
Expand Down
16 changes: 16 additions & 0 deletions swift/ui/llm_infer/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Type

import gradio as gr
Expand Down Expand Up @@ -40,19 +41,32 @@ class Generate(BaseUI):
'en': 'top_p'
},
},
'infer_backend': {
'label': {
'zh': '推理框架',
'en': 'Infer backend'
},
},
'repetition_penalty': {
'label': {
'zh': 'repetition_penalty',
'en': 'repetition_penalty'
},
},
'port': {
'label': {
'zh': '端口',
'en': 'port'
},
},
}

@classmethod
def do_build_ui(cls, base_tab: Type['BaseUI']):
with gr.Row():
gr.Textbox(elem_id='max_new_tokens', lines=1, value='2048')
gr.Checkbox(elem_id='do_sample', value=True)
gr.Dropdown(elem_id='infer_backend', value='pt')
gr.Slider(
elem_id='temperature',
minimum=0.0,
Expand All @@ -73,3 +87,5 @@ def do_build_ui(cls, base_tab: Type['BaseUI']):
maximum=10,
step=0.05,
value=1.05)
if os.environ.get('MODELSCOPE_ENVIRONMENT') != 'studio':
gr.Textbox(elem_id='port', lines=1, value='8000')
Loading

0 comments on commit 43f6a75

Please sign in to comment.