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
Lambda wrapper callback #1153
Lambda wrapper callback #1153
Conversation
Hello @elephantmipt! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-04-15 15:21:04 UTC |
btw, could you please also add this callback usage to the test and examples? |
This pull request is now in conflicts. @elephantmipt, could you fix it? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we simplify the code a bit?
ley's support only 2 cases:
- tuple-in, tuple-out, specified with
input_key
,output_key
, for example:
input_key=logits, output_key=scores
input_key=["logits", "weights"], output_key=scores
input_key=emgeddings, output_key=["pos_embeddings", "neg_embeddings"]
in this case, could simply use:
def batch_handler(self, runner):
batch_in = [runner.batch[key] for key in self.input_key]
batch_out = self.handler(batch_in)
runner.batch.update(**{key:value for key, value in zip(self.output_key, batch_out)})
- dict-in, dict-out, specified with
input_key=None
,output_key=None
usage:
def batch_handler(self, runner):
runner.batch = self.handler(runner.batch)
Co-authored-by: Sergey Kolesnikov <scitator@gmail.com>
Co-authored-by: Sergey Kolesnikov <scitator@gmail.com>
Co-authored-by: Sergey Kolesnikov <scitator@gmail.com>
Before submitting (checklist)
catalyst-make-codestyle && catalyst-check-codestyle
(pip install -U catalyst-codestyle
).make check-docs
?pytest .
?latest
andminimal
requirements?Description
Related Issue
Type of Change
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
PS