mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-23 14:22:51 +08:00
Update common.py
Former-commit-id: 2c17d91bb7ae58346c020c46cb7ffabad4deff4f
This commit is contained in:
parent
f051bff1e6
commit
1f1b8e825d
@ -115,13 +115,6 @@ def get_model_path(model_name: str) -> str:
|
|||||||
return model_path
|
return model_path
|
||||||
|
|
||||||
|
|
||||||
def get_prefix(model_name: str) -> str:
|
|
||||||
r"""
|
|
||||||
Gets the prefix of the model name to obtain the model family.
|
|
||||||
"""
|
|
||||||
return model_name.split("-")[0]
|
|
||||||
|
|
||||||
|
|
||||||
def get_model_info(model_name: str) -> Tuple[str, str]:
|
def get_model_info(model_name: str) -> Tuple[str, str]:
|
||||||
r"""
|
r"""
|
||||||
Gets the necessary information of this model.
|
Gets the necessary information of this model.
|
||||||
@ -137,21 +130,14 @@ def get_template(model_name: str) -> str:
|
|||||||
r"""
|
r"""
|
||||||
Gets the template name if the model is a chat model.
|
Gets the template name if the model is a chat model.
|
||||||
"""
|
"""
|
||||||
if (
|
return DEFAULT_TEMPLATE.get(model_name, "default")
|
||||||
model_name
|
|
||||||
and any(suffix in model_name for suffix in ("-Chat", "-Instruct"))
|
|
||||||
and get_prefix(model_name) in DEFAULT_TEMPLATE
|
|
||||||
):
|
|
||||||
return DEFAULT_TEMPLATE[get_prefix(model_name)]
|
|
||||||
|
|
||||||
return "default"
|
|
||||||
|
|
||||||
|
|
||||||
def get_visual(model_name: str) -> bool:
|
def get_visual(model_name: str) -> bool:
|
||||||
r"""
|
r"""
|
||||||
Judges if the model is a vision language model.
|
Judges if the model is a vision language model.
|
||||||
"""
|
"""
|
||||||
return get_prefix(model_name) in VISION_MODELS
|
return model_name in VISION_MODELS
|
||||||
|
|
||||||
|
|
||||||
def list_checkpoints(model_name: str, finetuning_type: str) -> "gr.Dropdown":
|
def list_checkpoints(model_name: str, finetuning_type: str) -> "gr.Dropdown":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user