-
Notifications
You must be signed in to change notification settings - Fork 467
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 #168 from zenml-io/alex/ENG-61-pathutils-refactor
Merge path_utils into fileio & refactor what was left
- Loading branch information
Showing
60 changed files
with
1,333 additions
and
795 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
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.
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
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,49 @@ | ||
# Pipeline Configuration | ||
|
||
## Setting step parameters using a config file | ||
|
||
In addition to setting parameters for your pipeline steps in code, ZenML also allows you to use a configuration [yaml](https://yaml.org/) file. | ||
This configuration file must follow the following structure: | ||
```yaml | ||
steps: | ||
step_name: | ||
parameters: | ||
parameter_name: parameter_value | ||
some_other_parameter_name: 2 | ||
some_other_step_name: | ||
... | ||
``` | ||
Use the configuration file by calling the pipeline method `with_config(...)`: | ||
|
||
```python | ||
@pipeline | ||
def my_pipeline(...): | ||
... | ||
pipeline_instance = my_pipeline(...).with_config("path_to_config.yaml") | ||
pipeline_instance.run() | ||
``` | ||
|
||
## Naming a pipeline run | ||
|
||
When running a pipeline by calling `my_pipeline.run()`, ZenML uses the current date and time as the name for the pipeline run. | ||
In order to change the name for a run, simply pass it as a parameter to the `run()` function: | ||
|
||
```python | ||
my_pipeline.run(run_name="custom_pipeline_run_name") | ||
``` | ||
|
||
{% hint style="warning" %} | ||
Pipeline run names must be unique, so make sure to compute it dynamically if you plan to run your pipeline multiple times. | ||
{% endhint %} | ||
|
||
Once the pipeline run is finished we can easily access this specific run during our post-execution workflow: | ||
|
||
```python | ||
from zenml.core.repo import Repository | ||
repo = Repository() | ||
pipeline = repo.get_pipeline(pipeline_name="my_pipeline") | ||
run = pipeline.get_run(run_name="custom_pipeline_run_name") | ||
``` |
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,110 @@ | ||
# Post Execution Workflow | ||
|
||
## Post-execution workflow | ||
|
||
After executing a pipeline, the user needs to be able to fetch it from history and perform certain tasks. This page captures these workflows at an orbital level. | ||
|
||
## Component Hierarchy | ||
|
||
|
||
In the context of a post-execution workflow, there is an implied hierarchy of some basic ZenML components: | ||
|
||
```bash | ||
repository -> pipelines -> runs -> steps -> outputs | ||
|
||
# where -> implies a 1-many relationship. | ||
``` | ||
|
||
### Repository | ||
|
||
The highest level `repository` object is where to start from. | ||
|
||
|
||
### Define standard ML steps | ||
|
||
```python | ||
@trainer | ||
def trainer(dataset: torch.Dataset) -> torch.nn.Module: | ||
... | ||
return model | ||
``` | ||
|
||
|
||
|
||
### Get pipelines and runs | ||
|
||
```python | ||
pipelines = repo.get_pipelines() # get all pipelines from all stacks | ||
pipeline = repo.get_pipeline(pipeline_name=..., stack_key=...) | ||
``` | ||
|
||
```python | ||
runs = pipeline.get_runs() # all runs of a pipeline chronlogically ordered | ||
run = runs[-1] # latest run | ||
output = step.outputs[0] # get outputs | ||
``` | ||
|
||
### Materializing outputs (or inputs) | ||
|
||
Once an output artifact is acquired from history, one can visualize it with any chosen `Materializer`. | ||
|
||
```python | ||
df = output.read(materializer=PandasMaterializer) # get data | ||
|
||
``` | ||
|
||
### Seeing statistics and schema | ||
|
||
```python | ||
stats = output.read(materializer=StatisticsMaterializer) # get stats | ||
schema = output.read(materializer=SchemaMaterializer) # get schema | ||
``` | ||
|
||
### Retrieving Model | ||
|
||
```python | ||
model = output.read(materializer=KerasModelMaterializer) # get model | ||
``` | ||
|
||
|
||
|
||
#### Pipelines | ||
|
||
```python | ||
# get all pipelines from all stacks | ||
pipelines = repo.get_pipelines() | ||
|
||
# or get one pipeline by name and/or stack key | ||
pipeline = repo.get_pipeline(pipeline_name=..., stack_key=...) | ||
``` | ||
|
||
#### Runs | ||
|
||
```python | ||
|
||
``` | ||
|
||
#### Steps | ||
|
||
```python | ||
# at this point we switch from the `get_` paradigm to properties | ||
steps = run.steps # all steps of a pipeline | ||
step = steps[0] | ||
print(step.name) | ||
``` | ||
|
||
#### Outputs | ||
|
||
```python | ||
# all outputs of a step | ||
# if one output, then its the first element in the list | ||
# if multiple output, then in the order defined with the `Output` | ||
|
||
|
||
# will get you the value from the original materializer used in the pipeline | ||
output.read() | ||
``` | ||
|
||
## Visuals | ||
|
||
|
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
Oops, something went wrong.