add yivl and save processor to model_dir
This commit is contained in:
parent
d72e6f8dfd
commit
afc6c7b9fd
|
@ -859,7 +859,7 @@ _register_template(
|
||||||
_register_template(
|
_register_template(
|
||||||
name="yivl",
|
name="yivl",
|
||||||
format_user=StringFormatter(slots=["### Human: {{content}}\n### Assistant:"]),
|
format_user=StringFormatter(slots=["### Human: {{content}}\n### Assistant:"]),
|
||||||
format_assistant=StringFormatter(slots=[" {{content}}"]),
|
format_assistant=StringFormatter(slots=[" {{content}}\n"]),
|
||||||
stop_words=["###"],
|
stop_words=["###"],
|
||||||
default_system=(
|
default_system=(
|
||||||
"This is a chat between an inquisitive human and an AI assistant. "
|
"This is a chat between an inquisitive human and an AI assistant. "
|
||||||
|
|
|
@ -29,7 +29,8 @@ def autocast_projector_dtype(
|
||||||
) -> "torch.Tensor":
|
) -> "torch.Tensor":
|
||||||
return output.to(model_args.compute_dtype)
|
return output.to(model_args.compute_dtype)
|
||||||
|
|
||||||
if hasattr(model, mm_projector_name) and getattr(model.config, "quantization_method", None):
|
if hasattr(model, mm_projector_name) and (getattr(model.config, "quantization_method", None)
|
||||||
|
or "Yi" in getattr(model.config.text_config, "_name_or_path", None)):
|
||||||
logger.info("Casting multimodal projector outputs in {}.".format(model_args.compute_dtype))
|
logger.info("Casting multimodal projector outputs in {}.".format(model_args.compute_dtype))
|
||||||
mm_projector: "torch.nn.Module" = getattr(model, mm_projector_name)
|
mm_projector: "torch.nn.Module" = getattr(model, mm_projector_name)
|
||||||
mm_projector.register_forward_hook(_mm_projector_forward_post_hook)
|
mm_projector.register_forward_hook(_mm_projector_forward_post_hook)
|
||||||
|
|
Loading…
Reference in New Issue