Skip to content

Commit 4e918f8

Browse files
eladvenelronbandel
andauthored
Add general formatter for chat api, with chat template based (#1728)
Add general formatter for chat api, with chat template based on the model tokenizer The model_name should be overried at runtime (e.g. chat_api_with_tokenizer_chat_template[model_name=ibm-granite/granite-3.1-2b-instruct]) Currently, we already have HFSystemFormat based formats (formats.models.llava_interleave) which may be used in the same why. But since the name is very confusing, I add this format). Co-authored-by: Elron Bandel <elronbandel@gmail.com>
1 parent 1ab791d commit 4e918f8

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from unitxt import add_to_catalog
2+
from unitxt.formats import HFSystemFormat
3+
4+
format = HFSystemFormat(model_name="ibm-granite/granite-3.1-2b-instruct")
5+
6+
add_to_catalog(format, "formats.chat_api_with_tokenizer_chat_template", overwrite=True)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"__type__": "hf_system_format",
3+
"model_name": "ibm-granite/granite-3.1-2b-instruct"
4+
}

0 commit comments

Comments
 (0)