diff --git a/swift/ui/base.py b/swift/ui/base.py index 97bbfd51b..34a1c30f4 100644 --- a/swift/ui/base.py +++ b/swift/ui/base.py @@ -159,7 +159,7 @@ def get_choices_from_dataclass(dataclass): for f in fields(dataclass): if 'choices' in f.metadata: choice_dict[f.name] = f.metadata['choices'] - if 'Literal' in type(f.type).__name__ and typing.get_args(f.type): + if 'Literal' in str(f.type) and typing.get_args(f.type): choice_dict[f.name] = typing.get_args(f.type) return choice_dict diff --git a/swift/ui/llm_train/runtime.py b/swift/ui/llm_train/runtime.py index fdd34d1b7..a8d17869e 100644 --- a/swift/ui/llm_train/runtime.py +++ b/swift/ui/llm_train/runtime.py @@ -3,8 +3,7 @@ import time import webbrowser from datetime import datetime -from functools import partial -from typing import Dict, List, Tuple, Type, Union +from typing import Dict, List, Tuple, Type import gradio as gr import matplotlib.pyplot as plt @@ -398,7 +397,8 @@ def parse_info_from_cmdline(task): args = [arg.strip() for arg in args.split('--') if arg.strip()] all_args = {} for i in range(len(args)): - splits = args[i].split(' ') + space = args[i].find(' ') + splits = args[i][:space], args[i][space + 1:] all_args[splits[0]] = splits[1] return all_args