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

New stack showcase #91

Merged
merged 20 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ celerybeat.pid

# Environments
.env
.venv
.venv*
env/
venv/
ENV/
Expand Down
26 changes: 0 additions & 26 deletions stack-showcase/Dockerfile

This file was deleted.

Binary file added stack-showcase/_assets/cloud_mcp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added stack-showcase/_assets/cloud_mcp_predictions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added stack-showcase/_assets/cloud_mcp_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 0 additions & 56 deletions stack-showcase/app.py

This file was deleted.

13 changes: 0 additions & 13 deletions stack-showcase/configs/deployment.yaml

This file was deleted.

10 changes: 4 additions & 6 deletions stack-showcase/configs/feature_engineering.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ settings:
docker:
required_integrations:
- sklearn
requirements:
- pyarrow

# configuration of the Model Control Plane
model:
name: breast_cancer_classifier
license: Apache 2.0
description: Classification of Breast Cancer Dataset.
tags: ["classification", "sklearn"]
# pipeline configuration
test_size: 0.35
9 changes: 4 additions & 5 deletions stack-showcase/configs/inference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ settings:
docker:
required_integrations:
- sklearn
requirements:
- pyarrow

# configuration of the Model Control Plane
model:
name: breast_cancer_classifier
version: production
license: Apache 2.0
description: Classification of Breast Cancer Dataset.
tags: ["classification", "sklearn"]
name: "breast_cancer_classifier"
version: "production"
18 changes: 18 additions & 0 deletions stack-showcase/configs/training_rf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# environment configuration
settings:
docker:
required_integrations:
- sklearn
requirements:
- pyarrow

# configuration of the Model Control Plane
model:
name: breast_cancer_classifier
license: Apache 2.0
description: A breast cancer classifier
tags: ["breast_cancer", "classifier","rf"]

# Configure the pipeline
parameters:
model_type: "rf" # Choose between rf/sgd
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ settings:
- sklearn
requirements:
- pyarrow
- huggingface_hub

# configuration of the Model Control Plane
model:
name: breast_cancer_classifier
license: Apache 2.0
description: Classification of Breast Cancer Dataset.
tags: ["classification", "sklearn"]
description: A breast cancer classifier
tags: ["breast_cancer", "classifier","rf"]

# Configure the pipeline
parameters:
model_type: "rf" # Choose between rf/sgd

steps:
model_trainer:
step_operator: sagemaker-eu
settings:
step_operator.sagemaker:
estimator_args:
instance_type: "ml.m5.large"
instance_type : ml.m5.large
18 changes: 18 additions & 0 deletions stack-showcase/configs/training_sgd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# environment configuration
settings:
docker:
required_integrations:
- sklearn
requirements:
- pyarrow

# configuration of the Model Control Plane
model:
name: breast_cancer_classifier
license: Apache 2.0
description: A breast cancer classifier
tags: ["breast_cancer", "classifier","sgd"]

# Configure the pipeline
parameters:
model_type: "sgd" # Choose between rf/sgd
26 changes: 26 additions & 0 deletions stack-showcase/configs/training_sgd_sagemaker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# environment configuration
settings:
docker:
required_integrations:
- sklearn
requirements:
- pyarrow

# configuration of the Model Control Plane
model:
name: breast_cancer_classifier
license: Apache 2.0
description: A breast cancer classifier
tags: ["breast_cancer", "classifier","sgd"]

# Configure the pipeline
parameters:
model_type: "sgd" # Choose between rf/sgd

steps:
model_trainer:
step_operator: sagemaker-eu
settings:
step_operator.sagemaker:
estimator_args:
instance_type : ml.m5.large
20 changes: 17 additions & 3 deletions stack-showcase/pipelines/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# {% include 'template/license_header' %}
# Apache Software License 2.0
#
# Copyright (c) ZenML GmbH 2024. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .feature_engineering import feature_engineering
from .inference import inference
from .training import breast_cancer_training
from .deployment import breast_cancer_deployment_pipeline
from .training import training
38 changes: 0 additions & 38 deletions stack-showcase/pipelines/deployment.py

This file was deleted.

31 changes: 27 additions & 4 deletions stack-showcase/pipelines/feature_engineering.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
# {% include 'template/license_header' %}
# Apache Software License 2.0
#
# Copyright (c) ZenML GmbH 2024. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import random
from typing import List, Optional
import random

from steps import (
data_loader,
data_preprocessor,
data_splitter,
)

from zenml import pipeline
from zenml.logger import get_logger

Expand All @@ -21,6 +37,7 @@ def feature_engineering(
normalize: Optional[bool] = None,
drop_columns: Optional[List[str]] = None,
target: Optional[str] = "target",
random_state: int = None,
):
"""
Feature engineering pipeline.
Expand All @@ -34,11 +51,16 @@ def feature_engineering(
normalize: If `True` dataset will be normalized with MinMaxScaler
drop_columns: List of columns to drop from dataset
target: Name of target column in dataset
random_state: Random state to configure the data loader

Returns:
The processed datasets (dataset_trn, dataset_tst).
"""
### ADD YOUR OWN CODE HERE - THIS IS JUST AN EXAMPLE ###
# Link all the steps together by calling them and passing the output
# of one step as the input of the next step.
raw_data = data_loader(random_state=random.randint(0, 100), target=target)
if random_state is None:
random_state = random.randint(0,1000)
raw_data = data_loader(random_state=random_state, target=target)
dataset_trn, dataset_tst = data_splitter(
dataset=raw_data,
test_size=test_size,
Expand All @@ -50,5 +72,6 @@ def feature_engineering(
normalize=normalize,
drop_columns=drop_columns,
target=target,
random_state=random_state,
)
return dataset_trn, dataset_tst
Loading
Loading