Skip to content

No EOS token? #1

@SmartWashingMachine

Description

@SmartWashingMachine

Hi, thanks for the example. But is this part right?

            caption = item["text"]
            messages = [{"role": "user", "content": self.task_prompt}]
            text_prompt = self.processor.apply_chat_template(
                messages,
                tokenize=False,
                add_generation_prompt=True
            )
            full_text = text_prompt + caption

If we print out the full_text we get:
<|begin_of_sentence|>User: <|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>OCR: Assistant: 素直にあやまるしかあやまるわよ!

But no <|end_of_sentence|> token? So model would learn to repeat tokens indefinitely?

Looking at their chat template it seems that <|end_of_sentence|> was not added because there's no assistant role message.

So maybe we need this instead:

                messages = [{"role": "user", "content": self.task_prompt}, {"role": "assistant", "content": caption, }]
                text_prompt = self.processor.apply_chat_template(
                    messages,
                    tokenize=False,
                    add_generation_prompt=False
                )
                full_text = text_prompt

Which prints:
<|begin_of_sentence|>User: <|IMAGE_START|><|IMAGE_PLACEHOLDER|><|IMAGE_END|>OCR: Assistant: 素直にあやまるしかあやまるわよ!<|end_of_sentence|>

Thank you again for this example. It is very helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions