Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tastelikefeet committed Aug 23, 2024
1 parent 0867c1d commit e73c5e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions swift/llm/utils/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,14 @@ def _check_path(cls,
value = res
return value

@staticmethod
def _is_multimodal(model_type: Optional[str] = None) -> bool:
def _is_multimodal(self, model_type: Optional[str] = None) -> bool:
if model_type is None:
return False
model_info = MODEL_MAPPING[model_type]
tags = model_info.get('tags') or []
return 'multi-modal' in tags

@staticmethod
def _is_vision(model_type: Optional[str] = None) -> bool:
def _is_vision(self, model_type: Optional[str] = None) -> bool:
if model_type is None:
return False
model_info = MODEL_MAPPING[model_type]
Expand Down Expand Up @@ -1590,6 +1588,12 @@ def handle_infer_backend(self) -> None:
if self.eval_url is None:
super().handle_infer_backend()

def _is_multimodal(self, model_type: Optional[str] = None) -> bool:
return False

def _is_vision(self, model_type: Optional[str] = None) -> bool:
return False


@dataclass
class ExportArguments(InferArguments):
Expand Down
2 changes: 2 additions & 0 deletions swift/llm/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ def __iter__(self):
sequences = []
for example in buffer:
input, _ = self.template.encode(example)
if not input:
continue
sequences.append((input, len(input['input_ids'])))

packed_sequences = self.calculate_matched_group(sequences)
Expand Down

0 comments on commit e73c5e2

Please sign in to comment.