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

Release 0.0.2 #2

Merged
merged 13 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This is a basic workflow to help you get started with Actions
name: CI

# Controls when the action will run. Triggers the workflow on push of a tag
on:
push:
tags:
- '*'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7

# Runs a single command using the runners shell
- name: install requirements
run: sudo apt-get update && sudo apt-get install -y make && pip install twine

# Runs a set of commands using the runners shell
- name: publish
env: # Or as an environment variable
TWINE_NON_INTERACTIVE: ${{ secrets.TWINE_NON_INTERACTIVE }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
run: |
if [ "$(cat zenml/VERSION)" = "$(echo ${GITHUB_REF} | sed 's|refs/tags/||g')" ]; then make publish; fi
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,17 @@ dmypy.json

# Pyre type checker
.pyre/


# JetBrains
.idea
__pycache__

# zenml
*.yaml
*.csv
temp/*
local_test/
.zenml/
!cloudbuild.yaml

61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.DEFAULT_GOAL := build
.PHONY: build publish package coverage test lint docs venv
PROJ_SLUG = zenml
CLI_NAME = zenml
PY_VERSION = 3.6
LINTER = pylint


build:
pip install --editable .

run:
$(CLI_NAME) run

submit:
$(CLI_NAME) submit

freeze:
pip freeze > requirements.txt

lint:
$(LINTER) $(PROJ_SLUG)

test: lint
py.test --cov-report term --cov=$(PROJ_SLUG) tests/

quicktest:
py.test --cov-report term --cov=$(PROJ_SLUG) tests/

coverage: lint
py.test --cov-report html --cov=$(PROJ_SLUG) tests/

docs: coverage
mkdir -p docs/source/_static
mkdir -p docs/source/_templates
cd docs && $(MAKE) html

answers:
cd docs && $(MAKE) html
xdg-open docs/build/html/index.html

package: clean
python setup.py sdist

publish: package
twine upload dist/*

clean:
rm -rf dist \
rm -rf docs/build \
rm -rf *.egg-info

venv :
virtualenv --python python$(PY_VERSION) venv

install:
pip install -r requirements.txt

licenses:
pip-licenses --with-url --format=rst \
--ignore-packages $(shell cat .pip-license-ignore | awk '{$$1=$$1};1')
298 changes: 280 additions & 18 deletions README.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
steps:
# build base image with tag
- name : 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'eu.gcr.io/maiot-zenml/zenml:base-$TAG_NAME', '-f', 'zenml/docker/base.Dockerfile', '.']
# push base image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'eu.gcr.io/maiot-zenml/zenml:base-$TAG_NAME']
# build CUDA image with tag
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'eu.gcr.io/maiot-zenml/zenml:cuda-$TAG_NAME', '-f', 'zenml/docker/cuda.Dockerfile', '.']
# push CUDA image
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'eu.gcr.io/maiot-zenml/zenml:cuda-$TAG_NAME']
timeout: 3600s
20 changes: 20 additions & 0 deletions docs/CODE_GUIDLINES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Styling

We follow pep-8 formatting

# Docstrings
We follow the Google-style of doc strings. E.g.:

```
This is an example of Google style.

Args:
param1: This is the first param.
param2: This is a second param.

Returns:
This is a description of what is returned.

Raises:
KeyError: Raises an exception.
```
26 changes: 26 additions & 0 deletions docs/gcp_orchestrator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
* Put a file called Dockerfile in the root of your repository
* The Dockerfile should begin with:
```dockerfile
FROM eu.gcr.io/core-engine/zenml/base:0.0.1
```
docker tag zenml:0.0.1 eu.gcr.io/core-engine/zenml/base:0.0.1


# ZenML config
# Set your GOOGLE_APPLICATION_CREDENTIALS beforehand. These should hav ethe following permissions:
* Service Account User permission
* Compute Engine Admin

```bash
zenml config artifacts set gs://path/to/artifact/store
```

```
# start a proxy
./cloud_sql_proxy -instances=core-engine:europe-west1:mlmetadata=tcp:3306 -credential_file=$GOOGLE_APPLICATION_CREDENTIALS
```

```
# change metadata store
zenml config metadata set mysql --port="3306" --host="127.0.0.1" --password="JjIwd3u7JbtveBgu" --username="mlmetadata" --database="zenml_pgo_test"
```
Binary file added docs/img/00_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added examples/__init__.py
Empty file.
Empty file.
90 changes: 90 additions & 0 deletions examples/experimental/new_step.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright (c) maiot GmbH 2020. 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 typing import List

import tensorflow as tf

from zenml.core.steps.trainer.feedforward_trainer import FeedForwardTrainer


class MyTrainer(FeedForwardTrainer):
def __init__(self,
batch_size: int = 8,
lr: float = 0.0001,
epochs: int = 1,
dropout_chance: int = 0.2,
loss: str = 'mse',
metrics: List[str] = None,
hidden_layers: List[int] = None,
hidden_activation: str = 'relu',
last_activation: str = 'sigmoid',
input_units: int = 11,
output_units: int = 1,
my_param1: int = 10,
**kwargs
):
self.batch_size = batch_size
self.lr = lr
self.epochs = epochs
self.dropout_chance = dropout_chance
self.loss = loss
self.metrics = metrics or []
self.hidden_layers = hidden_layers or [64, 32, 16]
self.hidden_activation = hidden_activation
self.last_activation = last_activation
self.input_units = input_units
self.output_units = output_units
self.my_param1 = my_param1
super().__init__(**kwargs)

def model_fn(self,
train_dataset: tf.data.Dataset,
eval_dataset: tf.data.Dataset):
train_dataset = train_dataset.batch(self.batch_size,
drop_remainder=True)
eval_dataset = eval_dataset.batch(self.batch_size, drop_remainder=True)

input_layers = [tf.keras.layers.Input(shape=(1,), name=k)
for k in train_dataset.element_spec[0].keys()]
d = tf.keras.layers.Concatenate()(input_layers)

for size in self.hidden_layers:
d = tf.keras.layers.Dense(size,
activation=self.hidden_activation)(d)
d = tf.keras.layers.Dropout(self.dropout_chance)(d)

output_layer = tf.keras.layers.Dense(self.output_units,
activation=self.last_activation,
name='tips')(d)

model = tf.keras.Model(inputs=input_layers,
outputs=output_layer)

model.compile(loss=self.loss,
optimizer=tf.keras.optimizers.Adam(lr=self.lr),
metrics=self.metrics)

model.summary()

tensorboard_callback = tf.keras.callbacks.TensorBoard(
log_dir=self.log_dir)

model.fit(train_dataset,
steps_per_epoch=2,
epochs=self.epochs,
validation_data=eval_dataset,
callbacks=[tensorboard_callback])

return model
14 changes: 14 additions & 0 deletions examples/gan/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) maiot GmbH 2020. 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.

Loading