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

example of how to use Element? #62

Closed
Data-drone opened this issue Dec 21, 2020 · 3 comments
Closed

example of how to use Element? #62

Data-drone opened this issue Dec 21, 2020 · 3 comments
Labels
good first issue Good for newcomers
Projects

Comments

@Data-drone
Copy link

Data-drone commented Dec 21, 2020

Can you include an example in the docs of how to use Elements?

I don't understand how to the config management fits into Auto and fit or am I not supposed to use a custom config with Auto?

is the Elements just the internal structure that you use to store a config json or am I supposed to create an Elements object then update values in that?

@carefree0910 carefree0910 added the good first issue Good for newcomers label Dec 22, 2020
@carefree0910 carefree0910 added this to To do in v0.1.9 via automation Dec 22, 2020
@carefree0910
Copy link
Owner

carefree0910 commented Dec 22, 2020

I should admit that I haven't made this part clear enough in the doc, and I'll try to clarify it ASAP 🤣

The conclusions are:

  • We can specify extra_config in fit to add the configurations:
auto.fit(..., extra_config={...})

And the usage of extra_config should be equivalent to the usage of config in make API.

extra_config is not able to overwrite the hyperparameters generated by the search space (e.g., the optimizer), so in fact the options we can play with it are limited 🤣

And here is the documentation on how to define the search spaces 😄

  • Yes, Elements is more of an internal structure than an external API, but you can also use it directly. As shown in this section:

The reason why we introduce the make API is that we hope we can provide APIs as carefree as possible. So we've listed the most commonly used configurations in Elements, and supported users to specify them through kwargs (which is the most intuitive way) in make.

I've also provided an example there:

import cflearn

m = cflearn.make(cuda="cpu")
print(m.device)  # cpu

And the equivalent Elements usage is:

from cflearn.configs import *
from cflearn.pipeline import Pipeline

elements = Elements(cuda="cpu", user_config={}, user_increment_config={})
environment = Environment.from_elements(elements)
m = Pipeline(environment)
print(m.device)  # cpu

The user_config={}, user_increment_config={} part is caused by a legacy bug, in the future (v0.1.9), it should be simplified as:

elements = Elements(cuda="cpu")

If problems still remain, feel free to comment here anytime! 😄

@carefree0910
Copy link
Owner

  • I've made a small piece of notification here.
  • And included an example here.

This example is valid only if we've reached v0.1.9, though. Before that, we have to specify the user_config and user_increment_config manually, as mentioned above.

Hope they help!

@carefree0910
Copy link
Owner

Documentation on Define Search Spaces has been updated!

@carefree0910 carefree0910 moved this from To do to In progress in v0.1.9 Dec 24, 2020
v0.1.9 automation moved this from In progress to Done Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
No open projects
v0.1.9
  
Done
Development

No branches or pull requests

2 participants