8000 fix dataclasses import by epwalsh · Pull Request #5169 · allenai/allennlp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

fix dataclasses import #5169

Merged
merged 2 commits into from
May 3, 2021
Merged

fix dataclasses import #5169

merged 2 commits into from
May 3, 2021

Conversation

epwalsh
Copy link
Member
@epwalsh epwalsh commented Apr 29, 2021

We are importing dataclasses within a method in the PretrainedTransformerTokenizer class, instead of at the top level of the module. There's no good reason to do that, because dataclasses is imported elsewhere anyway, and there is probably a performance penalty with having to call this import statement every time the method is called. I usually don't worry about that when the method is only meant to be called once, but this particular method is likely to be called many times by the user (for example, on each tokenized sentence read from a dataset reader).

@epwalsh epwalsh requested a review from AkshitaB April 29, 2021 16:14
@epwalsh epwalsh enabled auto-merge (squash) May 3, 2021 16:50
@epwalsh epwalsh merged commit 55efa68 into main May 3, 2021
@epwalsh epwalsh deleted the imports branch May 3, 2021 16:51
dirkgr pushed a commit that referenced this pull request May 10, 2021
Co-authored-by: Akshita Bhagia <akshita23bhagia@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0