When I was in the local fine-tuning model (https://huggingface.co/learn/computer-vision-course/unit3/vision-transformers/vision-transformer-for-objectio N - detection), I downloaded the original model (facebook/detr - resnet - 50 - dc5) to a local, but in training part of the code (
model = AutoModelForObjectDetection. From_pretrained (
checkpoint,
id2label=id2label,
label2id=label2id,
ignore_mismatched_sizes=True,
)
),It prompts information:INFO:timm.models._builder:Loading pretrained weights from Hugging Face hub (timm/resnet50.a1_in1k),and then prompts error:
LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.
So I downloaded the entire timm/resnet50.a1_in1k model locally, but I tried a lot of methods that didn’t work, such as this one:> checkpoint = “…/models/bert-res”
resnet50_model = timm.create_model(‘resnet50’, pretrained=False)
state_dict = torch.load(‘…/models/resnet50/pytorch_model.bin’, map_location=‘cpu’)
resnet50_model.load_state_dict(state_dict)config = AutoConfig.from_pretrained(checkpoint)
model_detr = AutoModelForObjectDetection.from_pretrained(
checkpoint,
config=config,
id2label=id2label,
label2id=label2id,
ignore_mismatched_sizes=True
)model_detr.backbone = resnet50_model
and still has an error:Please provide either the path to a local folder or the repo_id of a model on the Hub.
so,how should i handle this error