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

User interface improvements #34

Merged
merged 10 commits into from
Dec 21, 2022
Merged

User interface improvements #34

merged 10 commits into from
Dec 21, 2022

Conversation

engintoklu
Copy link
Collaborator

This pull request aims to bring various changes and improvements to the API of EvoTorch.

  • All pre-defined problem classes now have consistent default configuration: num_actors=None, num_gpus_per_actor=None.
  • New decorators:
    • @on_device(device): Decorates a fitness function to make the associated problem object become aware of the device on which the evaluations are meant to happen
    • @on_cuda(i): Decorates a fitness function to make the associated problem object aware of the CUDA device on which the evaluations are meant to happen
    • @on_aux_device: Decorates a fitness function to make the associated problem object become aware that the evaluations are meant to happen on the auxiliary device.
    • @vectorized: Decorates a fitness function to make the associated problem object become aware that the fitness function expects multiple solutions and returns multiple fitnesses.
  • The documentation is updated and improved.

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2022

Codecov Report

Merging #34 (604e687) into master (d3e3f0a) will increase coverage by 25.15%.
The diff coverage is 77.27%.

@@             Coverage Diff             @@
##           master      #34       +/-   ##
===========================================
+ Coverage   52.97%   78.13%   +25.15%     
===========================================
  Files          43       43               
  Lines        6233     6307       +74     
===========================================
+ Hits         3302     4928     +1626     
+ Misses       2931     1379     -1552     
Impacted Files Coverage Δ
src/evotorch/neuroevolution/gymne.py 79.53% <ø> (+54.44%) ⬆️
src/evotorch/neuroevolution/neproblem.py 92.30% <ø> (+57.14%) ⬆️
src/evotorch/neuroevolution/supervisedne.py 90.47% <ø> (+55.55%) ⬆️
src/evotorch/neuroevolution/vecgymne.py 79.70% <ø> (+58.80%) ⬆️
src/evotorch/tools/__init__.py 100.00% <ø> (ø)
src/evotorch/tools/misc.py 85.78% <29.16%> (+3.74%) ⬆️
src/evotorch/algorithms/ga.py 63.21% <66.66%> (+43.21%) ⬆️
src/evotorch/neuroevolution/net/parser.py 94.78% <75.00%> (+43.45%) ⬆️
src/evotorch/core.py 73.32% <76.81%> (+7.78%) ⬆️
src/evotorch/decorators.py 100.00% <100.00%> (ø)
... and 30 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@engintoklu engintoklu changed the title Draft: User interface improvements User interface improvements Nov 15, 2022
@engintoklu engintoklu requested review from NaturalGradient, Higgcz and flukeskywalker and removed request for Higgcz November 15, 2022 14:33
@Higgcz Higgcz added this to the 0.4.0 milestone Nov 16, 2022
@Higgcz Higgcz added the enhancement New feature or request label Nov 16, 2022
@Higgcz Higgcz force-pushed the feature/user-interface branch 6 times, most recently from 7a8f0ea to 9174017 Compare November 23, 2022 22:16
@Higgcz
Copy link
Contributor

Higgcz commented Nov 23, 2022

I think this is ready to be merged.

Higgcz
Higgcz previously approved these changes Nov 23, 2022
Higgcz
Higgcz previously approved these changes Nov 24, 2022
Higgcz
Higgcz previously approved these changes Nov 25, 2022
engintoklu and others added 3 commits December 21, 2022 22:39
This commit brings various changes and
improvements to the API of EvoTorch.

- All pre-defined problem classes now have
  consistent default configuration:
  `num_actors=None`, `num_gpus_per_actor=None`.
- New decorators:
  - `@on_device(device)`: Decorates a fitness
    function to make the associated problem
    object become aware of the device on which
    the evaluations are meant to happen
  - `@on_cuda(i)`: Decorates a fitness function
    to make the associated problem object
    aware of the CUDA device on which the
    evaluations are meant to happen
  - `@on_aux_device`: Decorates a fitness
    function to make the associated problem
    object become aware that the evaluations
    are meant to happen on the auxiliary device.
  - `@vectorized`: Decorates a fitness function
    to make the associated problem object become
    aware that the fitness function expects
    multiple solutions and returns multiple
    fitnesses.
- The documentation is updated and improved.
Higgcz and others added 7 commits December 21, 2022 22:39
- Quickstart example with different search algorithms
- Simple Neuroevolution example
- Problem definition of Neuroevolution for Gym example
This commit makes the API of `Problem` consistent
with its docstring in this way: one can now omit
`initial_bounds` and override the `_fill(...)`
method for defining how the solutions should be
initialized. Before this commit, one would have
to specify dummy values for `initial_bounds` when
using a `dtype` other than `object`.

Unit tests are updated and improved regarding
the API improvement mentioned above.

This commit also brings new unit tests for the
namespace `evotorch.optimizers`.
@Higgcz Higgcz merged commit f064bb5 into master Dec 21, 2022
@Higgcz Higgcz deleted the feature/user-interface branch December 21, 2022 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants