AdaNet is a lightweight TensorFlow-based framework for automatically learning high-quality models with minimal expert intervention

Overview

AdaNet

adanet_tangram_logo

Documentation Status PyPI version Travis codecov Gitter Downloads License

AdaNet is a lightweight TensorFlow-based framework for automatically learning high-quality models with minimal expert intervention. AdaNet builds on recent AutoML efforts to be fast and flexible while providing learning guarantees. Importantly, AdaNet provides a general framework for not only learning a neural network architecture, but also for learning to ensemble to obtain even better models.

This project is based on the AdaNet algorithm, presented in “AdaNet: Adaptive Structural Learning of Artificial Neural Networks” at ICML 2017, for learning the structure of a neural network as an ensemble of subnetworks.

AdaNet has the following goals:

  • Ease of use: Provide familiar APIs (e.g. Keras, Estimator) for training, evaluating, and serving models.
  • Speed: Scale with available compute and quickly produce high quality models.
  • Flexibility: Allow researchers and practitioners to extend AdaNet to novel subnetwork architectures, search spaces, and tasks.
  • Learning guarantees: Optimize an objective that offers theoretical learning guarantees.

The following animation shows AdaNet adaptively growing an ensemble of neural networks. At each iteration, it measures the ensemble loss for each candidate, and selects the best one to move onto the next iteration. At subsequent iterations, the blue subnetworks are frozen, and only yellow subnetworks are trained:

adanet_tangram_logo

AdaNet was first announced on the Google AI research blog: "Introducing AdaNet: Fast and Flexible AutoML with Learning Guarantees".

This is not an official Google product.

Features

AdaNet provides the following AutoML features:

Example

A simple example of learning to ensemble linear and neural network models:

import adanet
import tensorflow as tf

# Define the model head for computing loss and evaluation metrics.
head = MultiClassHead(n_classes=10)

# Feature columns define how to process examples.
feature_columns = ...

# Learn to ensemble linear and neural network models.
estimator = adanet.AutoEnsembleEstimator(
    head=head,
    candidate_pool={
        "linear":
            tf.estimator.LinearEstimator(
                head=head,
                feature_columns=feature_columns,
                optimizer=...),
        "dnn":
            tf.estimator.DNNEstimator(
                head=head,
                feature_columns=feature_columns,
                optimizer=...,
                hidden_units=[1000, 500, 100])},
    max_iteration_steps=50)

estimator.train(input_fn=train_input_fn, steps=100)
metrics = estimator.evaluate(input_fn=eval_input_fn)
predictions = estimator.predict(input_fn=predict_input_fn)

Getting Started

To get you started:

Requirements

Requires Python 3.6 or above.

adanet is built on TensorFlow 2.1. It depends on bug fixes and enhancements not present in TensorFlow releases prior to 2.1. You must install or upgrade your TensorFlow package to at least 2.1:

$ pip install "tensorflow==2.1"

Installing with Pip

You can use the pip package manager to install the official adanet package from PyPi:

$ pip install adanet

Installing from Source

To install from source first you'll need to install bazel following their installation instructions.

Next clone the adanet repository:

$ git clone https://github.com/tensorflow/adanet
$ cd adanet

From the adanet root directory run the tests:

$ bazel build -c opt //...
$ python3 -m nose

Once you have verified that the tests have passed, install adanet from source as a pip package .

You are now ready to experiment with adanet.

import adanet

Citing this Work

If you use this AdaNet library for academic research, you are encouraged to cite the following paper from the ICML 2019 AutoML Workshop:

@misc{weill2019adanet,
    title={AdaNet: A Scalable and Flexible Framework for Automatically Learning Ensembles},
    author={Charles Weill and Javier Gonzalvo and Vitaly Kuznetsov and Scott Yang and Scott Yak and Hanna Mazzawi and Eugen Hotaj and Ghassen Jerfel and Vladimir Macko and Ben Adlam and Mehryar Mohri and Corinna Cortes},
    year={2019},
    eprint={1905.00080},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

License

AdaNet is released under the Apache License 2.0.

Comments
  • Deserializing Architecture json file

    Deserializing Architecture json file

    NOTE: I am running Adanet on windows 10 using python 3.5.2

    Has anybody ran into this error: TypeError: the JSON object must be str, not 'bytes'? I am currently debugging the code and this is what I have so far:

    gfile.read() outputs bytes instead of string. This causes an error when _Architecture.deserialize() uses json.loads() which requires a string object.

    https://github.com/tensorflow/adanet/blob/cb9c718c35b5d16e05b51f15040b4b448798c5d2/adanet/core/estimator.py#L1145-L1146

    https://github.com/tensorflow/adanet/blob/cb9c718c35b5d16e05b51f15040b4b448798c5d2/adanet/core/architecture.py#L103-L119

    bug 
    opened by MajesticKhan 14
  • ImportError: cannot import name 'report_pb2'

    ImportError: cannot import name 'report_pb2'

    I'm using Winpython 3.6, bazel test -c opt returns no error, I can install the pip package.

    But when I try to import adanet I get "ImportError: cannot import name 'report_pb2'"

    Full error message is:

    Traceback (most recent call last): File "", line 1, in File "C:\Users\Michael\Desktop\WinPython3-6GPU\examples\Sonstiges\adanet\adanet_init_.py", line 22, in from adanet.core import Ensemble File "C:\Users\Michael\Desktop\WinPython3-6GPU\examples\Sonstiges\adanet\adanet\core_init_.py", line 25, in from adanet.core.estimator import Estimator File "C:\Users\Michael\Desktop\WinPython3-6GPU\examples\Sonstiges\adanet\adanet\core\estimator.py", line 33, in from adanet.core.report_accessor import _ReportAccessor File "C:\Users\Michael\Desktop\WinPython3-6GPU\examples\Sonstiges\adanet\adanet\core\report_accessor.py", line 24, in from adanet.core import report_pb2 as report_proto ImportError: cannot import name 'report_pb2'

    Any idea why?

    bug 
    opened by michael20at 14
  • [Question] Assertion error using MirroredStrategy

    [Question] Assertion error using MirroredStrategy

    What is the actual reason for this error?

    INFO:tensorflow:Error reported to Coordinator: 
    Traceback (most recent call last):
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/python/training/coordinator.py", line 297, in stop_on_exception
        yield
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/contrib/distribute/python/mirrored_strategy.py", line 795, in run
        self.main_result = self.main_fn(*self.main_args, **self.main_kwargs)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1195, in _call_model_fn
        model_fn_results = self._model_fn(features=features, **kwargs)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/adanet/core/estimator.py", line 1121, in _adanet_model_fn
        previous_ensemble_spec=previous_ensemble_spec)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/adanet/core/iteration.py", line 261, in build_iteration
        summary=summary)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/adanet/core/candidate.py", line 145, in build_candidate
        decay=self._adanet_loss_decay)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/python/training/moving_averages.py", line 84, in assign_moving_average
        with ops.colocate_with(variable):
      File "//anaconda/envs/ws/lib/python3.6/contextlib.py", line 81, in __enter__
        return next(self.gen)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 4094, in _colocate_with_for_gradient
        with self.colocate_with(op, ignore_existing):
      File "//anaconda/envs/ws/lib/python3.6/contextlib.py", line 81, in __enter__
        return next(self.gen)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 4146, in colocate_with
        op = internal_convert_to_tensor_or_indexed_slices(op, as_ref=True).op
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1307, in internal_convert_to_tensor_or_indexed_slices
        value, dtype=dtype, name=name, as_ref=as_ref)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1146, in internal_convert_to_tensor
        ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
      File "//anaconda/envs/ws/lib/python3.6/site-packages/tensorflow/contrib/distribute/python/values.py", line 439, in _tensor_conversion_mirrored
        assert not as_ref
    AssertionError
    

    The code for estimator is given below

        distribution_strategy = tf.contrib.distribute.MirroredStrategy()
        runConfig = tf.estimator.RunConfig(
            train_distribute=distribution_strategy,
            eval_distribute=distribution_strategy,
            save_checkpoints_steps=100,
            save_summary_steps=100,
            tf_random_seed=RANDOM_SEED)
        estimator = adanet.Estimator(
            model_dir = OUTPUT_DIR,
            # metric_fn=custom_metrics,
            # adanet_loss_decay=0.99,
            head=tf.contrib.estimator.multi_label_head(
                name="name",
                n_classes=len(CONFIG['LABELS']),
                # classes_for_class_based_metrics= [5,6]
            ),
            subnetwork_generator=simple_dnn.Generator(
                learn_mixture_weights=True,
                dropout=CONFIG["DROPOUT"],
                feature_columns=get_feature_columns(),
                optimizer=tf.train.AdamOptimizer(learning_rate=ADANET_LEARNING_RATE),
                seed=RANDOM_SEED),
            max_iteration_steps=NUM_EPOCHS // ADANET_ITERATIONS,
            evaluator=adanet.Evaluator(
                input_fn=lambda : validation_input_fn(batch_size=BATCH_SIZE, num_epochs=NUM_EPOCHS),
                steps=EVAL_STEPS),
            config=runConfig)
    

    The code runs without the distribution strategy configuration.

    opened by shawpan 11
  • Failing tutorial adanet_tpu.ipynb during evaluation

    Failing tutorial adanet_tpu.ipynb during evaluation

    Unfortunately an example adanet_tpu.ipynb has failed on me.

    it fails with a bunch of stack traces, please find more details in attached document. One from the top is

    AbortedError: Session 5a5ab9da26cfbcc9 is not found.
    

    https://colab.research.google.com/drive/1MM5EpwS0j4VQkDIcaQ7qNU71Nrfo3-cL#scrollTo=-Fhi1SjkzVBt

    bug 
    opened by lc0 9
  • Error running adanet_objective on Windows 7 (Japanese) with Python 3

    Error running adanet_objective on Windows 7 (Japanese) with Python 3

    I try to run example on Windows 7 (Japanese) . https://github.com/tensorflow/adanet/blob/master/adanet/examples/tutorials/adanet_objective.ipynb And this error occured.

    INFO:tensorflow:Encountered end of input during report materialization INFO:tensorflow:Materialized subnetwork_reports. Traceback (most recent call last): File "", line 1, in File "", line 43, in train_and_evaluate File "C:\Users\XXXXX\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\estimator\training.py", line 471, in train_and_evaluate return executor.run() File "C:\Users\XXXXX\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\estimator\training.py", line 610, in run return self.run_local() File "C:\Users\XXXXX\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\estimator\training.py", line 711, in run_local saving_listeners=saving_listeners) File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\estimator.py", line 461,in train self._prepare_next_iteration() File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\estimator.py", line 569,in _prepare_next_iteration tf.estimator.ModeKeys.EVAL, params) File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\estimator.py", line 541,in _call_adanet_model_fn self._model_fn(features, labels, mode, params) File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\estimator.py", line 1083, in _model_fn self._materialize_report(current_iteration) File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\estimator.py", line 752,in _materialize_report materialized_reports) File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\report_accessor.py", line 190, in write_iteration_report materialized_reports), File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\report_accessor.py", line 150, in _create_iteration_report_pb iteration_report_pb.subnetwork_reports.extend(subnetwork_report_pb_list) File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\report_accessor.py", line 137, in _create_subnetwork_report_proto dictionary=materialized_subnetwork_report.metrics) File "C:\Anaconda3_5_2\lib\site-packages\adanet\core\report_accessor.py", line 114, in _update_proto_map_from_dict field[key].string_value = six.u(value) ValueError: b"\n\x83\x01\n;adanet/iteration_2/ensemble_2_layer_dnn/architecture/adanetB:\x08\x07\x12\x00B4| b'1_layer_dnn' | b'2_layer_dnn' | b'2_layer_dnn' |J\x08\n\x06\n\x04text" has type str, but isn't valid UTF-8 encoding. Non-UTF-8 strings must be converted to unicode objects before being added.

    bug 
    opened by tanaka-jp 9
  • make gpu allow_growth=True

    make gpu allow_growth=True

    When I was using AdaNet, I found that the model always took the whole available memory on GPU. Therefore, I did these modifications, to make sure that it only takes the GPU memory it needs, so we could utilize AdaNet and GPU better.

    cla: yes 
    opened by eustomaqua 6
  • Input shape in ensemble_t0_DNNEstimator1

    Input shape in ensemble_t0_DNNEstimator1

    Hi dear

    I met an error when combine the DNNEstimator it looks like following things:

    ` return _get_logits() File "C:\Users\weizhen.zhao\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\feature_column\feature_column.py", line 205, in _get_logits tensor, shape=(batch_size, num_elements)) File "C:\Users\weizhen.zhao\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 7760, in reshape "Reshape", tensor=tensor, shape=shape, name=name) File "C:\Users\weizhen.zhao\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "C:\Users\weizhen.zhao\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\util\deprecation.py", line 488, in new_func return func(*args, **kwargs) File "C:\Users\weizhen.zhao\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 3274, in create_op op_def=op_def) File "C:\Users\weizhen.zhao\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1770, in init self._traceback = tf_stack.extract_stack()

    InvalidArgumentError (see above for traceback): Input to reshape is a tensor with 196608 values, but the requested shape has 256 [[node adanet/iteration_0/ensemble_t0_DNNEstimator1/weighted_subnetwork_0/subnetwork/dnn/input_from_feature_columns/input_layer/a/Reshape (defined at C:\Users\weizhen.zhao\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\estimator\python\estimator\dnn.py:161) = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"](IteratorGetNext/_145, adanet/iteration_0/ensemble_t0_DNNEstimator1/weighted_subnetwork_0/subnetwork/dnn/input_from_feature_columns/input_layer/a/Reshape/shape)]] [[{{node adanet/iteration_0/ensemble_t0_DNNEstimator1/weighted_subnetwork_0/subnetwork/dnn/zero_fraction_1/Mean/_195}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_227_a...ion_1/Mean", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

    Process finished with exit code 1`

    and my code is as the following: `

    def train(self, training_data, cfg=None, **kwargs):

        intent_dict = self._create_intent_dict(training_data)
    
        if len(intent_dict) < 2:
            logger.error("Can not train an intent classifier. "
                         "Need at least 2 different classes. "
                         "Skipping training of intent classifier.")
            return
    
        self.inv_intent_dict = {v: k for k, v in intent_dict.items()}
        self.encoded_all_intents = self._create_encoded_intents(intent_dict)
    
        X, Y, intents_for_X = self._prepare_data_for_training(training_data, intent_dict)
    
        num_classes = len(intent_dict)
    
        head = tf.contrib.estimator.multi_class_head(n_classes=num_classes)
    
        feature_names = ['a']
        feature_columns = [tf.feature_column.numeric_column(k) for k in feature_names]
    
        def input_fn():
            def gen1(a, b):
                return {'a': a}, b
    
            dataset = tf.data.Dataset.from_tensor_slices((X, intents_for_X)).map(gen1)
            dataset = dataset.batch(self.batch_size)
            iterator = dataset.make_one_shot_iterator()
            data, labels = iterator.get_next()
            return data, labels
    
        estimator = adanet.AutoEnsembleEstimator(head=head,
                                                 candidate_pool={
                                                         tf.contrib.estimator.LinearEstimator(
                                                             head = head,
                                                             feature_columns=feature_columns,
                                                             optimizer='Ftrl'
                                                         ),
                                                         tf.contrib.estimator.DNNEstimator(
                                                             head=head,
                                                             feature_columns=feature_columns,
                                                             optimizer='Adagrad',
                                                             hidden_units=[768, 256])},
                                                 max_iteration_steps=50
                                                 )
    
        estimator.train(input_fn=lambda: input_fn(), steps=self.epochs)`
    

    when I debug it in the pycharm the X is ndarray with shape of [2145,767] image image

    intents_for_X is ndarray with shape of [2145,1]

    and there is 93 classes in total

    Can you give me some advice to solve this problem?

    Thanks Weizhen

    opened by weizhenzhao 6
  • Training takes > 1 day on Boston Housing example using 8 GPU machine

    Training takes > 1 day on Boston Housing example using 8 GPU machine

    Using tf 1.9.0 and running example notebook. I think the problem is in the eval spec definition which has this code section:

    eval_spec = tf.estimator.EvalSpec(
          input_fn=input_fn("test", training=False, batch_size=BATCH_SIZE),
          steps=None,
          start_delay_secs=1,
          throttle_secs=1,
      )
    

    This seems to cause evaluation every 1 second, and lead to a ginormous tf.events file (>20 GB).

    bug 
    opened by zjost 6
  • [Question] How to remove WARNING: `persisted_tensors` is deprecated, please use `shared` instead

    [Question] How to remove WARNING: `persisted_tensors` is deprecated, please use `shared` instead

    WARNING:tensorflow:From //anaconda/envs/ws/lib/python3.6/site-packages/adanet/examples/simple_dnn.py:104: calling Subnetwork.__new__ (from adanet.core.subnetwork.generator) with persisted_tensors is deprecated and will be removed in a future version. Instructions for updating:persisted_tensorsis deprecated, please usesharedinstead.

    question 
    opened by shawpan 6
  • [Question]distrubute training

    [Question]distrubute training

    Hi, I have used two GPUs for distributed training, using a custom subnet. and it works well when using single GPU to run. but there is an error when using Multiple GPUs by distribution = tf.contrib.distribute.MirroredStrategy()

    2018-12-29 03:48:10.474563: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/device:GPU:0 with 14874 MB memory) -> physical GPU (device: 0, name: Tesla V100-SXM2-16GB, pci bus id: 0000:2d:00.0, compute capability: 7.0) 2018-12-29 03:48:10.474844: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/device:GPU:1 with 14874 MB memory) -> physical GPU (device: 1, name: Tesla V100-SXM2-16GB, pci bus id: 0000:32:00.0, compute capability: 7.0) INFO:tensorflow:A GPU is available on the machine, consider using NCHW data format for increased speed on GPU. INFO:tensorflow:Error reported to Coordinator: No variables to optimize. Traceback (most recent call last): File "/root/anaconda3/envs/tianxh_py36/lib/python3.6/site-packages/tensorflow/python/training/coordinator.py", line 297, in stop_on_exception yield File "/root/anaconda3/envs/tianxh_py36/lib/python3.6/site-packages/tensorflow/contrib/distribute/python/mirrored_strategy.py", line 797, in run self.main_result = self.main_fn(*self.main_args, **self.main_kwargs) File "/root/anaconda3/envs/tianxh_py36/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1195, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "/home/tianxh/AdaNet/adanet/core/estimator.py", line 1121, in _adanet_model_fn previous_ensemble_spec=previous_ensemble_spec) File "/home/tianxh/AdaNet/adanet/core/iteration.py", line 257, in build_iteration labels=labels) File "/home/tianxh/AdaNet/adanet/core/ensemble.py", line 526, in append_new_subnetwork previous_ensemble_spec=ensemble_spec) File "/home/tianxh/AdaNet/adanet/core/ensemble.py", line 663, in _build_ensemble_spec previous_ensemble=previous_ensemble)) File "tianxh_test.py", line 301, in build_subnetwork_train_op return optimizer.minimize(loss, var_list=var_list) File "/root/anaconda3/envs/tianxh_py36/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 400, in minimize grad_loss=grad_loss) File "/root/anaconda3/envs/tianxh_py36/lib/python3.6/site-packages/tensorflow/contrib/estimator/python/estimator/extenders.py", line 303, in compute_gradients return self._optimizer.compute_gradients(*args, **kwargs) File "/root/anaconda3/envs/tianxh_py36/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 513, in compute_gradients raise ValueError("No variables to optimize.")

    it seems that the first thread is ok, the second thread can't get vars through tf.trainable_variables() var_list comes from adanet/core/ensemble.py line495 var_list = tf.trainable_variables()

    Could you please give some advice? Thanks

    question 
    opened by tianxh1212 6
  • TensorFlow 1 & 2 Support

    TensorFlow 1 & 2 Support

    Currently importing adanet with tensorflow 2.0.0alpha gives the error 'ModuleNotFoundError: No module named 'tensorflow.contrib''

    Are there plans to extend compatibility to the new TF API?

    enhancement help wanted 
    opened by ushmalramesh 5
  • Is this repository deprecated?

    Is this repository deprecated?

    Has this work been subsumed by other projects? It seems that AutoKeras is actively maintained and I'm curious why AdaNet was never supported there: https://github.com/keras-team/autokeras/issues/415. Other alternative AutoDL libraries that seem well maintained are Auto-PyTorch and AutoGluon

    Perhaps AdaNet evolved into proprietary algorithms and software that are only available through Google Cloud AutoML?

    For reference, I'm interested in AdaNet more from the client side (ie I'm evaluating AutoDL options either through a proprietary vendor or open source software) rather than a researcher looking to push this particular field forward.

    opened by erichulburd 1
  • Got `AttributeError: 'NoneType' object has no attribute 'logits'` error while applying tutorial

    Got `AttributeError: 'NoneType' object has no attribute 'logits'` error while applying tutorial

    Hello everyone,

    I'm trying to apply AdaNet from tutorial in my local jupyter notebook, as I follow the tutorial here: https://github.com/tensorflow/adanet/blob/master/adanet/experimental/adanet_modelflow_tutorial.ipynb

    System information

    • Devices: Decktop PC
    • Environment: Windows 10 Professional
    • Running Platform: Anaconda
    • Python version: 3.7
    • Tensorflow version: 2.2 ( installed by conda )
    • CUDA/cuDNN version: 10.1, V10.1.243
    • GPU: 1080Ti

    Problem Description I got the error: AttributeError: 'NoneType' object has no attribute 'logits' I'm wondering where my code applying tutorial is wrong so that model can't be created.

    Addition Information Full Code

    FEATURES_KEY = "x"
    
    
    def input_fn(partition, training, batch_size):
        """Generate an input function for the Estimator."""
        def _input_fn():
    
            if partition == "train":
                dataset = tf.data.Dataset.from_tensor_slices(({
                    FEATURES_KEY:
                    tf.log1p(X_train)
                }, tf.log1p(y_train)))
            else:
                dataset = tf.data.Dataset.from_tensor_slices(({
                    FEATURES_KEY:
                    tf.log1p(X_test)
                }, tf.log1p(y_test)))
    
            # 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)
    
            dataset = dataset.batch(batch_size)
            iterator = dataset.make_one_shot_iterator()
            features, labels = iterator.get_next()
    
            return features, labels
    
        return _input_fn
    
    
    _NUM_LAYERS_KEY = "num_layers"
    
    class _SimpleDNNBuilder(adanet.subnetwork.Builder):
        def __init__(self, optimizer, layer_size, num_layers, learn_mixture_weights,
                   seed):
            self._optimizer = optimizer
            self._layer_size = layer_size
            self._num_layers = num_layers
            self._learn_mixture_weights = learn_mixture_weights
            self._seed = seed
    
        def build_subnetwork(self,
                           features,
                           logits_dimension,
                           training,
                           iteration_step,
                           summary,
                           previous_ensemble=None):
            input_layer = tf.to_float(features[FEATURES_KEY])
            kernel_initializer = tf.glorot_uniform_initializer(seed=self._seed)
            last_layer = input_layer
            for _ in range(self._num_layers):
                last_layer = tf.layers.dense(last_layer,
                                             units=self._layer_size,
                                             activation=tf.nn.relu,
                                             kernel_initializer=kernel_initializer)
                logits = tf.layers.dense(
                    last_layer,
                    units=logits_dimension,
                    kernel_initializer=kernel_initializer)
                
                shared = {_NUM_LAYERS_KEY: self._num_layers}   
                
                return adanet.Subnetwork(last_layer=last_layer,logits=logits,complexity=self._measure_complexity(),shared=shared)
    
        def _measure_complexity(self):
            return tf.sqrt(tf.to_float(self._num_layers))
    
        def build_subnetwork_train_op(self, subnetwork, loss, var_list, labels,
                                    iteration_step, summary, previous_ensemble):
            return self._optimizer.minimize(loss=loss, var_list=var_list)
    
        @property
        def name(self):
    
            if self._num_layers == 0:
                # A DNN with no hidden layers is a linear model.
                return "linear"
            
            return "{}_layer_dnn".format(self._num_layers)
    
    
    class SimpleDNNGenerator(adanet.subnetwork.Generator):
        def __init__(self,
                   optimizer,
                   layer_size=64,
                   learn_mixture_weights=False,
                   seed=None):
            self._seed = seed
            self._dnn_builder_fn = functools.partial(
                _SimpleDNNBuilder,
                optimizer=optimizer,
                layer_size=layer_size,
                learn_mixture_weights=learn_mixture_weights)
    
        def generate_candidates(self, previous_ensemble, iteration_number,previous_ensemble_reports, all_reports):
            num_layers = 0
            seed = self._seed
            if previous_ensemble:num_layers = previous_ensemble.subnetworks[-1].shared[_NUM_LAYERS_KEY]
            if seed is not None:seed += iteration_number
                
            return [
                self._dnn_builder_fn(num_layers=num_layers, seed=seed),
                self._dnn_builder_fn(num_layers=num_layers + 1, seed=seed),
            ]
    
    #@title AdaNet parameters
    LEARNING_RATE = 0.001  #@param {type:"number"}
    TRAIN_STEPS = 60000  #@param {type:"integer"}
    BATCH_SIZE = 32  #@param {type:"integer"}
    
    LEARN_MIXTURE_WEIGHTS = False  #@param {type:"boolean"}
    ADANET_LAMBDA = 0  #@param {type:"number"}
    ADANET_ITERATIONS = 3  #@param {type:"integer"}
    
    
    def train_and_evaluate(experiment_name, learn_mixture_weights=LEARN_MIXTURE_WEIGHTS,
                           adanet_lambda=ADANET_LAMBDA):
        model_dir = os.path.join(LOG_DIR, experiment_name)
        ensembler_optimizer = None
        if learn_mixture_weights:
            ensembler_optimizer = tf.train.RMSPropOptimizer(
            learning_rate=LEARNING_RATE)
    
        estimator = adanet.Estimator(
            # Since we are predicting housing prices, we'll use a regression
            # head that optimizes for MSE.
            head=tf.estimator.RegressionHead(),
    
            # Define the generator, which defines our search space of subnetworks
            # to train as candidates to add to the final AdaNet model.
            subnetwork_generator=SimpleDNNGenerator(
                optimizer=tf.train.RMSPropOptimizer(learning_rate=LEARNING_RATE),
                learn_mixture_weights=learn_mixture_weights,
                seed=RANDOM_SEED),
    
            # The number of train steps per iteration.
            max_iteration_steps=TRAIN_STEPS // ADANET_ITERATIONS,
    
            # The evaluator will evaluate the model on the full training set to
            # compute the overall AdaNet loss (train loss + complexity
            # regularization) to select the best candidate to include in the
            # final AdaNet model.
            evaluator=adanet.Evaluator(
                input_fn=input_fn("train", training=False, batch_size=BATCH_SIZE)),
    
            ensemblers=[
                adanet.ensemble.ComplexityRegularizedEnsembler(
                    optimizer=ensembler_optimizer,
                    # Lambda is a the strength of complexity regularization. A larger
                    # value will penalize more complex subnetworks.
                    adanet_lambda=adanet_lambda),
            ],      
    
            # Configuration for Estimators.
            config=tf.estimator.RunConfig(
                    save_summary_steps=5000,
                    save_checkpoints_steps=5000,
                    tf_random_seed=RANDOM_SEED,
                    model_dir=model_dir)
        )
    
        # Train and evaluate using using the tf.estimator tooling.
        train_spec = tf.estimator.TrainSpec(input_fn=input_fn("train", training=True, batch_size=BATCH_SIZE),max_steps=TRAIN_STEPS)
        
        eval_spec = tf.estimator.EvalSpec(input_fn=input_fn("test", training=False, batch_size=BATCH_SIZE),steps=None,
          start_delay_secs=1,
          throttle_secs=30,
        )
        tf.estimator.train_and_evaluate(estimator, train_spec, eval_spec)
        
        return estimator.evaluate(input_fn("test", training=False, batch_size=BATCH_SIZE),steps=None)
    
    def ensemble_architecture(result):
        architecture = result["architecture/adanet/ensembles"]
        # The architecture is a serialized Summary proto for TensorBoard.
        summary_proto = tf.summary.Summary.FromString(architecture)
        return summary_proto.value[0].tensor.string_val[0]
    

    Full Log

    INFO:tensorflow:Using config: {'_model_dir': '.\\results\\20210305\\uniform_average_ensemble_baseline', '_tf_random_seed': 42, '_save_summary_steps': 5000, '_save_checkpoints_steps': 5000, '_save_checkpoints_secs': None, '_session_config': allow_soft_placement: true
    graph_options {
      rewrite_options {
        meta_optimizer_iterations: ONE
      }
    }
    , '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_experimental_max_worker_delay_secs': None, '_session_creation_timeout_secs': 7200, '_service': None, '_cluster_spec': ClusterSpec({}), '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
    INFO:tensorflow:Using config: {'_model_dir': '.\\results\\20210305\\uniform_average_ensemble_baseline', '_tf_random_seed': 42, '_save_summary_steps': 5000, '_save_checkpoints_steps': 5000, '_save_checkpoints_secs': None, '_session_config': allow_soft_placement: true
    graph_options {
      rewrite_options {
        meta_optimizer_iterations: ONE
      }
    }
    , '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_experimental_max_worker_delay_secs': None, '_session_creation_timeout_secs': 7200, '_service': None, '_cluster_spec': ClusterSpec({}), '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
    INFO:tensorflow:Not using Distribute Coordinator.
    INFO:tensorflow:Not using Distribute Coordinator.
    INFO:tensorflow:Running training and evaluation locally (non-distributed).
    INFO:tensorflow:Running training and evaluation locally (non-distributed).
    INFO:tensorflow:Start train and evaluate loop. The evaluate will happen after every checkpoint. Checkpoint frequency is determined based on RunConfig arguments: save_checkpoints_steps 5000 or save_checkpoints_secs None.
    INFO:tensorflow:Start train and evaluate loop. The evaluate will happen after every checkpoint. Checkpoint frequency is determined based on RunConfig arguments: save_checkpoints_steps 5000 or save_checkpoints_secs None.
    INFO:tensorflow:Using config: {'_model_dir': '.\\results\\20210305\\uniform_average_ensemble_baseline', '_tf_random_seed': 42, '_save_summary_steps': 5000, '_save_checkpoints_steps': 5000, '_save_checkpoints_secs': None, '_session_config': allow_soft_placement: true
    graph_options {
      rewrite_options {
        meta_optimizer_iterations: ONE
      }
    }
    , '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_experimental_max_worker_delay_secs': None, '_session_creation_timeout_secs': 7200, '_service': None, '_cluster_spec': ClusterSpec({}), '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
    INFO:tensorflow:Using config: {'_model_dir': '.\\results\\20210305\\uniform_average_ensemble_baseline', '_tf_random_seed': 42, '_save_summary_steps': 5000, '_save_checkpoints_steps': 5000, '_save_checkpoints_secs': None, '_session_config': allow_soft_placement: true
    graph_options {
      rewrite_options {
        meta_optimizer_iterations: ONE
      }
    }
    , '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_experimental_max_worker_delay_secs': None, '_session_creation_timeout_secs': 7200, '_service': None, '_cluster_spec': ClusterSpec({}), '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
    WARNING:tensorflow:Estimator's model_fn (<function Estimator._create_model_fn.<locals>._adanet_model_fn at 0x000002D952D3EE58>) includes params argument, but params are not passed to Estimator.
    WARNING:tensorflow:Estimator's model_fn (<function Estimator._create_model_fn.<locals>._adanet_model_fn at 0x000002D952D3EE58>) includes params argument, but params are not passed to Estimator.
    INFO:tensorflow:Calling model_fn.
    INFO:tensorflow:Calling model_fn.
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-108-bdd9b905e372> in <module>
    ----> 1 results = train_and_evaluate("uniform_average_ensemble_baseline")
          2 print("Loss:", results["average_loss"])
          3 print("Architecture:", ensemble_architecture(results))
    
    <ipython-input-107-6138e4940fa0> in train_and_evaluate(experiment_name, learn_mixture_weights, adanet_lambda)
         59 
         60     eval_spec = tf.estimator.EvalSpec(input_fn=input_fn("test", training=False, batch_size=BATCH_SIZE),steps=None,)
    ---> 61     tf.estimator.train_and_evaluate(estimator, train_spec, eval_spec)
         62 
         63     return estimator.evaluate(input_fn("test", training=False, batch_size=BATCH_SIZE),steps=None)
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\tensorflow_estimator\python\estimator\training.py in train_and_evaluate(estimator, train_spec, eval_spec)
        470         '(with task id 0).  Given task id {}'.format(config.task_id))
        471 
    --> 472   return executor.run()
        473 
        474 
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\tensorflow_estimator\python\estimator\training.py in run(self)
        611       tf.compat.v1.logging.info(
        612           'Running training and evaluation locally (non-distributed).')
    --> 613       return self.run_local()
        614 
        615     # Distributed case.
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\tensorflow_estimator\python\estimator\training.py in run_local(self)
        712         max_steps=self._train_spec.max_steps,
        713         hooks=train_hooks,
    --> 714         saving_listeners=saving_listeners)
        715 
        716     eval_result = listener_for_eval.eval_result or _EvalResult(
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\adanet\core\estimator.py in train(self, input_fn, hooks, steps, max_steps, saving_listeners)
        898             hooks=hooks,
        899             max_steps=max_steps,
    --> 900             saving_listeners=saving_listeners)
        901         # In TensorFlow v2.0.0.rc1 and below, saving listeners are attached to
        902         # the first CheckpointSaverHook each time train is called. Instead, we
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in train(self, input_fn, hooks, steps, max_steps, saving_listeners)
        347 
        348       saving_listeners = _check_listeners_type(saving_listeners)
    --> 349       loss = self._train_model(input_fn, hooks, saving_listeners)
        350       logging.info('Loss for final step: %s.', loss)
        351       return self
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _train_model(self, input_fn, hooks, saving_listeners)
       1180       return self._train_model_distributed(input_fn, hooks, saving_listeners)
       1181     else:
    -> 1182       return self._train_model_default(input_fn, hooks, saving_listeners)
       1183 
       1184   def _train_model_default(self, input_fn, hooks, saving_listeners):
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _train_model_default(self, input_fn, hooks, saving_listeners)
       1209       worker_hooks.extend(input_hooks)
       1210       estimator_spec = self._call_model_fn(features, labels, ModeKeys.TRAIN,
    -> 1211                                            self.config)
       1212       global_step_tensor = tf.compat.v1.train.get_global_step(g)
       1213       return self._train_with_estimator_spec(estimator_spec, worker_hooks,
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _call_model_fn(self, features, labels, mode, config)
       1168 
       1169     logging.info('Calling model_fn.')
    -> 1170     model_fn_results = self._model_fn(features=features, **kwargs)
       1171     logging.info('Done calling model_fn.')
       1172 
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\adanet\core\estimator.py in _adanet_model_fn(***failed resolving arguments***)
       2198           checkpoint_path=path,
       2199           hooks=hooks,
    -> 2200           best_ensemble_index_override=best_ensemble_index)
       2201 
       2202       # Variable which allows us to read the current iteration from a
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\adanet\core\estimator.py in _create_iteration(self, features, labels, mode, config, is_growing_phase, checkpoint_path, hooks, best_ensemble_index_override)
       2126           previous_ensemble_summary=previous_ensemble_summary,
       2127           best_ensemble_index_override=best_ensemble_index_override,
    -> 2128           previous_iteration=previous_iteration)
       2129     return current_iteration, previous_iteration_vars
       2130 
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\adanet\core\iteration.py in build_iteration(self, base_global_step, iteration_number, ensemble_candidates, subnetwork_builders, features, mode, config, labels, previous_ensemble_summary, rebuilding, rebuilding_ensembler_name, best_ensemble_index_override, previous_iteration)
        650               labels=labels,
        651               previous_ensemble=previous_ensemble,
    --> 652               config=config)
        653           subnetwork_specs.append(subnetwork_spec)
        654           # Workers that don't build ensembles need a dummy candidate in order
    
    ~\anaconda3\envs\tf-gpu\lib\site-packages\adanet\core\ensemble_builder.py in build_subnetwork_spec(self, name, subnetwork_builder, summary, features, mode, labels, previous_ensemble, config)
        755 
        756       estimator_spec = _create_estimator_spec(self._head, features, labels,
    --> 757                                               mode, subnetwork.logits,
        758                                               self._use_tpu)
        759 
    
    AttributeError: 'NoneType' object has no attribute 'logits'
    
    opened by georgech3 0
  • Using AdaNet ModelFlow with pre-trained models

    Using AdaNet ModelFlow with pre-trained models

    Hi everyone!!!

    I'm trying to use AdaNet with ModelFlow in Google Colabs, as per the tutorial here: https://github.com/tensorflow/adanet/blob/master/adanet/experimental/adanet_modelflow_tutorial.ipynb

    I tried to install adanet.experimental with https://github.com/tensorflow/adanet/blob/master/adanet/experimental/BUILD , however, this just ends up with the error code:

    ModuleNotFoundError: No module named 'adanet.experimental'

    I was going to attempt to use AdaNet with some form of Keras to see if its works to compare fine-tuned pre-trained models for image classification. Does anyone have any ideas or has been trying similar things.

    I read the Keras API with AdaNet was upcoming but can't find evidence of release anywhere. If so, which are the best ensemble methods to try beyond averaging model predictions?

    Many thanks, Sicily

    opened by Sicily-F 1
  • AttributeError: module 'adanet' has no attribute 'AutoEnsembleEstimator'

    AttributeError: module 'adanet' has no attribute 'AutoEnsembleEstimator'

    I use TF 2.1.0 and adanet 0.9.0 to run example code in ReadMe but I got this error AttributeError: module 'adanet' has no attribute 'AutoEnsembleEstimator'

    opened by wenqf11 0
  • RuntimeError with adanet_tpu tutorial using TF2.2 and Adanet 0.9.0

    RuntimeError with adanet_tpu tutorial using TF2.2 and Adanet 0.9.0

    Running into the following RuntimeError when running the adanet_tpu tutorial using TF 2.2 and Adanet 0.9.0:

    All tensors outfed from TPU should preserve batch size dimension, but got scalar Tensor("OutfeedDequeueTuple:1", shape=(), dtype=int64, device=/job:tpu_worker/task:0/device:CPU:0)

    I have made some minor changes to the original tutorial code, i.e. replacing of tf.contrib module with tf.compat.v1 equivalents where applicable, etc. as per the following Google Colab: https://colab.research.google.com/drive/1IVwzPL50KcxkNczaEXBQwCFdZE2kDEde

    I have experienced the same issue when running TF 2 with previous Adanet=0.8.0 version when training my own GCP project models on Cloud TPUs. Further details on this can be found on stackoverflow here : https://stackoverflow.com/questions/62266321/tensorflow-2-1-using-tpuestimator-runtimeerror-all-tensors-outfed-from-tpu-sho

    Looking to establish whether I am potentially missing something for the migration over to TF 2 using Adanet?

    opened by nicholasbreckwoldt 0
Releases(v0.9.0)
  • v0.9.0(Jul 9, 2020)

    • Drop support for Tensorflow 1.* . Only TensorFlow >= 2.1 is supported.
    • Drop support for Python 2.* . Only Python >= 3.6 is supported.
    • Preserved the outputs in the PredictionOutput that are not in the best_export_outputs.
    • Add warm_start support to adanet Estimators.
    • Added support for predicting/serving on TPU.
    • Introduce support for AutoEnsembleTPUEstimator.
    • Introduce experimental adanet.experimental Keras ModelFlow APIs.
    • Replace reports.proto with simple serialized JSON. No longer have proto dependencies.
    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Oct 2, 2019)

    • Add support for TensorFlow 2.0.
    • Begin developing experimental Keras API for auto-ensembling.
    • Support advanced subnetworks and subestimators that need to read and write from disk by giving them a dedicated subdirectory in model_dir.
    • Fix race condition in parallel evaluation during distributed training.
    • Support subnetwork hooks requesting early stopping.
    • Adding AdaNet replay. The ability to rerun training without having to determine the best candidate for the iteration. A list of best indices from the previous run is provided and honored by AdaNet.
    • Introduced adanet.ensemble.MeanEnsembler with a basic implementation for taking the mean of logits of subnetworks. This also supports including the mean of last_layer (helpful if subnetworks have same configurations) in the predictions and export_outputs of the EstimatorSpec.
    • BREAKING CHANGE: AdaNet now supports arbitrary metrics when choosing the best ensemble. To achieve this, the interface of adanet.Evaluator is changing. The Evaluator.evaluate_adanet_losses(sess, adanet_losses) function is being replaced with Evaluator.evaluate(sess, ensemble_metrics). The ensemble_metrics parameter contains all computed metrics for each candidate ensemble as well as the adanet_loss. Code which overrides evaluate_adanet_losses must migrate over to use the new evaluate method (we suspect that such cases are very rare).
    • Allow user to specify a maximum number of AdaNet iterations.
    • BREAKING CHANGE: When supplied, run the adanet.Evaluator before Estimator#evaluate, Estimator#predict, and Estimator#export_saved_model. This can have the effect of changing the best candidate chosen at the final round. When the user passes an Evaluator, we run it to establish the best candidate during evaluation, predict, and export_saved_model. Previously they used the adanet_loss moving average collected during training. While the previous ensemble would have been established by the Evaluator, the current set of candidate ensembles that were not done training would be considered according to the adanet_loss. Now when a user passes an Evaluator that, for example, uses a hold-out set, AdaNet runs it before making predictions or exporting a SavedModel to use the best new candidate according to the hold-out set.
    • Support tf.keras.metrics.Metrics during evaluation.
    • Allow users to disable summaries to reduce memory and disk footprint.
    • Stop individual subnetwork training on OutOfRangeError raised during bagging.
    • Train forever if max_steps and steps are both None.
    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Jun 26, 2019)

    • Add embeddings support on TPU via TPUEmbedding.
    • Train the current iteration forever when max_iteration_steps=None.
    • Introduce adanet.AutoEnsembleSubestimator for training subestimators on different training data partitions and implement ensemble methods like bootstrap aggregating (a.k.a bagging).
    • Fix bug when using Gradient Boosted Decision Tree Estimators with AutoEnsembleEstimator during distributed training.
    • Allow AutoEnsembleEstimator's candidate_pool argument to be a lambda in order to create Estimators lazily.
    • Remove adanet.subnetwork.Builder#prune_previous_ensemble for abstract class. This behavior is now specified using adanet.ensemble.Strategy subclasses.
    • BREAKING CHANGE: Only support TensorFlow >= 1.14 to better support TensorFlow 2.0. Drop support for versions < 1.14.
    • Correct eval metric computations on CPU and GPU.
    Source code(tar.gz)
    Source code(zip)
  • v0.6.2(Apr 29, 2019)

    • Fix n+1 global-step increment bug in adanet.AutoEnsembleEstimator. This bug incremented the global_step by n+1 for n canned Estimators like DNNEstimator.
    Source code(tar.gz)
    Source code(zip)
  • v0.6.1(Mar 29, 2019)

  • v0.6.0(Mar 28, 2019)

    • Officially support AdaNet on TPU using adanet.TPUEstimator with adanet.Estimator feature parity.
    • Support dictionary candidate pools in adanet.AutoEnsembleEstimator constructor to specify human-readable candidate names.
    • Improve AutoEnsembleEstimator ability to handling custom tf.estimator.Estimator subclasses.
    • Introduce adanet.ensemble which contains interfaces and examples of ways to learn ensembles using AdaNet. Users can now extend AdaNet to use custom ensemble-learning methods.
    • Record TensorBoard scalar, image, histogram, and audio summaries on TPU during training.
    • Add debug mode to help detect NaNs and Infs during training.
    • Improve subnetwork tf.train.SessionRunHook support to handle more edge cases.
    • ~~Maintain compatibility with TensorFlow versions 1.9 thru 1.13~~ Only works for TensorFlow version >=1.13. Fixed in AdaNet v0.6.1.
    • Improve documentation including adding 'Getting Started' documentation to adanet.readthedocs.io.
    • BREAKING CHANGE: Importing the adanet.subnetwork package using from adanet.core import subnetwork will no longer work, because the package was moved to the adanet/subnetwork directory. Most users should already be using adanet.subnetwork or from adanet import subnetwork, and should not be affected.
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Dec 17, 2018)

    • Support training on TPU using adanet.TPUEstimator.
    • Allow subnetworks to specify tf.train.SessionRunHook instances for training with adanet.subnetwork.TrainOpSpec.
    • Add API documentation generation with Sphinx.
    • Fix bug preventing subnetworks with Resource variables from working beyond the first iteration.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Nov 30, 2018)

    • Add shared field to adanet.Subnetwork to deprecate, replace, and be more flexible than persisted_tensors.
    • Officially support multi-head learning with or without dict labels.
    • Rebuild the ensemble across iterations in Python without a frozen graph. This allows users to share more than Tensors between iterations including Python primitives, objects, and lambdas for greater flexibility. Eliminating reliance on a MetaGraphDef proto also eliminates I/O allowing for faster training, and better future-proofing.
    • Allow users to pass custom eval metrics when constructing an adanet.Estimator.
    • Add adanet.AutoEnsembleEstimator for learning to ensemble tf.estimator.Estimator instances.
    • Pass labels to adanet.subnetwork.Builder's build_subnetwork method.
    • The TRAINABLE_VARIABLES collection will only contain variables relevant to the current adanet.subnetwork.Builder, so not passing var_list to the optimizer.minimize will lead to the same behavior as passing it in by default.
    • Using tf.summary inside adanet.subnetwork.Builder is now equivalent to using the adanet.Summary object.
    • Accessing the global_step from within an adanet.subnetwork.Builder will return the iteration_step variable instead, so that the step starts at zero at the beginning of each iteration. One subnetwork incrementing the step will not affect other subnetworks.
    • Summaries will automatically scope themselves to the current subnetwork's scope. Similar summaries will now be correctly grouped together correctly across subnetworks in TensorBoard. This eliminates the need for the tf.name_scope("") hack.
    • Provide an override to force the AdaNet ensemble to grow at the end of each iteration.
    • Correctly seed TensorFlow graph between iterations. This breaks some tests that check the outputs of adanet.Estimator models.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Nov 7, 2018)

  • v0.2.0(Nov 2, 2018)

    • Estimator no longer creates eval metric ops in train mode.
    • Freezer no longer converts Variables to constants, allowing AdaNet to handle Variables larger than 2GB.
    • Fixes some errors with Python 3.
    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Oct 23, 2018)

E2EC: An End-to-End Contour-based Method for High-Quality High-Speed Instance Segmentation

E2EC: An End-to-End Contour-based Method for High-Quality High-Speed Instance Segmentation E2EC: An End-to-End Contour-based Method for High-Quality H

zhangtao 146 Dec 29, 2022
Nicely is a real-time Feedback and Intervention Program Depression is a prevalent issue across all age groups, socioeconomic classes, and cultural identities.

Nicely is a real-time Feedback and Intervention Program Depression is a prevalent issue across all age groups, socioeconomic classes, and cultural identities.

null 1 Jan 16, 2022
The deployment framework aims to provide a simple, lightweight, fast integrated, pipelined deployment framework that ensures reliability, high concurrency and scalability of services.

savior是一个能够进行快速集成算法模块并支持高性能部署的轻量开发框架。能够帮助将团队进行快速想法验证(PoC),避免重复的去github上找模型然后复现模型;能够帮助团队将功能进行流程拆解,很方便的提高分布式执行效率;能够有效减少代码冗余,减少不必要负担。

Tao Luo 125 Dec 22, 2022
Pre-trained Deep Learning models and demos (high quality and extremely fast)

OpenVINO™ Toolkit - Open Model Zoo repository This repository includes optimized deep learning models and a set of demos to expedite development of hi

OpenVINO Toolkit 3.4k Dec 31, 2022
Code for the paper: On Pathologies in KL-Regularized Reinforcement Learning from Expert Demonstrations

Non-Parametric Prior Actor-Critic (N-PPAC) This repository contains the code for On Pathologies in KL-Regularized Reinforcement Learning from Expert D

Cong Lu 5 May 13, 2022
BDDM: Bilateral Denoising Diffusion Models for Fast and High-Quality Speech Synthesis

Bilateral Denoising Diffusion Models (BDDMs) This is the official PyTorch implementation of the following paper: BDDM: BILATERAL DENOISING DIFFUSION M

null 172 Dec 23, 2022
Asterisk is a framework to generate high-quality training datasets at scale

Asterisk is a framework to generate high-quality training datasets at scale

Mona Nashaat 44 Apr 25, 2022
Combining Automatic Labelers and Expert Annotations for Accurate Radiology Report Labeling Using BERT

CheXbert: Combining Automatic Labelers and Expert Annotations for Accurate Radiology Report Labeling Using BERT CheXbert is an accurate, automated dee

Stanford Machine Learning Group 51 Dec 8, 2022
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 21.1k Jan 1, 2023
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 11.9k Feb 13, 2021
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 21.1k Jan 8, 2023
Lightweight Face Image Quality Assessment

LightQNet This is a demo code of training and testing [LightQNet] using Tensorflow. Uncertainty Losses: IDQ loss PCNet loss Uncertainty Networks: Mobi

Kaen 5 Nov 18, 2022
Code for the paper SphereRPN: Learning Spheres for High-Quality Region Proposals on 3D Point Clouds Object Detection, ICIP 2021.

SphereRPN Code for the paper SphereRPN: Learning Spheres for High-Quality Region Proposals on 3D Point Clouds Object Detection, ICIP 2021. Authors: Th

Thang Vu 15 Dec 2, 2022
[SIGGRAPH Asia 2021] DeepVecFont: Synthesizing High-quality Vector Fonts via Dual-modality Learning.

DeepVecFont This is the homepage for "DeepVecFont: Synthesizing High-quality Vector Fonts via Dual-modality Learning". Yizhi Wang and Zhouhui Lian. WI

Yizhi Wang 17 Dec 22, 2022
[SIGGRAPH Asia 2021] DeepVecFont: Synthesizing High-quality Vector Fonts via Dual-modality Learning.

DeepVecFont This is the homepage for "DeepVecFont: Synthesizing High-quality Vector Fonts via Dual-modality Learning". Yizhi Wang and Zhouhui Lian. WI

Yizhi Wang 5 Oct 22, 2021
This project provides an unsupervised framework for mining and tagging quality phrases on text corpora with pretrained language models (KDD'21).

UCPhrase: Unsupervised Context-aware Quality Phrase Tagging To appear on KDD'21...[pdf] This project provides an unsupervised framework for mining and

Xiaotao Gu 146 Dec 22, 2022