add Janus-Pro

This commit is contained in:
charlescxk
2025-01-27 23:46:51 +08:00
parent 146668eafe
commit 95bde087ba
5 changed files with 475 additions and 6 deletions

View File

@@ -88,6 +88,7 @@ class VLChatProcessor(ProcessorMixin):
image_tag: str = "<image_placeholder>",
image_start_tag: str = "<begin_of_image>",
image_end_tag: str = "<end_of_image>",
pad_tag: str = "<▁pad▁>",
num_image_tokens: int = 576,
add_special_token: bool = False,
sft_format: str = "deepseek",
@@ -108,6 +109,7 @@ class VLChatProcessor(ProcessorMixin):
self.image_tag = image_tag
self.image_start_tag = image_start_tag
self.image_end_tag = image_end_tag
self.pad_tag = pad_tag
self.num_image_tokens = num_image_tokens
self.add_special_token = add_special_token
@@ -203,9 +205,10 @@ class VLChatProcessor(ProcessorMixin):
@property
def pad_id(self):
pad_id = self.tokenizer.pad_token_id
if pad_id is None:
pad_id = self.tokenizer.eos_token_id
pad_id = self.tokenizer.vocab.get(self.pad_tag)
# pad_id = self.tokenizer.pad_token_id
# if pad_id is None:
# pad_id = self.tokenizer.eos_token_id
return pad_id

View File

@@ -275,7 +275,7 @@ register_conv_template(
# deepseek template
register_conv_template(
Conversation(
name="deepseek",
name="deepseek_old",
system_template="{system_message}",
# system_message="You are a helpful assistant. Please answer truthfully and write out your "
# "thinking step by step to be sure you get the right answer.",
@@ -290,6 +290,23 @@ register_conv_template(
stop_str=["User:", "<end▁of▁sentence>"],
)
)
register_conv_template(
Conversation(
name="deepseek",
system_template="{system_message}",
# system_message="You are a helpful assistant. Please answer truthfully and write out your "
# "thinking step by step to be sure you get the right answer.",
system_message="",
roles=("<|User|>", "<|Assistant|>"),
messages=(),
offset=0,
sep_style=SeparatorStyle.DeepSeek,
sep="\n\n",
sep2="<end▁of▁sentence>",
stop_token_ids=[100001],
stop_str=["<|User|>", "<end▁of▁sentence>"]
)
)
register_conv_template(
Conversation(