-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't load pretrained models anymore #239
Comments
It looks like the version bump came from @pvallance - do you have any input on what the best approach here is? |
huggingface/pytorch-image-models#2150 These references got me one step closer (past the above error). I adjusted the Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/train.py", line 135, in <module>
my_model = train_mymodel()
^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/train.py", line 127, in train_sigclr
model = MyModel()
File "/mymodel.py", line 28, in __init__
self.encoder = Encoder()
^^^^^^^^^^^^^^^^^^^
File "/encoder.py", line 8, in __init__
self.convnet = efficientnet_b4(pretrained=pretrained, path=path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/torchsig/models/iq_models/efficientnet/efficientnet.py", line 276, in efficientnet_b4
timm.create_model(
File "/.venv/lib/python3.11/site-packages/timm/models/_factory.py", line 117, in create_model
model = create_fn(
^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 1913, in efficientnet_b4
model = _gen_efficientnet(
^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 651, in _gen_efficientnet
model = _create_effnet(variant, pretrained, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 368, in _create_effnet
model = build_model_with_cfg(
^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/_builder.py", line 418, in build_model_with_cfg
load_pretrained(
File "/.venv/lib/python3.11/site-packages/timm/models/_builder.py", line 215, in load_pretrained
state_dict[weight_name] = adapt_input_conv(in_chans, state_dict[weight_name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/_manipulate.py", line 259, in adapt_input_conv
O, I, J, K = conv_weight.shape
^^^^^^^^^^
ValueError: not enough values to unpack (expected 4, got 3) |
The default efficientnets from timm are 2D. We have utilities for converting these models to 1D (typically used for the narrowband datasets). It looks like you might be trying to load the weights of a 1D network into a 2D model. Could you pass along your script snippets that are using torchsig and/or the datasets?
Phil Vallance
RF Research Team
(240) 373-6289
…________________________________
From: Phillip Vallance
Sent: Saturday, July 13, 2024 12:25:54 PM
To: TorchDSP/torchsig; TorchDSP/torchsig
Cc: Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
Nicholas,
Are you using the 1-D efficientnet from torchsig?
Phil Vallance
RF Research Team
(240) 373-6289
________________________________
From: Nicholas Bruce ***@***.***>
Sent: Friday, July 12, 2024 7:55:09 PM
To: TorchDSP/torchsig
Cc: Phillip Vallance; Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
huggingface/pytorch-image-models#2150<huggingface/pytorch-image-models#2150>
huggingface/pytorch-image-models#2215<huggingface/pytorch-image-models#2215>
https://huggingface.co/timm/swinv2_tiny_window16_256.ms_in1k/discussions/1
These references got me one step closer (past the above error). I adjusted the timm.create_model() calls in efficientnet.py. I'm now getting the following (related) error:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/train.py", line 135, in <module>
my_model = train_mymodel()
^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/train.py", line 127, in train_sigclr
model = MyModel()
File "/mymodel.py", line 28, in __init__
self.encoder = Encoder()
^^^^^^^^^^^^^^^^^^^
File "/encoder.py", line 8, in __init__
self.convnet = efficientnet_b4(pretrained=pretrained, path=path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/torchsig/models/iq_models/efficientnet/efficientnet.py", line 276, in efficientnet_b4
timm.create_model(
File "/.venv/lib/python3.11/site-packages/timm/models/_factory.py", line 117, in create_model
model = create_fn(
^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 1913, in efficientnet_b4
model = _gen_efficientnet(
^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 651, in _gen_efficientnet
model = _create_effnet(variant, pretrained, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 368, in _create_effnet
model = build_model_with_cfg(
^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/_builder.py", line 418, in build_model_with_cfg
load_pretrained(
File "/.venv/lib/python3.11/site-packages/timm/models/_builder.py", line 215, in load_pretrained
state_dict[weight_name] = adapt_input_conv(in_chans, state_dict[weight_name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/_manipulate.py", line 259, in adapt_input_conv
O, I, J, K = conv_weight.shape
^^^^^^^^^^
ValueError: not enough values to unpack (expected 4, got 3)
—
Reply to this email directly, view it on GitHub<#239 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUN3HRQZU4GO52C7QYQNCTDZMBUF3AVCNFSM6AAAAABKZVB5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRWGU2DCNJYGA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Nicholas,
Are you using the 1-D efficientnet from torchsig?
Phil Vallance
RF Research Team
(240) 373-6289
…________________________________
From: Nicholas Bruce ***@***.***>
Sent: Friday, July 12, 2024 7:55:09 PM
To: TorchDSP/torchsig
Cc: Phillip Vallance; Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
huggingface/pytorch-image-models#2150<huggingface/pytorch-image-models#2150>
huggingface/pytorch-image-models#2215<huggingface/pytorch-image-models#2215>
https://huggingface.co/timm/swinv2_tiny_window16_256.ms_in1k/discussions/1
These references got me one step closer (past the above error). I adjusted the timm.create_model() calls in efficientnet.py. I'm now getting the following (related) error:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/train.py", line 135, in <module>
my_model = train_mymodel()
^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/train.py", line 127, in train_sigclr
model = MyModel()
File "/mymodel.py", line 28, in __init__
self.encoder = Encoder()
^^^^^^^^^^^^^^^^^^^
File "/encoder.py", line 8, in __init__
self.convnet = efficientnet_b4(pretrained=pretrained, path=path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/torchsig/models/iq_models/efficientnet/efficientnet.py", line 276, in efficientnet_b4
timm.create_model(
File "/.venv/lib/python3.11/site-packages/timm/models/_factory.py", line 117, in create_model
model = create_fn(
^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 1913, in efficientnet_b4
model = _gen_efficientnet(
^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 651, in _gen_efficientnet
model = _create_effnet(variant, pretrained, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 368, in _create_effnet
model = build_model_with_cfg(
^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/_builder.py", line 418, in build_model_with_cfg
load_pretrained(
File "/.venv/lib/python3.11/site-packages/timm/models/_builder.py", line 215, in load_pretrained
state_dict[weight_name] = adapt_input_conv(in_chans, state_dict[weight_name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/_manipulate.py", line 259, in adapt_input_conv
O, I, J, K = conv_weight.shape
^^^^^^^^^^
ValueError: not enough values to unpack (expected 4, got 3)
—
Reply to this email directly, view it on GitHub<#239 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUN3HRQZU4GO52C7QYQNCTDZMBUF3AVCNFSM6AAAAABKZVB5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRWGU2DCNJYGA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Sorry for the spam. This line:
File "/.venv/lib/python3.11/site-packages/torchsig/models/iq_models/efficientnet/efficientnet.py", line 276, in efficientnet_b4
timm.create_model(
will return a 1D model. You want to use models from torchsig/models/spectrogram_models . Those will be 2D.
Phil Vallance
RF Research Team
(240) 373-6289
…________________________________
From: Phillip Vallance
Sent: Saturday, July 13, 2024 12:41:01 PM
To: TorchDSP/torchsig; TorchDSP/torchsig
Cc: Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
The default efficientnets from timm are 2D. We have utilities for converting these models to 1D (typically used for the narrowband datasets). It looks like you might be trying to load the weights of a 1D network into a 2D model. Could you pass along your script snippets that are using torchsig and/or the datasets?
Phil Vallance
RF Research Team
(240) 373-6289
________________________________
From: Phillip Vallance
Sent: Saturday, July 13, 2024 12:25:54 PM
To: TorchDSP/torchsig; TorchDSP/torchsig
Cc: Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
Nicholas,
Are you using the 1-D efficientnet from torchsig?
Phil Vallance
RF Research Team
(240) 373-6289
________________________________
From: Nicholas Bruce ***@***.***>
Sent: Friday, July 12, 2024 7:55:09 PM
To: TorchDSP/torchsig
Cc: Phillip Vallance; Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
huggingface/pytorch-image-models#2150<huggingface/pytorch-image-models#2150>
huggingface/pytorch-image-models#2215<huggingface/pytorch-image-models#2215>
https://huggingface.co/timm/swinv2_tiny_window16_256.ms_in1k/discussions/1
These references got me one step closer (past the above error). I adjusted the timm.create_model() calls in efficientnet.py. I'm now getting the following (related) error:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/train.py", line 135, in <module>
my_model = train_mymodel()
^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/train.py", line 127, in train_sigclr
model = MyModel()
File "/mymodel.py", line 28, in __init__
self.encoder = Encoder()
^^^^^^^^^^^^^^^^^^^
File "/encoder.py", line 8, in __init__
self.convnet = efficientnet_b4(pretrained=pretrained, path=path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/torchsig/models/iq_models/efficientnet/efficientnet.py", line 276, in efficientnet_b4
timm.create_model(
File "/.venv/lib/python3.11/site-packages/timm/models/_factory.py", line 117, in create_model
model = create_fn(
^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 1913, in efficientnet_b4
model = _gen_efficientnet(
^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 651, in _gen_efficientnet
model = _create_effnet(variant, pretrained, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/efficientnet.py", line 368, in _create_effnet
model = build_model_with_cfg(
^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/_builder.py", line 418, in build_model_with_cfg
load_pretrained(
File "/.venv/lib/python3.11/site-packages/timm/models/_builder.py", line 215, in load_pretrained
state_dict[weight_name] = adapt_input_conv(in_chans, state_dict[weight_name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/timm/models/_manipulate.py", line 259, in adapt_input_conv
O, I, J, K = conv_weight.shape
^^^^^^^^^^
ValueError: not enough values to unpack (expected 4, got 3)
—
Reply to this email directly, view it on GitHub<#239 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUN3HRQZU4GO52C7QYQNCTDZMBUF3AVCNFSM6AAAAABKZVB5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRWGU2DCNJYGA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hey thanks for the response @pvallance. This is based off of the narrow band example notebooks. In https://github.com/TorchDSP/torchsig/blob/main/examples/02_example_sig53_classifier.ipynb the model being used on the narrowband dataset is model = efficientnet_b4(
pretrained=True,
path="efficientnet_b4.pt",
) Which was working for me as an encoder while using torchsig v.0.5.0. I'm using it like this: from torchsig.models.iq_models.efficientnet.efficientnet import efficientnet_b4
import torch.nn as nn
import torch
class Encoder(nn.Module):
def __init__(self, pretrained=True,path="/path/to/sig53/efficientnet_b4_online.pt",device='cuda'):
super().__init__()
self.convnet = efficientnet_b4(pretrained=pretrained, path=path)
self.convnet = self.convnet.to(device)
def forward(self, x):
return self.convnet(x)
def predict(self, x):
with torch.no_grad():
out = self.forward(x)
return out Which is causing that error when I try to build instantiate an |
We are reworking these examples and updating our unit tests. I hope to have a new release in the next few days.
Phil Vallance
RF Research Team
(240) 373-6289
…________________________________
From: Nicholas Bruce ***@***.***>
Sent: Saturday, July 13, 2024 5:21:35 PM
To: TorchDSP/torchsig
Cc: Phillip Vallance; Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
Hey thanks for the response @pvallance<https://github.com/pvallance>. This is based off of the narrow band example notebooks. In https://github.com/TorchDSP/torchsig/blob/main/examples/02_example_sig53_classifier.ipynb the model being used on the narrowband dataset is
model = efficientnet_b4(
pretrained=True,
path="efficientnet_b4.pt",
)
Which was working for me as an encoder while using torchsig v.0.5.0<https://github.com/TorchDSP/torchsig/releases/tag/v0.5.0>.
I'm using it like this:
from torchsig.models.iq_models.efficientnet.efficientnet import efficientnet_b4
import torch.nn as nn
import torch
class Encoder(nn.Module):
def __init__(self, pretrained=True,path="/path/to/sig53/efficientnet_b4_online.pt",device='cuda'):
super().__init__()
self.convnet = efficientnet_b4(pretrained=pretrained, path=path)
self.convnet = self.convnet.to(device)
def forward(self, x):
return self.convnet(x)
def predict(self, x):
with torch.no_grad():
out = self.forward(x)
return out
Which is causing that error when I try to build instantiate an Encoder().
—
Reply to this email directly, view it on GitHub<#239 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUN3HRXBTJEJL3MHLN4OF6TZMGK57AVCNFSM6AAAAABKZVB5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGEYDMMRUG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi @pvallance any update on this? |
Yes. We have updated all the notebooks and are finishing the unit tests. I am hopeful Monday of next week. Sorry, we have been refactoring a lot of code.
Phil Vallance
RF Research Team
(240) 373-6289
…________________________________
From: Nicholas Bruce ***@***.***>
Sent: Friday, August 9, 2024 12:20:14 PM
To: TorchDSP/torchsig
Cc: Phillip Vallance; Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
Hi @pvallance<https://github.com/pvallance> any update on this?
—
Reply to this email directly, view it on GitHub<#239 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUN3HRU4N6DTU7FQRUVIUCLZQTT35AVCNFSM6AAAAABKZVB5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZYGMYDMMZSGA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Nicholas,
Sorry for the delay. The next release will happen Tuesday. After that we will be releasing foundational models as another baseline approach.
Phil Vallance
RF Research Team
(240) 373-6289
…________________________________
From: Phillip Vallance
Sent: Friday, August 9, 2024 12:44:54 PM
To: TorchDSP/torchsig; TorchDSP/torchsig
Cc: Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
Yes. We have updated all the notebooks and are finishing the unit tests. I am hopeful Monday of next week. Sorry, we have been refactoring a lot of code.
Phil Vallance
RF Research Team
(240) 373-6289
________________________________
From: Nicholas Bruce ***@***.***>
Sent: Friday, August 9, 2024 12:20:14 PM
To: TorchDSP/torchsig
Cc: Phillip Vallance; Mention
Subject: Re: [TorchDSP/torchsig] Can't load pretrained models anymore (Issue #239)
Hi @pvallance<https://github.com/pvallance> any update on this?
—
Reply to this email directly, view it on GitHub<#239 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUN3HRU4N6DTU7FQRUVIUCLZQTT35AVCNFSM6AAAAABKZVB5ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZYGMYDMMZSGA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This sounds very interesting. Any updates here? I was looking to pull the latest but I didn't want to dig through this repo if a big refactor is on the way. |
Hi @pvallance, lots of interesting updates were released this week! Thank you. The newer notebooks no longer have an example of loading the pre-trained weights. When I try from torchsig.models import EfficientNet1d
import torch
mdl = EfficientNet1d(2,53,"b4")
mdl.load_state_dict(torch.load('efficientnet_b4_online.pt')) I get the following error: RuntimeError: Error(s) in loading state_dict for EfficientNet:
Unexpected key(s) in state_dict: "conv_stem.bias", "blocks.0.0.conv_dw.bias", "blocks.0.0.conv_pw.bias", "blocks.0.1.conv_dw.bias", "blocks.0.1.conv_pw.bias", "blocks.1.0.conv_pw.bias", "blocks.1.0.conv_dw.bias", "blocks.1.0.conv_pwl.bias", "blocks.1.1.conv_pw.bias", "blocks.1.1.conv_dw.bias", "blocks.1.1.conv_pwl.bias", "blocks.1.2.conv_pw.bias", "blocks.1.2.conv_dw.bias", "blocks.1.2.conv_pwl.bias", "blocks.1.3.conv_pw.bias", "blocks.1.3.conv_dw.bias", "blocks.1.3.conv_pwl.bias", "blocks.2.0.conv_pw.bias", "blocks.2.0.conv_dw.bias", "blocks.2.0.conv_pwl.bias", "blocks.2.1.conv_pw.bias", "blocks.2.1.conv_dw.bias", "blocks.2.1.conv_pwl.bias", "blocks.2.2.conv_pw.bias", "blocks.2.2.conv_dw.bias", "blocks.2.2.conv_pwl.bias", "blocks.2.3.conv_pw.bias", "blocks.2.3.conv_dw.bias", "blocks.2.3.conv_pwl.bias", "blocks.3.0.conv_pw.bias", "blocks.3.0.conv_dw.bias", "blocks.3.0.conv_pwl.bias", "blocks.3.1.conv_pw.bias", "blocks.3.1.conv_dw.bias", "blocks.3.1.conv_pwl.bias", "blocks.3.2.conv_pw.bias", "blocks.3.2.conv_dw.bias", "blocks.3.2.conv_pwl.bias", "blocks.3.3.conv_pw.bias", "blocks.3.3.conv_dw.bias", "blocks.3.3.conv_pwl.bias", "blocks.3.4.conv_pw.bias", "blocks.3.4.conv_dw.bias", "blocks.3.4.conv_pwl.bias", "blocks.3.5.conv_pw.bias", "blocks.3.5.conv_dw.bias", "blocks.3.5.conv_pwl.bias", "blocks.4.0.conv_pw.bias", "blocks.4.0.conv_dw.bias", "blocks.4.0.conv_pwl.bias", "blocks.4.1.conv_pw.bias", "blocks.4.1.conv_dw.bias", "blocks.4.1.conv_pwl.bias", "blocks.4.2.conv_pw.bias", "blocks.4.2.conv_dw.bias", "blocks.4.2.conv_pwl.bias", "blocks.4.3.conv_pw.bias", "blocks.4.3.conv_dw.bias", "blocks.4.3.conv_pwl.bias", "blocks.4.4.conv_pw.bias", "blocks.4.4.conv_dw.bias", "blocks.4.4.conv_pwl.bias", "blocks.4.5.conv_pw.bias", "blocks.4.5.conv_dw.bias", "blocks.4.5.conv_pwl.bias", "blocks.5.0.conv_pw.bias", "blocks.5.0.conv_dw.bias", "blocks.5.0.conv_pwl.bias", "blocks.5.1.conv_pw.bias", "blocks.5.1.conv_dw.bias", "blocks.5.1.conv_pwl.bias", "blocks.5.2.conv_pw.bias", "blocks.5.2.conv_dw.bias", "blocks.5.2.conv_pwl.bias", "blocks.5.3.conv_pw.bias", "blocks.5.3.conv_dw.bias", "blocks.5.3.conv_pwl.bias", "blocks.5.4.conv_pw.bias", "blocks.5.4.conv_dw.bias", "blocks.5.4.conv_pwl.bias", "blocks.5.5.conv_pw.bias", "blocks.5.5.conv_dw.bias", "blocks.5.5.conv_pwl.bias", "blocks.5.6.conv_pw.bias", "blocks.5.6.conv_dw.bias", "blocks.5.6.conv_pwl.bias", "blocks.5.7.conv_pw.bias", "blocks.5.7.conv_dw.bias", "blocks.5.7.conv_pwl.bias", "blocks.6.0.conv_pw.bias", "blocks.6.0.conv_dw.bias", "blocks.6.0.conv_pwl.bias", "blocks.6.1.conv_pw.bias", "blocks.6.1.conv_dw.bias", "blocks.6.1.conv_pwl.bias", "conv_head.bias". Which is a much smaller number of unexpected keys than before (output was truncated in my fist comment on this issue), and no missing keys, which I think is good progress. Do you have any advice on how to load the pretrained weights? |
Hello @nsbruce, Taking over for @pvallance, please look at |
Hi @ereoh, I did look through that. No pre-trained weights are loaded in that notebook. In the old version the weights were loaded like so: model = efficientnet_b4(
pretrained=True,
path="efficientnet_b4.pt",
) In the new version the pre-trained weights are not used. |
Gotcha. Passing it on to developers -- we really appreciate your patience. |
Describe the bug
Since the torch version was updated, the provided pretrained weights no longer match the efficientnet model and can't be loaded in.
To Reproduce
Output
Note I shortened the output by a lot since there are many mismatched keys between these dictionaries.
Expected behavior
model loads in correctly
Some possible solutions:
The text was updated successfully, but these errors were encountered: