cannot import name 'rgb_to_id'
I am getting this error on Pytorch 1.13 Python 3.9
ImportError Traceback (most recent call last)
in
1 from transformers import DetrFeatureExtractor, DetrForSegmentation
----> 2 from transformers.models.detr.feature_extraction_detr import rgb_to_id
ImportError: cannot import name 'rgb_to_id' from 'transformers.models.detr.feature_extraction_detr' (/opt/conda/lib/python3.9/site-packages/transformers/models/detr/feature_extraction_detr.py)
Any idea why?
@payamahv
Thanks for flagging this - this is coming from the deprecation of the feature extractors for vision models which resulted in this function being moved. I'll open a PR to fix this. In the meantime, you can import rgb_to_id
now from the image_transforms
module:
from transformers.image_transforms import rgb_to_id
@payamahv A PR has now been merged into main which resolves this: https://github.com/huggingface/transformers/pull/27037.