"use_timm_backbone": false,

#12
by wangchengfei - opened

I set use_timm_backbone to false in config.json. How do I load the locally downloaded resnet18? What configuration should I use?

image.png

Microsoft org

Hi,

You could try the following?

from transformers import TableTransformerForObjectDetection

model = TableTransformerForObjectDetection.from_pretrained("microsoft/table-transformer-detection", revision="no_timm")

Thank you for your reply. Now I have encountered a new problem.

I encountered an issue while running jupyter notebook. There is a dependency on resnet18 in the Microsoft/table-transformer-detection configuration, but I failed to download using the third-party Python library timm. Do you have any method to make table transformer detection load the local resnet18 configuration?

image.png

Microsoft org

Do you mean that you have trained a ResNet-18 yourself, which you would like to use as backbone together with this model?

Do you mean that you have trained a ResNet-18 yourself, which you would like to use as backbone together with this model?

Yes, I have my ResNet-18 network (with attention added), and I would like to try this feature extraction method.
But there was an issue when configuring the local model.

I can load the model normally by setting "use_pretrained_backbone":false in the config.json file in microsoft/table-transformer-detection, but if I set this field to true, the following problem will occur
huggingface_hub.utils._errors.LocalEntryNotFoundError: Connection error, and we cannot find the requested files in the disk cache. Please try again or make sure your Internet connection is on.

The way I load the Microsoft/table-transformer-detection model is to load it locally, but this backbone load still needs to be downloaded online. If I download ResNet18, how can I configure it to load locally as well?

add

kwargs['pretrained_cfg_overlay'] = dict(file = "{yourpath}\res18\resnet18.bin")

to function resnet18(pretrained: bool = False, **kwargs) -> ResNet which in ~/anaconda3/lib/python3.9/site-packages/timm/models/resnet.py

Sign up or log in to comment