Open f-fuchs opened 1 month ago
Hi @f-fuchs, thanks for raising this!
Yes, this is definitely not something we want. Unfortunately, this seems to be coming from timm
itself:
In [16]: import timm
In [17]: model = timm.create_model(
...: 'eva02_base_patch14_224.mim_in22k',
...: pretrained=True,
...: features_only=True,
...: in_chans=1,
...: out_indices=[3, 5, 7, 11]
...: )
In [18]: model.feature_info.out_indices
Out[18]: (11, 3, 5, 7)
@rwightman What's the best / recommended way to get the indices according to the order they're returned in timm?
@amyeroberts @f-fuchs oh fudge, I see the issue, I used sets to resolve the indices and they don't keep the order, unlike dicts (really wish they'd updated sets when they updated dicts for consistent order).
Anyways, I'll fix this ASAP, but it's worth noting that ONLY the info is out of order, the features are returned in order of layer iteration so they will be correct...
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
System Info
transformers
version: 4.42.4Who can help?
@amyeroberts
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Expected behavior
The could should load the model correctly.
I think this line
if positive_indices != tuple(sorted(positive_indices)):
(https://github.com/huggingface/transformers/blame/main/src/transformers/utils/backbone_utils.py#L64) is the problem andsorted
should be replaced by human/natural sorting.