-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Move specific import, speedup importing time. Fix #1614. #1615
Conversation
I don't think the original complaint was just a 0.75s delay, so doesn't seem like the numbers here show the real loading cost. I believe the best fix would move the Keras-specific convenience method elsewhere entirely. (Also, while I believe the effective re- |
@gojomo unfortunately, if we moved this method to another place - we will lose this function. For this reason, I think we shouldn't move this method to another place. |
Why would moving it elsewhere lose the functionality? In my opinion it'd be fine to even just define inline in the two files that use it (one test file, one notebook). It's a 1-liner – really just a way to remind people how |
Because it becomes difficult to find it -> nobody will use this (for example, we move this to Or your propose removing this method, replace layer = Embedding(
input_dim=kv.syn0.shape[0], output_dim=kv.syn0.shape[1],
weights=[kv.syn0], trainable=False
) |
If it's in some specific Or, it just gets inlined or defined where needed. Or is just a documentation FAQ answer somewhere, to the question "How do I convert my KeyedVectors word-vectors into a Keras It just seems awkward to me for (And even if it does stay here, its name should probably include |
Distinct submodule for one function - bad idea (especially considering that I'm currently doing refactoring and simplifying gensim). |
My thinking would be: if keras users are important enough to add in special supporting methods, of which this could just be the first, and which introduce a noticeable import-time overhead, then I'd see a distinct module as plausible, even if it starts with just a single important function. The mere act of starting that module might encourage more contributions along that theme – keras-specific helpers/wrappers/glue – by displaying that there's a welcome space for them. On the other hand, if keras users are a smallish special-case, and this method isn't that important, then again I'd see a method like this better handled in docs/demos, or defined-where-needed, or inlined – rather than a single special-case added to KeyedVector. (That is, I see a similar aesthetic objection applying to a single bolt-on method as with a single-function module.) It's no big deal either way; I'm just clarifying I personally find the extremes (dedicated place in APIs, or no place in APIs) more logical than a mushy middle course (just let functionality fall into an existing place). |
Before:
After: