-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from automl/readme_changes_danrgll
README Update: Minor Format Changes and new Code Usage Part
- Loading branch information
Showing
12 changed files
with
313 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
# Introduction and Installation | ||
# Installation | ||
|
||
## Installation | ||
|
||
Using pip | ||
## Install from pip | ||
|
||
```bash | ||
pip install neural-pipeline-search | ||
``` | ||
|
||
## Install from source | ||
|
||
!!! note | ||
We use [poetry](https://python-poetry.org/docs/) to manage dependecies. | ||
|
||
```bash | ||
git clone https://github.com/automl/neps.git | ||
cd neps | ||
poetry install --no-dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,43 @@ | ||
# Parallelization | ||
# Parallelization and Resuming Runs | ||
|
||
In order to run a neural pipeline search with multiple processes or multiple machines, simply call `neps.run` multiple times. | ||
All calls to `neps.run` need to use the same `root_directory` on the same filesystem, otherwise there is no synchronization between the `neps.run`'s. | ||
NePS utilizes files as a means of communication for implementing parallelization and resuming runs. As a result, when `neps.run` is called multiple times with the same `root_directory` in the file system, NePS will automatically load the optimizer state, allowing seamless parallelization of the run across different processes or machines. This concept also applies to resuming runs even after termination. | ||
|
||
Example: | ||
|
||
!!! note | ||
The following example assumes all necessary imports are included, in addition to already having defined the [pipeline_space](https://automl.github.io/neps/latest/pipeline_space/) and the [run_pipeline](https://automl.github.io/neps/latest/run_pipeline/) functions. One can apply the same idea on [this](https://github.com/automl/neps/blob/master/neps_examples/basic_usage/hyperparameters.py) example. | ||
|
||
```python | ||
logging.basicConfig(level=logging.INFO) | ||
|
||
# Initial run | ||
neps.run( | ||
run_pipeline=run_pipeline, | ||
pipeline_space=pipeline_space, | ||
root_directory="results/my_example", | ||
max_evaluations_total=5, | ||
) | ||
``` | ||
|
||
After the initial run, NePS will log the following message: | ||
|
||
```bash | ||
INFO:neps:Maximum total evaluations is reached, shutting down | ||
``` | ||
|
||
If you wish to extend the search with more evaluations, simply update the `max_evaluations_total` parameter: | ||
|
||
```python | ||
logging.basicConfig(level=logging.INFO) | ||
|
||
|
||
# Resuming run with increased evaluations | ||
neps.run( | ||
run_pipeline=run_pipeline, | ||
pipeline_space=pipeline_space, | ||
root_directory="results/my_example", | ||
max_evaluations_total=10, | ||
) | ||
``` | ||
|
||
Now, NePS will continue the search, loading the latest information for the searcher. For parallelization, as mentioned above, you can also run this code multiple times on different processes or machines. The file system communication will link them, as long as the `root_directory` has the same location. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# The run_pipeline Function | ||
|
||
The `run_pipeline` function is crucial for NePS. It encapsulates the `objective function` to be minimized, which could be a regular equation or a neural network. | ||
|
||
This function receives the configuration to be utilized from the parameters defined in the search space. Consequently, it executes the same set of instructions or equations based on the provided configuration to minimize the objective function. | ||
|
||
The `run_pipeline` function will look similar to the following: | ||
|
||
```python | ||
def run_pipeline( | ||
pipeline_directory, # The directory where the config is saved | ||
previous_pipeline_directory, # The directory of the immediate lower fidelity config | ||
**config, # The hyperparameters to be used in the pipeline | ||
): | ||
|
||
element_1 = config[element_1] | ||
element_2 = config[element_2] | ||
element_3 = config[element_3] | ||
|
||
loss = element_1 - element_2 + element_3 | ||
|
||
return loss | ||
``` | ||
|
||
The `run_pipeline` function should be replaced with the user's specific objective function. It is invoked by `neps.run` without any arguments, as these arguments are automatically handled by NePS. Additionally, NePS provides the pipeline directory and the previous pipeline directory for user convenience (mainly useful for searches that require fidelities). | ||
|
||
Have a look at our examples and templates [here](https://github.com/automl/neps/tree/master/neps_examples) to see how we use this function in different scenarios. | ||
|
Oops, something went wrong.