Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Can't create experiment #1904

Open
yhong4 opened this issue Nov 30, 2021 · 0 comments
Open

Can't create experiment #1904

yhong4 opened this issue Nov 30, 2021 · 0 comments

Comments

@yhong4
Copy link

yhong4 commented Nov 30, 2021

Description

I try to train the model. But get the error "'DummyModule' object has no attribute 'ValidationMonitor'" when using create_experiment function. Really appreciate if someone can help me.
...

Code

from tensor2tensor.utils.trainer_lib import create_hparams
from tensor2tensor.utils.trainer_lib import create_run_config, create_experiment

train_steps = 20000 # Total number of train steps for all Epochs
eval_steps = 100 # Number of steps to perform for each evaluation
batch_size = 1000
save_checkpoints_steps = 1000
ALPHA = 0.1
schedule = "continuous_train_and_eval"
hparams = create_hparams(HPARAMS)
hparams.batch_size = batch_size
hparams.learning_rate = ALPHA

# train the model
RUN_CONFIG = create_run_config(
      model_dir=TRAIN_DIR,
      model_name=MODEL,
      save_checkpoints_steps=save_checkpoints_steps,
      keep_checkpoint_max=5
)

tensorflow_exp_fn = create_experiment(
        run_config=RUN_CONFIG,
        hparams=hparams,
        model_name=MODEL,
        problem_name=PROBLEM,
        data_dir=DATA_DIR,
        train_steps=train_steps,
        eval_steps=eval_steps,
        #schedule=schedule
    )

Error logs

WARNING:tensorflow:Estimator's model_fn (<function T2TModel.make_estimator_model_fn.<locals>.wrapping_model_fn at 0x7f97ebacbd30>) includes params argument, but params are not passed to Estimator.
WARNING:tensorflow:Estimator's model_fn (<function T2TModel.make_estimator_model_fn.<locals>.wrapping_model_fn at 0x7f97ebacbd30>) includes params argument, but params are not passed to Estimator.
INFO:tensorflow:Using ValidationMonitor
INFO:tensorflow:Using ValidationMonitor
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-8b9c2867a53c> in <module>
      7 )
      8 
----> 9 tensorflow_exp_fn = create_experiment(
     10         run_config=RUN_CONFIG,
     11         hparams=hparams,

~/.conda/envs/neo_env/lib/python3.9/site-packages/tensor2tensor/utils/trainer_lib.py in create_experiment(run_config, hparams, model_name, problem_name, data_dir, train_steps, eval_steps, min_eval_frequency, eval_throttle_seconds, schedule, export, decode_hparams, use_tfdbg, use_dbgprofile, eval_early_stopping_steps, eval_early_stopping_metric, eval_early_stopping_metric_delta, eval_early_stopping_metric_minimize, eval_timeout_mins, eval_use_test_set, use_tpu, use_tpu_estimator, use_xla, export_saved_model_api_version, use_guarantee_const_getter, additional_train_hooks, additional_eval_hooks, warm_start_from, decode_from_file, decode_to_file, decode_reference, std_server_protocol)
    801   use_early_stopping = (
    802       schedule not in local_schedules and eval_early_stopping_steps)
--> 803   train_hooks, eval_hooks = create_hooks(
    804       use_tfdbg=use_tfdbg,
    805       use_dbgprofile=use_dbgprofile,

~/.conda/envs/neo_env/lib/python3.9/site-packages/tensor2tensor/utils/trainer_lib.py in create_hooks(use_tfdbg, use_dbgprofile, dbgprofile_kwargs, use_validation_monitor, validation_monitor_kwargs, use_early_stopping, early_stopping_kwargs)
    420     tf.logging.info("Using ValidationMonitor")
    421     train_hooks.append(
--> 422         contrib.learn().monitors.ValidationMonitor(
    423             hooks=eval_hooks, **validation_monitor_kwargs))
    424 

AttributeError: 'DummyModule' object has no attribute 'ValidationMonitor'
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant