Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug Fix: pretrained s3prl-frontend based models loaded with parameters key mismatch error#5074

Merged
mergify[bot] merged 2 commits intoespnet:masterfrom
simpleoier:s3prl_bug_fix
Apr 1, 2023
Merged

Bug Fix: pretrained s3prl-frontend based models loaded with parameters key mismatch error#5074
mergify[bot] merged 2 commits intoespnet:masterfrom
simpleoier:s3prl_bug_fix

Conversation

@simpleoier
Copy link
Collaborator

This is related to #4910 .
Thanks @boeddeker for the solution!

@mergify mergify bot added the ESPnet2 label Apr 1, 2023
@sw005320
Copy link
Contributor

sw005320 commented Apr 1, 2023

Can you fix some CI errors?
Then, I'll merge it.

@sw005320 sw005320 added the SSL self-supervised learning label Apr 1, 2023
@sw005320 sw005320 added this to the v.202303 milestone Apr 1, 2023
@sw005320 sw005320 added the auto-merge Enable auto-merge label Apr 1, 2023
@sw005320
Copy link
Contributor

sw005320 commented Apr 1, 2023

Thanks, @simpleoier!
@boeddeker, could you test it?

@codecov
Copy link

codecov bot commented Apr 1, 2023

Codecov Report

Merging #5074 (55cc4c1) into master (42c2b26) will decrease coverage by 0.02%.
The diff coverage is 20.00%.

@@            Coverage Diff             @@
##           master    #5074      +/-   ##
==========================================
- Coverage   75.86%   75.85%   -0.02%     
==========================================
  Files         615      615              
  Lines       54689    54698       +9     
==========================================
+ Hits        41491    41492       +1     
- Misses      13198    13206       +8     
Flag Coverage Δ
test_integration_espnet1 66.29% <ø> (ø)
test_integration_espnet2 48.51% <20.00%> (-0.02%) ⬇️
test_python 65.82% <0.00%> (-0.02%) ⬇️
test_utils 23.28% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
espnet2/tasks/abs_task.py 77.30% <20.00%> (-0.95%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mergify mergify bot merged commit 062897e into espnet:master Apr 1, 2023
device = f"cuda:{torch.cuda.current_device()}"
model.load_state_dict(torch.load(model_file, map_location=device))
try:
model.load_state_dict(torch.load(model_file, map_location=device))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this to

state_dict = torch.load(model_file, map_location=device)
try:
    model.load_state_dict(state_dict)

and remove the later call of torch.load?

@boeddeker
Copy link
Contributor

Sorry for the late reply. Yes, the code works to load an old model. Thanks.
The downside is just, that there is now a file system overhead, because the file is loaded multiple times.

Could that be fixed? (See my comment in the code)

@simpleoier simpleoier deleted the s3prl_bug_fix branch March 28, 2024 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Enable auto-merge Bugfix ESPnet2 SSL self-supervised learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants