Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Loading of saved model results in Unexpected key(s) in state_dict: "loss_fct.weight" #428

@Timoeller

Description

@Timoeller

Describe the bug
We cannot load a Prediction Head with class weights.

Error message
RuntimeError: Error(s) in loading state_dict for TextClassificationHead:
Unexpected key(s) in state_dict: "loss_fct.weight".

I suspect this bug was introduced by updating to pytorch version 1.5.0.
Unfortunately we do not have tests covering this use case, so we cannot pin the cause exactly.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions