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

A list of all classes -> names they're registered as would be useful #2341

Closed
nelson-liu opened this issue Jan 11, 2019 · 8 comments
Closed

A list of all classes -> names they're registered as would be useful #2341

nelson-liu opened this issue Jan 11, 2019 · 8 comments

Comments

@nelson-liu
Copy link
Member

@nelson-liu nelson-liu commented Jan 11, 2019

Maybe this is me, but I've realized that it's pretty hard to figure out what various classes are registered as unless you go spelunking into the actual library code.

We should expose this information in a more user-friendly manner (and something simpler than running the config wizard), maybe a list in the docs or something?

@nelson-liu

This comment has been minimized.

Copy link
Member Author

@nelson-liu nelson-liu commented Jan 11, 2019

also: it seems like the docs for the classes themselves don't mention what they're registered as in the library, so it would be great to add that as well.

@matt-gardner

This comment has been minimized.

Copy link
Member

@matt-gardner matt-gardner commented Jan 11, 2019

We can clearly auto-generate this, as the config wizard does it. So whatever the solution is, it should not be maintained by hand.

@joelgrus

This comment has been minimized.

Copy link
Collaborator

@joelgrus joelgrus commented Jan 11, 2019

python -c"import allennlp.training; from allennlp.common.registrable import Registrable; print(Registrable._registry)"

😉

@DeNeutoy

This comment has been minimized.

Copy link
Collaborator

@DeNeutoy DeNeutoy commented Jan 11, 2019

Could be good to expose this as a high level api, e.g:

import allennlp

print(allennlp.registerable_classes())
["Trainer", "Seq2SeqEncoder", "Attention", etc]

print(allennlp.registerable_options_for("Trainer"))
{"SingleTaskTrainer": "single_task"}

or something similar

@joelgrus

This comment has been minimized.

Copy link
Collaborator

@joelgrus joelgrus commented Jan 11, 2019

for the second, probably makes sense to add it as a method on Registrable itself, so you could do like

from allennlp.models import Model
print(Model.known_subclasses())

or something like that (probably with a better name)

the challenge for the former is that they're not "known" until those modules load, so if you just import allennlp top level the registry is empty, so we'd have to do something ugly to force loading.

@DeNeutoy

This comment has been minimized.

Copy link
Collaborator

@DeNeutoy DeNeutoy commented Jan 11, 2019

Maybe that's overkill and we just need something in the docs.

@schmmd

This comment has been minimized.

Copy link
Member

@schmmd schmmd commented Jan 18, 2019

We think the right fix here is to have a script that lists the registered names.

@matt-gardner

This comment has been minimized.

Copy link
Member

@matt-gardner matt-gardner commented Dec 17, 2019

The right fix is to find this issue, see the one-liner, and run it? Or use the config wizard? Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.