Skip to content

Commit

Permalink
Fix setup cluster issue and Pylint issue in CI tests (#1179)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchihe committed Aug 7, 2020
1 parent 394a7da commit e0ef86b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 The Kubeflow Authors. All Rights Reserved.
# Copyright 2020 The Kubeflow Authors. 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.
Expand All @@ -20,9 +20,9 @@
import json
import os

import tensorflow as tf
import tensorflow_datasets as tfds
from tensorflow.keras import datasets, layers, models
import tensorflow as tf
from tensorflow.keras import layers, models


def make_datasets_unbatched():
Expand All @@ -34,7 +34,7 @@ def scale(image, label):
image /= 255
return image, label

datasets, info = tfds.load(name='mnist', with_info=True, as_supervised=True)
datasets, _ = tfds.load(name='mnist', with_info=True, as_supervised=True)

return datasets['train'].map(scale).cache().shuffle(BUFFER_SIZE)

Expand All @@ -61,7 +61,7 @@ def build_and_compile_cnn_model():


def decay(epoch):
if epoch < 3:
if epoch < 3: #pylint: disable=no-else-return
return 1e-3
elif epoch >= 3 and epoch < 7:
return 1e-4
Expand Down Expand Up @@ -100,7 +100,7 @@ def main(args):
# Callback for printing the LR at the end of each epoch.
class PrintLR(tf.keras.callbacks.Callback):

def on_epoch_end(self, epoch, logs=None):
def on_epoch_end(self, epoch): #pylint: disable=no-self-use
print('\nLearning rate for epoch {} is {}'.format(
epoch + 1, multi_worker_model.optimizer.lr.numpy()))

Expand All @@ -125,7 +125,7 @@ def on_epoch_end(self, epoch, logs=None):
# current task type and returns True if the worker is the chief and False
# otherwise.
def is_chief():
return (TASK_INDEX == 0)
return TASK_INDEX == 0

if is_chief():
model_path = args.saved_model_dir
Expand Down Expand Up @@ -157,5 +157,5 @@ def is_chief():
required=True,
help='Tensorflow checkpoint directory.')

args = parser.parse_args()
main(args)
parsed_args = parser.parse_args()
main(parsed_args)
1 change: 1 addition & 0 deletions prow_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ workflows:
- test/*
- vendor/*
- sdk/*
- examples/*
params:
registry: "gcr.io/kubeflow-ci"
tfJobVersion: v1
Expand Down
2 changes: 2 additions & 0 deletions py/kubeflow/tf_operator/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ def setup_cluster(args):
cluster_name = args.cluster
zone = args.zone
machine_type = "n1-standard-8"
cluster_version = "1.14.10-gke.42"

cluster_request = {
"cluster": {
"name": cluster_name,
"description": "A GKE cluster for TF.",
"initialNodeCount": 1,
"initialClusterVersion": cluster_version,
"nodeConfig": {
"machineType": machine_type,
"oauthScopes": [
Expand Down

0 comments on commit e0ef86b

Please sign in to comment.