Skip to content

Commit

Permalink
Fix output_dir nesting during swift web_ui training (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
slin000111 authored and Jintao-Huang committed Mar 8, 2024
1 parent 0c81b2f commit 0855df7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 8 additions & 0 deletions swift/ui/llm_train/llm_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ def do_build_ui(cls, base_tab: Type['BaseUI']):
if not isinstance(value, (Tab, Accordion))
] + [cls.element('log')] + Runtime.all_plots,
cancels=Runtime.log_event)
Runtime.element('kill_task').click(
Runtime.kill_task,
[Runtime.element('running_tasks')],
[Runtime.element('running_tasks')]
+ [Runtime.element('log')] + Runtime.all_plots,
cancels=[Runtime.log_event],
).then(Runtime.reset, [], [Runtime.element('logging_dir')]
+ [Save.element('output_dir')])

@classmethod
def update_runtime(cls):
Expand Down
12 changes: 4 additions & 8 deletions swift/ui/llm_train/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,6 @@ def do_build_ui(cls, base_tab: Type['BaseUI']):
[base_tab.element('running_tasks')],
)

base_tab.element('kill_task').click(
Runtime.kill_task,
[base_tab.element('running_tasks')],
[base_tab.element('running_tasks')] + [cls.element('log')]
+ cls.all_plots,
cancels=[cls.log_event],
)

@classmethod
def update_log(cls):
return [gr.update(visible=True)] * (len(Runtime.sft_plot) + 1)
Expand Down Expand Up @@ -411,6 +403,10 @@ def kill_task(task):
return [Runtime.refresh_tasks()] + [gr.update(value=None)] * (
len(Runtime.sft_plot) + 1)

@staticmethod
def reset():
return None, 'output'

@staticmethod
def task_changed(task, base_tab):
if task:
Expand Down

0 comments on commit 0855df7

Please sign in to comment.