Skip to content

Commit e73c5e2

Browse files
fix (#1811)
1 parent 0867c1d commit e73c5e2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

swift/llm/utils/argument.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,14 @@ def _check_path(cls,
8080
value = res
8181
return value
8282

83-
@staticmethod
84-
def _is_multimodal(model_type: Optional[str] = None) -> bool:
83+
def _is_multimodal(self, model_type: Optional[str] = None) -> bool:
8584
if model_type is None:
8685
return False
8786
model_info = MODEL_MAPPING[model_type]
8887
tags = model_info.get('tags') or []
8988
return 'multi-modal' in tags
9089

91-
@staticmethod
92-
def _is_vision(model_type: Optional[str] = None) -> bool:
90+
def _is_vision(self, model_type: Optional[str] = None) -> bool:
9391
if model_type is None:
9492
return False
9593
model_info = MODEL_MAPPING[model_type]
@@ -1590,6 +1588,12 @@ def handle_infer_backend(self) -> None:
15901588
if self.eval_url is None:
15911589
super().handle_infer_backend()
15921590

1591+
def _is_multimodal(self, model_type: Optional[str] = None) -> bool:
1592+
return False
1593+
1594+
def _is_vision(self, model_type: Optional[str] = None) -> bool:
1595+
return False
1596+
15931597

15941598
@dataclass
15951599
class ExportArguments(InferArguments):

swift/llm/utils/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ def __iter__(self):
236236
sequences = []
237237
for example in buffer:
238238
input, _ = self.template.encode(example)
239+
if not input:
240+
continue
239241
sequences.append((input, len(input['input_ids'])))
240242

241243
packed_sequences = self.calculate_matched_group(sequences)

0 commit comments

Comments
 (0)