FlameF0X commited on
Commit
d0bfe3e
·
verified ·
1 Parent(s): ab0b344

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +3 -2
inference.py CHANGED
@@ -60,8 +60,9 @@ class ShellDConfig:
60
  def from_json(cls, path: str) -> "ShellDConfig":
61
  with open(path) as f:
62
  d = json.load(f)
63
- # Strip keys starting with "_"
64
- d = {k: v for k, v in d.items() if not k.startswith("_")}
 
65
  return cls(**d)
66
 
67
 
 
60
  def from_json(cls, path: str) -> "ShellDConfig":
61
  with open(path) as f:
62
  d = json.load(f)
63
+ # Keep only fields that exist in the dataclass
64
+ valid_keys = {f.name for f in cls.__dataclass_fields__.values()}
65
+ d = {k: v for k, v in d.items() if k in valid_keys}
66
  return cls(**d)
67
 
68