Skip to content

Commit 2081558

Browse files
committed
updated with redis ai examples
1 parent 2f507d0 commit 2081558

9 files changed

+1366
-772
lines changed

mnist_model/pipeline_conda_environment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ dependencies:
77
- graphviz
88
- pip:
99
- grpcio>=1.0
10-
- tensorflow==1.13.1
10+
- tensorflow==1.12.0
1111
- pipeline-runtime==1.0.8
1212
# These are required
1313
- pandas
14-
- mlflow==0.9.1
14+
- mlflow
1515
- click==6.7
1616
- scikit-learn
1717
- pillow

mnist_model/pipeline_train.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ def on_train_end(self, logs={}):
8181
message = f'Best validation loss = {valid_loss:.4f} Training Loss = {train_loss:.2f} Validation accuracy = {100*valid_acc:.2f}%'
8282
self.report_stats(message)
8383

84-
def on_train_batch_begin(self, batch, logs={}):
85-
pass
86-
87-
def on_train_batch_end(self, batch, logs={}):
88-
pass
89-
90-
9184
class MLflowLogger(Callback):
9285
"""
9386
Keras callback for logging metrics and final model with MLflow.
@@ -138,12 +131,6 @@ def on_train_end(self, *args, **kwargs):
138131
for name, value in zip(self._model.metrics_names, valid_res):
139132
mlflow.log_metric("valid_{}".format(name), value)
140133

141-
def on_train_batch_begin(self, batch, logs={}):
142-
pass
143-
144-
def on_train_batch_end(self, batch, logs={}):
145-
pass
146-
147134

148135
@click.command(help="Trains a Keras model mnist dataset."
149136
"The model and its metrics are logged with mlflow.")

redis/RedisAI.ipynb

Lines changed: 0 additions & 757 deletions
This file was deleted.

redis/RedisAI_PyTorch.ipynb

Lines changed: 599 additions & 0 deletions
Large diffs are not rendered by default.

redis/RedisAI_TensorFlow.ipynb

Lines changed: 738 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def pre_process_3ch(image):
2+
return image.float().div(255).unsqueeze(0)
3+
4+
def pre_process_4ch(image):
5+
return image.float().div(255)[:,:,:-1].contiguous().unsqueeze(0)
6+
7+
def post_process(output):
8+
# tf model has 1001 classes, hence negative 1
9+
return output.max(1)[1] - 1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def pre_process_3ch(image):
2+
return image.float().div(255).unsqueeze(0)
3+
4+
def pre_process_4ch(image):
5+
return image.float().div(255)[:,:,:-1].contiguous().unsqueeze(0)
6+
7+
def post_process(output):
8+
# tf model has 1001 classes, hence negative 1
9+
return output.max(1)[1] - 1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def pre_process_3ch(image):
2+
return image.float().div(255).unsqueeze(0)
3+
4+
def pre_process_4ch(image):
5+
return image.float().div(255)[:,:,:-1].contiguous().unsqueeze(0)
6+
7+
def post_process(output):
8+
# tf model has 1001 classes, hence negative 1
9+
return output.max(1)[1] - 1

0 commit comments

Comments
 (0)