[Bugfix] Align Ming-Image prompt templates and RNG, fix number of layer to decompose (#8118)
Signed-off-by: Yuanheng <jonathan.zhaoyh@gmail.com>
This commit is contained in:
1 parent
b41e6707b1
commit
3bd5ac9685
8 files changed
+168
-25
No files matched your search
@@ -552,6 +552,19 @@ class MingImageProcessor(ProcessorMixin):
|
||||
expanded.append(sample)
|
||||
return expanded
|
||||
|
||||
def _apply_image_generation_template(
|
||||
self,
|
||||
prompt: str,
|
||||
*,
|
||||
has_reference_image: bool = False,
|
||||
) -> str:
|
||||
if prompt.startswith("<role>SYSTEM</role>"):
|
||||
return prompt
|
||||
# Ming-Image uses a fixed single-turn template, so build it directly here
|
||||
image_prefix = PLACEHOLDER_IMAGE_TOKEN_IN_TEXT if has_reference_image else ""
|
||||
eos = self.tokenizer.eos_token
|
||||
return SYSTEM_PROMPT_NOTHINK + eos + USER_PREFIX + image_prefix + prompt + eos + ASSISTANT_PREFIX
|
||||
|
||||
def batch_decode(self, *args, **kwargs):
|
||||
return self.tokenizer.batch_decode(*args, **kwargs)
|
||||
|
||||
|
||||
Reference in new issue
Block a user