The context is rather hard to explain, but I have already identified the problem.
Culprit:
|
prefix = tuple(key for key in prefix.split(".") if key) |
|
if prefix: |
|
data = data.get(prefix) |
|
self.data.load_state_dict(data) |
If prefix is not present in data, L1246 would set data = None and the subsequent line fails. I guess the following codeblock would solve it?
if prefix:
data = data.get(prefix)
if data is not None:
self.data.load_state_dict(data)