Skip to content

Commit

Permalink
Upgrade Tensorflow version to v2.13.0
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
  • Loading branch information
tenzen-y committed Aug 13, 2023
1 parent 888bec3 commit 9a84472
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ psutil==5.9.4
rfc3339>=6.2
grpcio>=1.41.1
googleapis-common-protos==1.6.0
tensorflow==2.11.0
tensorflow==2.13.0
protobuf<=3.20.3
3 changes: 2 additions & 1 deletion cmd/suggestion/nas/enas/v1beta1/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
grpcio>=1.41.1
googleapis-common-protos==1.6.0
cython>=0.29.24
tensorflow==2.11.0
tensorflow==2.13.0
protobuf<=3.20.3
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scipy>=1.7.2
tensorflow==2.11.0
tensorflow==2.13.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tensorflow==2.11.0
tensorflow==2.13.0
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
# https://github.com/kubeflow/katib/blob/master/examples/v1beta1/kubeflow-training-operator/tfjob-mnist-with-summaries.yaml#L16-L22

import tensorflow as tf
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator, TensorEvent
from tensorboard.backend.event_processing.tag_types import TENSORS
from tensorboard.compat.proto import tensor_pb2
import os
from datetime import datetime
import rfc3339
from datetime import datetime
from dataclasses import is_dataclass
import api_pb2
from logging import getLogger, StreamHandler, INFO
from pkg.metricscollector.v1beta1.common import const
Expand All @@ -41,27 +44,38 @@ def find_all_files(directory):
for f in files:
yield os.path.join(root, f)

@staticmethod
def new_metric_log(metric_name: str, wall_time: float, tensor: tensor_pb2.TensorProto) -> api_pb2.MetricLog:
return api_pb2.MetricLog(
time_stamp=rfc3339.rfc3339(datetime.fromtimestamp(wall_time)),
metric=api_pb2.Metric(
name=metric_name,
value=str(tf.make_ndarray(tensor))
)
)

def parse_summary(self, tfefile):
metric_logs = []
event_accumulator = EventAccumulator(tfefile, size_guidance={'tensors': 0})
event_accumulator = EventAccumulator(tfefile, size_guidance={TENSORS: 0})
event_accumulator.Reload()
for tag in event_accumulator.Tags()['tensors']:
for tag in event_accumulator.Tags()[TENSORS]:
for m in self.metric_names:

tfefile_parent_dir = os.path.dirname(m) if len(m.split("/")) >= 2 else os.path.dirname(tfefile)
basedir_name = os.path.dirname(tfefile)
if not tag.startswith(m.split("/")[-1]) or not basedir_name.endswith(tfefile_parent_dir):
continue

for wall_time, step, tensor in event_accumulator.Tensors(tag):
ml = api_pb2.MetricLog(
time_stamp=rfc3339.rfc3339(datetime.fromtimestamp(wall_time)),
metric=api_pb2.Metric(
name=m,
value=str(tf.make_ndarray(tensor))
)
)
metric_logs.append(ml)
# Since Tensorboard v2.12.0, the 'TensorEvent' typed was changed from namedtuple to dataclass.
# REF: https://github.com/tensorflow/tensorboard/commit/1975529d953eff55d279ee036240e4db4cb0d57c
if is_dataclass(TensorEvent):
# Tensorboard >= v2.12.0
for tensors in event_accumulator.Tensors(tag):
metric_logs.append(self.new_metric_log(m, tensors.wall_time, tensors.tensor_proto))
else:
# Tensorboard < v2.12.0
for wall_time, step, tensor in event_accumulator.Tensors(tag):
metric_logs.append(self.new_metric_log(m, wall_time, tensor))

return metric_logs

Expand Down
4 changes: 2 additions & 2 deletions sdk/python/v1beta1/kubeflow/katib/constants/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@

# Supported base images for the Katib Trials.
# TODO (andreyvelich): Implement list_base_images function to get each image description.
BASE_IMAGE_TENSORFLOW = "docker.io/tensorflow/tensorflow:2.11.0"
BASE_IMAGE_TENSORFLOW_GPU = "docker.io/tensorflow/tensorflow:2.11.0-gpu"
BASE_IMAGE_TENSORFLOW = "docker.io/tensorflow/tensorflow:2.13.0"
BASE_IMAGE_TENSORFLOW_GPU = "docker.io/tensorflow/tensorflow:2.13.0-gpu"
BASE_IMAGE_PYTORCH = "docker.io/pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime"
BASE_IMAGE_MXNET = "docker.io/mxnet/python:1.9.1_native_py3"

Expand Down

0 comments on commit 9a84472

Please sign in to comment.