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

Add constructor functions for model and tokenizer of MonoBERT/T5 #93

Merged
merged 4 commits into from
Oct 23, 2020

Conversation

yuxuan-ji
Copy link
Contributor

@yuxuan-ji yuxuan-ji commented Sep 17, 2020

This PR is intended to try and resolve the issue raised in #86 (comment) and closes #86
i.e.

Wouldn't it make sense to use this new abstraction so we don't have multiple code paths (that might subtly diverge down the road...)? And same with MonoBERT?

I'm proposing we add constructor functions for the model and tokenizer used in MonoBERT/T5 so that the user doesn't need to manually initialize them to the right class

with this change, i'm also removing MonoBERT/T5's ability to take in strings as parameters, as it becomes redundant

thoughts on this change? I think it might be a more sane solution that what I had before

@yuxuan-ji yuxuan-ji force-pushed the simplify-boilerplate-2 branch from bd319d3 to 9a99f6a Compare September 17, 2020 23:47
Comment on lines +32 to +33
self.model = model or self.get_model()
self.tokenizer = tokenizer or self.get_tokenizer()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but is such code standard python practice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ronakice, is your concern about the use of the or operand? I've seen this being used as a shorthand to

self.model = model if model else self.get_model()

so I don't think there's any issues there. Or is it more about the PR in general?

Copy link
Member

@ronakice ronakice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this @yuxuan-ji :) , merging!

@ronakice
Copy link
Member

@yuxuan-ji actually can you resolve these merge conflicts?

@ronakice ronakice merged commit 978a071 into castorini:master Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MonoBERT and MonoT5 defaults
2 participants