Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some web-ui bugs #2794

Merged
merged 1 commit into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions swift/ui/llm_infer/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,14 @@ def parse_info_from_cmdline(cls, task):

@classmethod
def kill_task(cls, task):
pid, all_args = cls.parse_info_from_cmdline(task)
log_file = all_args['log_file']
if sys.platform == 'win32':
os.system(f'taskkill /f /t /pid "{pid}"')
else:
os.system(f'pkill -9 -f {log_file}')
time.sleep(1)
if task:
pid, all_args = cls.parse_info_from_cmdline(task)
log_file = all_args['log_file']
if sys.platform == 'win32':
os.system(f'taskkill /f /t /pid "{pid}"')
else:
os.system(f'pkill -9 -f {log_file}')
time.sleep(1)
return [cls.refresh_tasks()] + [gr.update(value=None)]

@classmethod
Expand All @@ -266,9 +267,4 @@ def task_changed(cls, task, base_tab):
ret.append(gr.update(value=arg))
else:
ret.append(gr.update())
train_type = None
if is_custom_path:
with open(os.path.join(all_args['ckpt_dir'], 'args.json'), 'r', encoding='utf-8') as f:
_json = json.load(f)
train_type = _json.get('train_type')
return ret + [gr.update(value=None), [all_args.get('model_type'), all_args.get('template_type'), train_type]]
return ret + [gr.update(value=None)]
25 changes: 18 additions & 7 deletions swift/ui/llm_train/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,14 @@ def parse_info_from_cmdline(task):

@staticmethod
def kill_task(task):
pid, all_args = Runtime.parse_info_from_cmdline(task)
output_dir = all_args['output_dir']
if sys.platform == 'win32':
os.system(f'taskkill /f /t /pid "{pid}"')
else:
os.system(f'pkill -9 -f {output_dir}')
time.sleep(1)
if task:
pid, all_args = Runtime.parse_info_from_cmdline(task)
output_dir = all_args['output_dir']
if sys.platform == 'win32':
os.system(f'taskkill /f /t /pid "{pid}"')
else:
os.system(f'pkill -9 -f {output_dir}')
time.sleep(1)
return [Runtime.refresh_tasks()] + [gr.update(value=None)] * (len(Runtime.get_plot(task)) + 1)

@staticmethod
Expand Down Expand Up @@ -520,6 +521,16 @@ def plot(task):
for k in plot:
name = k['name']
smooth = k['smooth']
if name == 'train/acc':
if 'train/token_acc' in data:
name = 'train/token_acc'
if 'train/seq_acc' in data:
name = 'train/seq_acc'
if name == 'eval/acc':
if 'eval/token_acc' in data:
name = 'eval/token_acc'
if 'eval/seq_acc' in data:
name = 'eval/seq_acc'
if name not in data:
plots.append(None)
continue
Expand Down
Loading