Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

cannot load all 22k_models #125

Open
Nise-2-meet-U opened this issue Sep 13, 2022 · 2 comments
Open

cannot load all 22k_models #125

Nise-2-meet-U opened this issue Sep 13, 2022 · 2 comments

Comments

@Nise-2-meet-U
Copy link

C:\ProgramData\Anaconda3\envs\yolo\python.exe G:/nft/code/inference.py
Traceback (most recent call last):
File "G:/nft/code/inference.py", line 37, in
model = con.convnext_xlarge(pretrained=True, in_22k=True)
File "G:\nft\code\convnext.py", line 211, in convnext_xlarge
model.load_state_dict(checkpoint["model"])
File "C:\ProgramData\Anaconda3\envs\yolo\lib\site-packages\torch\nn\modules\module.py", line 1482, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ConvNeXt:
size mismatch for head.weight: copying a param with shape torch.Size([21841, 2048]) from checkpoint, the shape in current model is torch.Size([1000, 2048]).
size mismatch for head.bias: copying a param with shape torch.Size([21841]) from checkpoint, the shape in current model is torch.Size([1000]).

@theguardsgod
Copy link

u need to modify num_classes=21841

@kalelpark
Copy link

model = convnext_base(pretrained = True, in_22k = True, num_classes=21841)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants