22from transformers import AutoTokenizer
33from ..llm .static_scheduler import StaticSchedulerOutput
44from ..llm .scheduler import SchedulerOutput
5- from typing import override
5+ from typing_extensions import override
66
77
88@register_processor ("default" )
@@ -27,7 +27,9 @@ def __call__(self, prompt: str, return_tensors: str = None, **kwargs) -> dict:
2727 import infinicore
2828
2929 result = {}
30- for key , tensor in self .tokenizer (prompt , return_tensors = "pt" , add_special_tokens = False ).items ():
30+ for key , tensor in self .tokenizer (
31+ prompt , return_tensors = "pt" , add_special_tokens = False
32+ ).items ():
3133 result [key ] = tensor .from_torch (tensor )
3234 return result
3335
@@ -45,9 +47,13 @@ def apply_chat_template(
4547 normalized_conversation = []
4648 for message in conversation :
4749 if isinstance (message ["content" ], list ):
48- assert len (message ["content" ]) == 1 , "Only one content item supported in list"
50+ assert len (message ["content" ]) == 1 , (
51+ "Only one content item supported in list"
52+ )
4953 content_item = message ["content" ][0 ]
50- assert "type" in content_item and "text" in content_item , "Content dict must have 'type' and 'text' keys"
54+ assert "type" in content_item and "text" in content_item , (
55+ "Content dict must have 'type' and 'text' keys"
56+ )
5157 normalized_conversation .append (
5258 {"role" : message ["role" ], "content" : content_item ["text" ]}
5359 )
0 commit comments