[go: nahoru, domu]

Skip to content

Commit

Permalink
Update util.py
Browse files Browse the repository at this point in the history
fix issue yl4579#5
  • Loading branch information
yl4579 committed Oct 3, 2023
1 parent 43869c2 commit ec36cc2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Utils/PLBERT/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ def load_plbert(log_dir):
if name.startswith('encoder.'):
name = name[8:] # remove `encoder.`
new_state_dict[name] = v
if not hasattr(bert.embeddings, 'position_ids'):
del new_state_dict["embeddings.position_ids"]
bert.load_state_dict(new_state_dict)
del new_state_dict["embeddings.position_ids"]
bert.load_state_dict(new_state_dict, strict=False)

return bert

0 comments on commit ec36cc2

Please sign in to comment.