refactor(loading.py): add try-except block to handle KeyError when removing 'model' from params dictionary
This commit is contained in:
parent
5cf531b520
commit
bb41f5af5d
1 changed files with 6 additions and 1 deletions
|
|
@ -74,7 +74,12 @@ def instantiate_class(node_type: str, base_type: str, params: Dict) -> Any:
|
|||
return loaded_toolkit
|
||||
elif base_type == "embeddings":
|
||||
# ? Why remove model from params?
|
||||
params.pop("model")
|
||||
|
||||
try:
|
||||
params.pop("model")
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
# remove all params that are not in class_object.__fields__
|
||||
try:
|
||||
return class_object(**params)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue