All Questions

Filter by
Sorted by
Tagged with
11 votes
3 answers
37k views

Tensorflow==2.0.0a0 - AttributeError: module 'tensorflow' has no attribute 'global_variables_initializer'

I'm using Tensorflow==2.0.0a0 and want to run the following script: import tensorflow as tf import tensorboard import pandas as pd import matplotlib.pyplot as plt import numpy as np import ...
razimbres's user avatar
  • 4,916
4 votes
1 answer
985 views

Tensorflow model analysis, TFMA for keras model

I would like to use TFMA with keras model. The keras model was created with TF 2.0 alpha. The model is a pretrained model with a classification layer: ...
eilalan's user avatar
  • 679
4 votes
0 answers
250 views

Tensorflow/Keras local training 6x faster than distributed training

I am training a Classifier (via RNN) in Tensorflow with tf.data api, tf.keras api and tf. estimator api. In local training i got a troughput of around 240 steps/sec, than i enter distributed mode with ...
ancube's user avatar
  • 69
3 votes
1 answer
410 views

TF 2.0 - Method estimator.model_to_estimator( ) fails but model.fit works for tf.keras created model

While using the TF 2.0 Alpha and converting a working TF Keras model to TF estimator I encountered a strange error. The below code has been taken from the Tensorflow without PHD series - RNN time ...
Hasan Rafiq's user avatar
2 votes
2 answers
414 views

Project organization with Tensorflow.keras. Should one subclass tf.keras.Model?

I'm using Tensorflow 1.14 and the tf.keras API to build a number (>10) of differnet neural networks. (I'm also interested in the answers to this question using Tensorflow 2). I'm wondering how I ...
Adomas Baliuka's user avatar
2 votes
2 answers
931 views

How to build input function for a estimator created from keras model

I'm creating an estimator from keras model as below estimator = tf.keras.estimator.model_to_estimator(keras_model=keras_model, model_dir=model_dir) my model is like ...
user1779012's user avatar
2 votes
0 answers
600 views

"Epochs" instead of "Steps" in the horizontal axis in tensorboard when using model_to_estimator?

I am using keras_model_to_estimator to train an estimator and use tensorboard for analysis. The estimator logs the steps and not epochs, and hence the same appears in the x-axis in tensorboard. I ...
Saravanabalagi Ramachandran's user avatar
2 votes
0 answers
591 views

How to set loss for train_op using tf estimator API when the loss is input-dependent and implemented via a custom loss layer?

I am implementing a CNN model with tf.estimator API. Briefly, the cost/loss function is input-dependent and contains variables to be updated during training. I implemented a custom layer with ...
W. Bao's user avatar
  • 21
1 vote
2 answers
155 views

Tensorflow Keras Estimator fails on regression task while underlying model works

I use a convolutional neural network for a regression task (i.e. the final layer of the network has one neuron with linear activation) and this works fine (enough). When I try to use the exact same ...
Adomas Baliuka's user avatar
1 vote
1 answer
78 views

Dimensions Mismatch during Clone Model step of Final Export of Estimator

I'm creating a Tensorflow Estimator from a Keras model. Currently, the estimator is created, the model is trained, and the model is evaluated without issues. However, on the last evaluation, the model ...
Austin Guo's user avatar
1 vote
0 answers
269 views

tf.keras.estimator.model_to_estimator failing to convert keras model with custom and Lambda layers

I've written a model some time ago that uses a few custom layer definitions and has been trained using TF 1.12 and standalone Keras 2.2.4. I've updated the version of TF to 1.14 and switched over to ...
ilyab's user avatar
  • 229
1 vote
1 answer
793 views

Building models and estimators in tf2.0 without tf.keras

Given that layers API has been deprecated, how do I build models in tf2 without using tf.keras (or what is the recommended way to build models)? Issue #30829 has the same question, but was closed ...
Saravanabalagi Ramachandran's user avatar
1 vote
0 answers
90 views

Keras model_to_estimator doesn't log metrics on estimator.train, but logs on estimator.evaluate

I tried the keras model_to_estimator to build an estimator, but found that it wasn't logging metrics during training, although it does during evaluation. If that doesn't work out of the box, how can ...
Saravanabalagi Ramachandran's user avatar
1 vote
0 answers
282 views

Tensorflow estimator fails to converge on model converted from Keras (when using binary_crossentropy)

I've been stuck for quite a while using the model_to_estimator functionality in Tensorflow Estimators. The problem seems to be that Keras allows a binary_crossentropy loss on a single neuron Dense ...
wirtsi's user avatar
  • 105
0 votes
1 answer
359 views

Two sets of shared embeddings from one tensorflow feature?

How can I create two sets of shared embeddings from the same tensorflow feature columns? This small example import tensorflow as tf data = {"A": [0, 1, 2, 3], "B": [2, 1, 0, 3]} ...
MrCartoonology's user avatar
0 votes
1 answer
469 views

Why does this simple tf.keras model not train after converting to a tensorflow estimator?

I'm trying to convert a tf.keras model to a tensorflow estimator using tf.keras.estimator.model_to_estimator, but the resulting estimator doesn't appear to be trainable. I've tried modelling y = (x_1 ...
Pieter's user avatar
  • 11
0 votes
1 answer
1k views

How to get TensorFlow Estimator version using Python code (not CLI)

I can get the versions of TensorFlow and TensorFlow Keras using these code lines: import tensorflow as tf; print("TensorFlow version:",tf.__version__); print("TensorFlow Keras version:",tf.keras....
Dan D.'s user avatar
  • 7,997