Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] AutoEnsembleEstimator() cannot be instatiated if tf< 2.x #154

Open
le-dawg opened this issue Apr 29, 2020 · 1 comment
Open

[Bug] AutoEnsembleEstimator() cannot be instatiated if tf< 2.x #154

le-dawg opened this issue Apr 29, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@le-dawg
Copy link

le-dawg commented Apr 29, 2020

Intent:
I am following the code sample given by @cweill and given in the docs v0.8.0 to instatiate an AutoEnsembleEstimator() with the simplest use case of one candidate.

Error:
The given object is not an Optimizer instance. Given: <tensorflow.python.keras.optimizer_v2.rmsprop.RMSprop object at 0x7fd6f61ca160>
Minimal reproducible example HERE
Call context:

candmax_iteration_steps = TRAIN_STEPS // ADANET_ITERATIONS

# Learn to ensemble linear and DNN models.
adaestimator = adanet.AutoEnsembleEstimator(
    head=head,
    candidate_pool=lambda config: {
        "linearest":
            tf.estimator.LinearEstimator(
                head=head,
                feature_columns=feature_columns,
                optimizer = lambda: tf.compat.v2.optimizers.RMSprop(),
                config=make_config("ada_linearest"))},max_iteration_steps=candmax_iteration_steps)

Details:
The same error occurs when

  • no optimizer argument is given (AutoEnsembleEstimator() defaults to FtrlOptimizer by inheritance)
  • any other optimizer is given using any other convention
    • ... tf.compat.v1.keras.optimizers....
    • ... tf.compat.v2.keras.optimizers...

The error, possibly, lies within .../tensorflow_estimator/python/estimator/head/base_head.py.
The check for compatibility appears broken. Not sure if this is still an issue within AdaNet. lambda trick

@cweill
Copy link
Contributor

cweill commented Jul 9, 2020

@le-dawg We just released adanet v0.9.0 which drops TF 1.* support. Could you please try upgrading adanet to the latest version?

@cweill cweill added the bug Something isn't working label Jul 9, 2020
@cweill cweill self-assigned this Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants