You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
My own task or dataset (give details below)
Reproduction
I'm fine-tuning the SamModel and using the fine-tuned model in a mask-generation pipeline afterward.
After some time in the training, I suddenly get the following error when using the fine-tuned model in the pipeline:
Traceback (most recent call last):
File "***.py", line 17, in <module>
outputs = generator(image)
^^^^^^^^^^^^^^^^
File "transformers\pipelines\mask_generation.py", line 166, in __call__
return super().__call__(image, *args, num_workers=num_workers, batch_size=batch_size, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "transformers\pipelines\base.py", line 1354, in __call__
return next(
^^^^^
File "transformers\pipelines\pt_utils.py", line 124, in __next__
item = next(self.iterator)
^^^^^^^^^^^^^^^^^^^
File "transformers\pipelines\pt_utils.py", line 269, in __next__
processed = self.infer(next(self.iterator), **self.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "transformers\pipelines\base.py", line 1269, in forward
model_outputs = self._forward(model_inputs, **forward_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "transformers\pipelines\mask_generation.py", line 237, in _forward
masks, iou_scores, boxes = self.image_processor.filter_masks(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "transformers\models\sam\image_processing_sam.py", line 847, in filter_masks
return self._filter_masks_pt(
^^^^^^^^^^^^^^^^^^^^^^
File "transformers\models\sam\image_processing_sam.py", line 945, in _filter_masks_pt
masks = _mask_to_rle_pytorch(masks)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "transformers\models\sam\image_processing_sam.py", line 1386, in _mask_to_rle_pytorch
counts += [cur_idxs[0].item()] + btw_idxs.tolist() + [height * width - cur_idxs[-1]]
~~~~~~~~^^^
IndexError: index 0 is out of bounds for dimension 0 with size 0
Note: this error doesn't occur on every image, but just on some.
System Info
transformers
version: 4.49.0.dev0Who can help?
@ArthurZucker
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
I'm fine-tuning the SamModel and using the fine-tuned model in a mask-generation pipeline afterward.
After some time in the training, I suddenly get the following error when using the fine-tuned model in the pipeline:
Note: this error doesn't occur on every image, but just on some.
Code used to produce error:
Expected behavior
No error should be thrown and the RLE should be computed correctly.
The text was updated successfully, but these errors were encountered: