Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/chatml add system message #1117

Merged
merged 4 commits into from
Jan 25, 2024
Merged

Conversation

mhenrichsen
Copy link
Collaborator

Need ideas on how to change the default system message in the prompter.

@mhenrichsen
Copy link
Collaborator Author

register_conv_template(
    Conversation(
        name="chatml",
        system_template="<|im_start|>system\n{system_message}",
        system_message="You are a helpful assistant.",
        roles=["<|im_start|>user", "<|im_start|>assistant"],
        sep_style=SeparatorStyle.CHATML,
        sep="<|im_end|>",
    )
)

I need help finding a way to change this system_message here, and possibly in all other prompt formats.

@winglian
Copy link
Collaborator

winglian commented Jan 14, 2024

@mhenrichsen one option would be in the cli/train.py and cli.preprocess.py to add a call to register the chatml template with the default system message like register_chatml_template(system_message=cfg.default_system_message)

in sharegpt.py wrap the register_conv_template call with :

def register_chatml_template(system_message=None):
    system_message = system_message or "You are a helpful assistant."
    register_conv_template(
        Conversation(
            name="chatml",
            system_template="<|im_start|>system\n{system_message}",
            system_message=system_message,
            roles=["<|im_start|>user", "<|im_start|>assistant"],
            sep_style=SeparatorStyle.CHATML,
            sep="<|im_end|>",
        )
    )
)

@winglian winglian force-pushed the feat/chatml-add-system-message branch from 15242bd to f5fd1c6 Compare January 25, 2024 04:43
@winglian winglian marked this pull request as ready for review January 25, 2024 04:43
@mhenrichsen mhenrichsen changed the title Draft: Feat/chatml add system message Feat/chatml add system message Jan 25, 2024
@mhenrichsen
Copy link
Collaborator Author

thanks for the fixes @winglian
I had totally forgotten about this :)

@mhenrichsen mhenrichsen merged commit 98b4762 into main Jan 25, 2024
7 checks passed
@winglian winglian deleted the feat/chatml-add-system-message branch January 25, 2024 12:05
djsaunde pushed a commit that referenced this pull request Dec 17, 2024
* add system message to template

* readme update

* added code to register new system message

* register chatml template for test

---------

Co-authored-by: Mads Henrichsen <mads@BrbartiendeMads.lan>
Co-authored-by: Wing Lian <wing.lian@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants