GithubHelp home page GithubHelp logo

Comments (5)

cweill avatar cweill commented on August 17, 2024

Are you using the new TPUEstimator? Do you have a copy of the tutorial you can share that has this problem?

from adanet.

sdwldchl avatar sdwldchl commented on August 17, 2024

In simple_dnn.py, I added two lines of codes to output the iteration_step:

def build_subnetwork_train_op(self, subnetwork, loss, var_list, labels,
                                                  iteration_step, summary, previous_ensemble):
"""See adanet.subnetwork.Builder."""
with tf.name_scope(""):       # output iteration_step
  summary.scalar("iteration_step", iteration_step)
#NOTE: The adanet.Estimator increments the global step.
update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
  return self._optimizer.minimize(loss=loss, var_list=var_list)

In the Customizing AdaNet example, I modified the input_fn function:

def input_fn(partition, training, batch_size):
"""Generate an input_fn for the Estimator."""
  def _input_fn():
    if partition == "train":
     dataset = tf.data.Dataset.from_generator(
     generator(x_train, y_train), (tf.float32, tf.int32), ((28, 28), ()))
   else:
    dataset = tf.data.Dataset.from_generator(
    generator(x_test, y_test), (tf.float32, tf.int32), ((28, 28), ()))

# We call repeat after shuffling, rather than before, to prevent separate
# epochs from blending together.
  if training:
    dataset = dataset.shuffle(10 * batch_size, seed=RANDOM_SEED).repeat()

  dataset = dataset.map(preprocess_image).batch(batch_size)
  return dataset.repeat()
return _input_fn

Also, argument train_distribution was explicitly specified in configuration for estimator:

devices = ["/device:GPU:0", "/device:GPU:1"]
distribution = tf.contrib.distribute.MirroredStrategy(devices=devices)
config = tf.estimator.RunConfig(
    save_checkpoints_steps=50000,
    save_summary_steps=50000,
    train_distribute=distribution,
    tf_random_seed=RANDOM_SEED)

No other changes were made. Thanks in advance.

from adanet.

sdwldchl avatar sdwldchl commented on August 17, 2024

Are you using the new TPUEstimator? Do you have a copy of the tutorial you can share that has this problem?

In simple_dnn.py, I added two lines of codes to output the iteration_step:

def build_subnetwork_train_op(self, subnetwork, loss, var_list, labels,
                                                  iteration_step, summary, previous_ensemble):
"""See adanet.subnetwork.Builder."""
with tf.name_scope(""):       # output iteration_step
  summary.scalar("iteration_step", iteration_step)
#NOTE: The adanet.Estimator increments the global step.
update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
  return self._optimizer.minimize(loss=loss, var_list=var_list)

In the Customizing AdaNet example, I modified the input_fn function:

def input_fn(partition, training, batch_size):
"""Generate an input_fn for the Estimator."""
  def _input_fn():
    if partition == "train":
     dataset = tf.data.Dataset.from_generator(
     generator(x_train, y_train), (tf.float32, tf.int32), ((28, 28), ()))
   else:
    dataset = tf.data.Dataset.from_generator(
    generator(x_test, y_test), (tf.float32, tf.int32), ((28, 28), ()))

# We call repeat after shuffling, rather than before, to prevent separate
# epochs from blending together.
  if training:
    dataset = dataset.shuffle(10 * batch_size, seed=RANDOM_SEED).repeat()

  dataset = dataset.map(preprocess_image).batch(batch_size)
  return dataset.repeat()
return _input_fn

Also, argument train_distribution was explicitly specified in configuration for estimator:

devices = ["/device:GPU:0", "/device:GPU:1"]
distribution = tf.contrib.distribute.MirroredStrategy(devices=devices)
config = tf.estimator.RunConfig(
    save_checkpoints_steps=50000,
    save_summary_steps=50000,
    train_distribute=distribution,
    tf_random_seed=RANDOM_SEED)

No other changes were made. Thanks in advance.

from adanet.

cweill avatar cweill commented on August 17, 2024

I see you are using tf.contrib.distribute.MirroredStrategy(devices=devices). I wonder if that could be the issue. I'll have a look.

from adanet.

futurely avatar futurely commented on August 17, 2024

All methods of Summary should add an argument , collections=None.

https://github.com/tensorflow/adanet/blob/master/adanet/core/summary.py#L38

from adanet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.