tensorflow / tensor2tensor

Library of deep learning models and datasets designed to make deep learning more accessible and accelerate ML research.
Apache License 2.0
15.5k stars 3.49k forks source link

ValueError: Hyperparameter name is reserved: shards, when i use insihts_server #1340

Open kudou1994 opened 5 years ago

kudou1994 commented 5 years ago

Description

when i try to use insights(https://github.com/tensorflow/tensor2tensor/tree/master/tensor2tensor/insights), an error occurred, ValueError: Hyperparameter name is reserved: shards, ...

Environment information

OS: <ubuntu16.04>

$ pip freeze | grep tensor
# your output here

$ python -V
# python3.6

For bugs: reproduction and error logs

# Steps to reproduce:
t2t-insights-server --t2t_data_dir=./self_data --t2t_usr_dir=./self_script --t2t_model_dir=./train --problems=translate_enzh_ai32k --model=transformer --hparams_set=transformer_bsg --configuration=configuration.json --static_path='pwd'/tensor2tensor/tensor2tensor/insights/polymer

# Error logs:
INFO:tensorflow:Importing user module self_script from path /home/yyq/11.11_2
Traceback (most recent call last):
  File "/home/yyq/anaconda3/bin/t2t-insights-server", line 17, in <module>
    tf.app.run()
  File "/home/yyq/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "/home/yyq/anaconda3/bin/t2t-insights-server", line 12, in main
    server.main(argv)
  File "/home/yyq/anaconda3/lib/python3.6/site-packages/tensor2tensor/insights/server.py", line 87, in main
    processor_configuration)
  File "/home/yyq/anaconda3/lib/python3.6/site-packages/tensor2tensor/insights/transformer_model.py", line 120, in __init__
    decode_hp.add_hparam("shards", 1)
  File "/home/yyq/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/training/python/training/hparam.py", line 476, in add_hparam
    raise ValueError('Hyperparameter name is reserved: %s' % name)
ValueError: Hyperparameter name is reserved: shards
ddrogahn commented 5 years ago

I have the same error Translation walkthrough: --problem=translate_ende_wmt32k tensor2tensor==1.13.4 tensorflow==1.13.1 Python 3.6.6 Centos 7.6

Traceback (most recent call last):
  File "/mnt/mt/py/tensorflow/bin/t2t-insights-server", line 17, in <module>
    tf.app.run()
  File "/mnt/mt/py/tensorflow/lib64/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "/mnt/mt/py/tensorflow/bin/t2t-insights-server", line 12, in main
    server.main(argv)
  File "/mnt/mt/py/tensorflow/lib64/python3.6/site-packages/tensor2tensor/insights/server.py", line 108, in main
    processor_configuration)
  File "/mnt/mt/py/tensorflow/lib64/python3.6/site-packages/tensor2tensor/insights/transformer_model.py", line 121, in __init__
    decode_hp.add_hparam("shards", 1)
  File "/mnt/mt/py/tensorflow/lib64/python3.6/site-packages/tensor2tensor/utils/hparam.py", line 433, in add_hparam
    raise ValueError('Hyperparameter name is reserved: %s' % name)
ValueError: Hyperparameter name is reserved: shards
TanguyUrvoy commented 5 years ago

+1

senarvi commented 5 years ago

I think this error happens when add_hparam() is called twice with the same hyperparameter name. I noticed the same problem in universal_transformer. update_hparams_for_universal_transformer() is called first in universal_transformer_base(): https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/models/research/universal_transformer.py#L454 And then in universal_transformer_big(): https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/models/research/universal_transformer.py#L470 The latter causes the error "Hyperparameter name is reserved".