@@ -784,7 +784,7 @@ def data_collator(self, batch: List[Dict[str, Any]], padding_to: Optional[int] =
784784 ['<|im_end|>' ], INTERNLM_SYSTEM , ['<s><|im_start|>system\n {{SYSTEM}}<|im_end|>\n ' ]))
785785
786786
787- def replace_img_tab (query : str , history : History , replace_token : str ) -> Tuple [str , History , List [str ]]:
787+ def replace_img_tag (query : str , history : History , replace_token : str ) -> Tuple [str , History , List [str ]]:
788788 images_path = []
789789 pattern = r'<img>(.+?)</img>'
790790 new_history = []
@@ -818,7 +818,7 @@ def encode(self, example: Dict[str, Any]) -> Tuple[Dict[str, Any], Dict[str, Any
818818 history = example .pop ('history' , None )
819819 if history is None :
820820 history = []
821- example ['query' ], example ['history' ], images_path = replace_img_tab (example ['query' ], history , '</s>' )
821+ example ['query' ], example ['history' ], images_path = replace_img_tag (example ['query' ], history , '</s>' )
822822
823823 images = []
824824 dtype = self .model .dtype
@@ -1122,7 +1122,7 @@ def encode(self, example: Dict[str, Any]) -> Tuple[Dict[str, Any], Dict[str, Any
11221122 history = example .pop ('history' , None )
11231123 if history is None :
11241124 history = []
1125- example ['query' ], example ['history' ], images_path = replace_img_tab (example ['query' ], history , '<s>' )
1125+ example ['query' ], example ['history' ], images_path = replace_img_tag (example ['query' ], history , '<s>' )
11261126 images = []
11271127 for image_path in images_path :
11281128 image = _read_from_path (image_path )
@@ -1230,7 +1230,7 @@ def encode(self, example: Dict[str, Any]) -> Tuple[Dict[str, Any], Dict[str, Any
12301230 history = example .pop ('history' , None )
12311231 if history is None :
12321232 history = []
1233- example ['query' ], example ['history' ], images_path = replace_img_tab (example ['query' ], history ,
1233+ example ['query' ], example ['history' ], images_path = replace_img_tag (example ['query' ], history ,
12341234 '<image_placeholder>' )
12351235
12361236 inputs , _ = super ().encode (example )
0 commit comments