-
Notifications
You must be signed in to change notification settings - Fork 66
feat: allow specifying the chat template as base64 to avoid weird escaping and templating issues #534
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
Merged
dushyantbehl
merged 1 commit into
foundation-model-stack:main
from
HarikrishnanBalagopal:feat/chattemplatebase64
Apr 28, 2025
Merged
feat: allow specifying the chat template as base64 to avoid weird escaping and templating issues #534
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
tests/artifacts/predefined_data_configs/granite_3_1b_chat_template.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| {%- if messages[0]['role'] == 'system' %} | ||
| {%- set system_message = messages[0]['content'] %} | ||
| {%- set loop_messages = messages[1:] %} | ||
| {%- else %} | ||
| {%- set system_message = "Knowledge Cutoff Date: April 2024.\nToday's Date: " + strftime_now('%B %d, %Y') + ".\nYou are Granite, developed by IBM." %} | ||
| {%- if tools and documents %} | ||
| {%- set system_message = system_message + " You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.\n\nWrite the response to the user's input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data." %} | ||
| {%- elif tools %} | ||
| {%- set system_message = system_message + " You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request." %} | ||
| {%- elif documents %} | ||
| {%- set system_message = system_message + " Write the response to the user's input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data." %} | ||
| {%- else %} | ||
| {%- set system_message = system_message + " You are a helpful AI assistant." %} | ||
| {%- endif %} | ||
| {%- if 'citations' in controls and documents %} | ||
| {%- set system_message = system_message + '\n\nIn your response, use the symbols <co> and </co> to indicate when a fact comes from a document in the search result, e.g <co>0</co> for a fact from document 0. Afterwards, list all the citations with their corresponding documents in an ordered list.' %} | ||
| {%- endif %} | ||
| {%- if 'hallucinations' in controls and documents %} | ||
| {%- set system_message = system_message + '\n\nFinally, after the response is written, include a numbered list of sentences from the response that are potentially hallucinated and not based in the documents.' %} | ||
| {%- endif %} | ||
| {%- set loop_messages = messages %} | ||
| {%- endif %} | ||
| {{- '<|start_of_role|>system<|end_of_role|>' + system_message + '<|end_of_text|>\n' }} | ||
| {%- if tools %} | ||
| {{- '<|start_of_role|>tools<|end_of_role|>' }} | ||
| {{- tools | tojson(indent=4) }} | ||
| {{- '<|end_of_text|>\n' }} | ||
| {%- endif %} | ||
| {%- if documents %} | ||
| {{- '<|start_of_role|>documents<|end_of_role|>' }} | ||
| {%- for document in documents %} | ||
| {{- 'Document ' + loop.index0 | string + '\n' }} | ||
| {{- document['text'] }} | ||
| {%- if not loop.last %} | ||
| {{- '\n\n'}} | ||
| {%- endif%} | ||
| {%- endfor %} | ||
| {{- '<|end_of_text|>\n' }} | ||
| {%- endif %} | ||
| {%- for message in loop_messages %} | ||
| {{- '<|start_of_role|>' + message['role'] + '<|end_of_role|>' + message['content'] + '<|end_of_text|>\n' }} | ||
| {%- if loop.last and add_generation_prompt %} | ||
| {{- '<|start_of_role|>assistant' }} | ||
| {%- if controls %} | ||
| {{- ' ' + controls | tojson()}} | ||
| {%- endif %} | ||
| {{- '<|end_of_role|>' }} | ||
| {%- endif %} | ||
| {%- endfor %} |
34 changes: 34 additions & 0 deletions
34
tests/artifacts/predefined_data_configs/granite_3_1b_invalid_base64_data_handler.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| dataprocessor: | ||
| type: default | ||
| chat_template_base64: 'dsaeyUtIGlmIG1lc3NhZ2VzWzBdWydyb2xlJ10gPT0gJ3N5c3RlbScgJX0KICAgIHslLSBzZXQgc3lzdGVtX21lc3NhZ2UgPSBtZXNzYWdlc1swXVsnY29udGVudCddICV9CiAgICB7JS0gc2V0IGxvb3BfbWVzc2FnZXMgPSBtZXNzYWdlc1sxOl0gJX0KeyUtIGVsc2UgJX0KICAgIHslLSBzZXQgc3lzdGVtX21lc3NhZ2UgPSAiS25vd2xlZGdlIEN1dG9mZiBEYXRlOiBBcHJpbCAyMDI0LlxuVG9kYXkncyBEYXRlOiAiICsgc3RyZnRpbWVfbm93KCclQiAlZCwgJVknKSArICIuXG5Zb3UgYXJlIEdyYW5pdGUsIGRldmVsb3BlZCBieSBJQk0uIiAlfQogICAgeyUtIGlmIHRvb2xzIGFuZCBkb2N1bWVudHMgJX0KICAgICAgICB7JS0gc2V0IHN5c3RlbV9tZXNzYWdlID0gc3lzdGVtX21lc3NhZ2UgKyAiIFlvdSBhcmUgYSBoZWxwZnVsIEFJIGFzc2lzdGFudCB3aXRoIGFjY2VzcyB0byB0aGUgZm9sbG93aW5nIHRvb2xzLiBXaGVuIGEgdG9vbCBpcyByZXF1aXJlZCB0byBhbnN3ZXIgdGhlIHVzZXIncyBxdWVyeSwgcmVzcG9uZCB3aXRoIDx8dG9vbF9jYWxsfD4gZm9sbG93ZWQgYnkgYSBKU09OIGxpc3Qgb2YgdG9vbHMgdXNlZC4gSWYgYSB0b29sIGRv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H19CiAgICAgICAgeyUtIGlmIG5vdCBsb29wLmxhc3QgJX0KICAgICAgICAgICAge3stICdcblxuJ319CiAgICAgICAgeyUtIGVuZGlmJX0KICAgIHslLSBlbmRmb3IgJX0KICAgIHt7LSAnPHxlbmRfb2ZfdGV4dHw+XG4nIH19CnslLSBlbmRpZiAlfQp7JS0gZm9yIG1lc3NhZ2UgaW4gbG9vcF9tZXNzYWdlcyAlfQogICAge3stICc8fHN0YXJ0X29mX3JvbGV8PicgKyBtZXNzYWdlWydyb2xlJ10gKyAnPHxlbmRfb2Zfcm9sZXw+JyArIG1lc3NhZ2VbJ2NvbnRlbnQnXSArICc8fGVuZF9vZl90ZXh0fD5cbicgfX0KICAgIHslLSBpZiBsb29wLmxhc3QgYW5kIGFkZF9nZW5lcmF0aW9uX3Byb21wdCAlfQogICAgICAgIHt7LSAnPHxzdGFydF9vZl9yb2xlfD5hc3Npc3RhbnQnIH19CiAgICAgICAgICAgIHslLSBpZiBjb250cm9scyAlfQogICAgICAgICAgICAgICAge3stICcgJyArIGNvbnRyb2xzIHwgdG9qc29uKCl9fQogICAgICAgICAgICB7JS0gZW5kaWYgJX0KICAgICAgICB7ey0gJzx8ZW5kX29mX3JvbGV8PicgfX0KICAgIHslLSBlbmRpZiAlfQp7JS0gZW5kZm9yICV9Cg==' | ||
| datasets: | ||
| - name: dataset_1 | ||
| data_paths: | ||
| - "FILE_PATH" | ||
| data_handlers: | ||
| - name: tokenize_and_apply_chat_template_with_masking | ||
| arguments: | ||
| remove_columns: all | ||
| fn_kwargs: | ||
| max_seq_length: 1024 | ||
| conversation_column: "messages" | ||
| - name: dataset_2 | ||
| data_paths: | ||
| - "FILE_PATH" | ||
| data_handlers: | ||
| - name: tokenize_and_apply_chat_template_with_masking | ||
| arguments: | ||
| remove_columns: all | ||
| fn_kwargs: | ||
| max_seq_length: 1024 | ||
| conversation_column: "messages" | ||
| - name: dataset_3 | ||
| data_paths: | ||
| - "FILE_PATH" | ||
| data_handlers: | ||
| - name: tokenize_and_apply_chat_template_with_masking | ||
| arguments: | ||
| remove_columns: all | ||
| fn_kwargs: | ||
| max_seq_length: 1024 | ||
| conversation_column: "messages" |
34 changes: 34 additions & 0 deletions
34
tests/artifacts/predefined_data_configs/granite_3_1b_valid_base64_data_handler.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| dataprocessor: | ||
| type: default | ||
| chat_template_base64: 'eyUtIGlmIG1lc3NhZ2VzWzBdWydyb2xlJ10gPT0gJ3N5c3RlbScgJX0KICAgIHslLSBzZXQgc3lzdGVtX21lc3NhZ2UgPSBtZXNzYWdlc1swXVsnY29udGVudCddICV9CiAgICB7JS0gc2V0IGxvb3BfbWVzc2FnZXMgPSBtZXNzYWdlc1sxOl0gJX0KeyUtIGVsc2UgJX0KICAgIHslLSBzZXQgc3lzdGVtX21lc3NhZ2UgPSAiS25vd2xlZGdlIEN1dG9mZiBEYXRlOiBBcHJpbCAyMDI0LlxuVG9kYXkncyBEYXRlOiAiICsgc3RyZnRpbWVfbm93KCclQiAlZCwgJVknKSArICIuXG5Zb3UgYXJlIEdyYW5pdGUsIGRldmVsb3BlZCBieSBJQk0uIiAlfQogICAgeyUtIGlmIHRvb2xzIGFuZCBkb2N1bWVudHMgJX0KICAgICAgICB7JS0gc2V0IHN5c3RlbV9tZXNzYWdlID0gc3lzdGVtX21lc3NhZ2UgKyAiIFlvdSBhcmUgYSBoZWxwZnVsIEFJIGFzc2lzdGFudCB3aXRoIGFjY2VzcyB0byB0aGUgZm9sbG93aW5nIHRvb2xzLiBXaGVuIGEgdG9vbCBpcyByZXF1aXJlZCB0byBhbnN3ZXIgdGhlIHVzZXIncyBxdWVyeSwgcmVzcG9uZCB3aXRoIDx8dG9vbF9jYWxsfD4gZm9sbG93ZWQgYnkgYSBKU09OIGxpc3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yB9fQogICAgICAgIHt7LSBkb2N1bWVudFsndGV4dCddIH19CiAgICAgICAgeyUtIGlmIG5vdCBsb29wLmxhc3QgJX0KICAgICAgICAgICAge3stICdcblxuJ319CiAgICAgICAgeyUtIGVuZGlmJX0KICAgIHslLSBlbmRmb3IgJX0KICAgIHt7LSAnPHxlbmRfb2ZfdGV4dHw+XG4nIH19CnslLSBlbmRpZiAlfQp7JS0gZm9yIG1lc3NhZ2UgaW4gbG9vcF9tZXNzYWdlcyAlfQogICAge3stICc8fHN0YXJ0X29mX3JvbGV8PicgKyBtZXNzYWdlWydyb2xlJ10gKyAnPHxlbmRfb2Zfcm9sZXw+JyArIG1lc3NhZ2VbJ2NvbnRlbnQnXSArICc8fGVuZF9vZl90ZXh0fD5cbicgfX0KICAgIHslLSBpZiBsb29wLmxhc3QgYW5kIGFkZF9nZW5lcmF0aW9uX3Byb21wdCAlfQogICAgICAgIHt7LSAnPHxzdGFydF9vZl9yb2xlfD5hc3Npc3RhbnQnIH19CiAgICAgICAgICAgIHslLSBpZiBjb250cm9scyAlfQogICAgICAgICAgICAgICAge3stICcgJyArIGNvbnRyb2xzIHwgdG9qc29uKCl9fQogICAgICAgICAgICB7JS0gZW5kaWYgJX0KICAgICAgICB7ey0gJzx8ZW5kX29mX3JvbGV8PicgfX0KICAgIHslLSBlbmRpZiAlfQp7JS0gZW5kZm9yICV9Cg==' | ||
| datasets: | ||
| - name: dataset_1 | ||
| data_paths: | ||
| - "FILE_PATH" | ||
| data_handlers: | ||
| - name: tokenize_and_apply_chat_template_with_masking | ||
| arguments: | ||
| remove_columns: all | ||
| fn_kwargs: | ||
| max_seq_length: 1024 | ||
| conversation_column: "messages" | ||
| - name: dataset_2 | ||
| data_paths: | ||
| - "FILE_PATH" | ||
| data_handlers: | ||
| - name: tokenize_and_apply_chat_template_with_masking | ||
| arguments: | ||
| remove_columns: all | ||
| fn_kwargs: | ||
| max_seq_length: 1024 | ||
| conversation_column: "messages" | ||
| - name: dataset_3 | ||
| data_paths: | ||
| - "FILE_PATH" | ||
| data_handlers: | ||
| - name: tokenize_and_apply_chat_template_with_masking | ||
| arguments: | ||
| remove_columns: all | ||
| fn_kwargs: | ||
| max_seq_length: 1024 | ||
| conversation_column: "messages" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should also look to print the chat tempalte along side the warning...what was decoded one so users know what was picked up.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok but if it's not a string then we can't decode it right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add that post the warning that you have picked this chat template at that place it will be a
strdue to assertion