Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintao-Huang committed Dec 24, 2024
1 parent cb8d2bb commit 44e793d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/train/multimodal/ocr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ swift sft \
--max_length 2048 \
--output_dir output \
--warmup_ratio 0.05 \
--dataloader_num_workers 4
--dataloader_num_workers 4
6 changes: 4 additions & 2 deletions swift/llm/template/template/qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,12 @@ def _encode(self, inputs: StdTemplateInputs) -> Dict[str, Any]:
if locals()[media_type]:
if media_type == 'images':
media_token = self.image_token_id
media_inputs = processor.image_processor(images=images, videos=None, return_tensors='pt')
media_inputs = processor.image_processor(
images=images, videos=None, return_tensors='pt', do_rescale=False)
media_grid_thw = media_inputs['image_grid_thw']
else:
media_inputs = processor.image_processor(images=None, videos=videos, return_tensors='pt')
media_inputs = processor.image_processor(
images=None, videos=videos, return_tensors='pt', do_rescale=False)
media_grid_thw = media_inputs['video_grid_thw']
media_token = self.video_token_id
idx_list = findall(input_ids, media_token)
Expand Down

0 comments on commit 44e793d

Please sign in to comment.