Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes in chainer, for the convenience of debugging #1622

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions deeppavlov/core/common/chainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ def _compute(*args, param_names, pipe, targets):
final_pipe.append(((in_keys, in_params), out_params, component))
final_pipe.reverse()
if not expected.issubset(param_names):
raise RuntimeError(f'{expected} are required to compute {targets} but were not found in memory or inputs')
missing_params = [k for k in expected if k not in param_names]
raise RuntimeError(f'{missing_params} are required to compute {targets} but were not found in memory or inputs')
pipe = final_pipe

mem = dict(zip(param_names, args))
Expand All @@ -232,8 +233,10 @@ def _compute(*args, param_names, pipe, targets):
mem[out_params[0]] = res
else:
mem.update(zip(out_params, res))

res = [mem[k] for k in targets]
try:
res = [mem[k] for k in targets]
except Exception as e:
raise Exception(f'In memory {mem.keys()} targets {targets}: {e}')
if len(res) == 1:
res = res[0]
return res
Expand Down