tensor2tensor icon indicating copy to clipboard operation
tensor2tensor copied to clipboard

No module named tensor2tensor

Open maggieezzat opened this issue 5 years ago • 6 comments

Description

I installed tensor2tensor using: pip install tensor2tensor[tensorflow_gpu], I can run commands in the terminal like t2t-trainer, t2t-decoder,... however when I try to import the library in a python script I get this error

Traceback (most recent call last): File "", line 1, in ImportError: No module named tensor2tensor

Environment information

OS: ubuntu 18.04

$ pip freeze | grep tensor mesh-tensorflow==0.0.5 tensor2tensor==1.13.4 tensorboard==1.14.0 tensorflow-datasets==1.1.0 tensorflow-estimator==1.14.0 tensorflow-gpu==1.14.0 tensorflow-metadata==0.14.0 tensorflow-probability==0.7.0

$ python -V Python 2.7.12

Error logs:

Traceback (most recent call last): File "", line 1, in ImportError: No module named tensor2tensor

maggieezzat avatar Aug 08 '19 08:08 maggieezzat

hey can you try import something like:

from tensor2tensor.layers import common_layers

colmantse avatar Aug 08 '19 08:08 colmantse

Traceback (most recent call last): File "", line 1, in ImportError: No module named tensor2tensor.layers

maggieezzat avatar Aug 08 '19 08:08 maggieezzat

hi, I suppose it might be path error, you might want to locate the tensor2tensor folder and add it to your path via export. maybe the t2t guys know better.

colmantse avatar Aug 08 '19 08:08 colmantse

The same error here; and I can't find t2t folder either, because it's a script and not a command...

sgladkoff avatar Oct 06 '19 09:10 sgladkoff

hello so here I try to train a model of mask r cnn on my own give with the command python D:\Projet\CV-CommonTools\model_main.py / --model_dir training / --pipeline_config_path training\mask_rcnn_inception_v2.config / --num_train_steps 60000 / --sample_1_of_n_eval_examples=0 / --alsologtostderr

but i get the following error

Traceback (most recent call last):
  File "D:\Projet\model_main.py", line 110, in <module>
    tf.app.run()
  File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python36\lib\site-packages\absl\app.py", line 299, in run
    _run_main(main, args)
  File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python36\lib\site-packages\absl\app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "D:\Projet\model_main.py", line 71, in main
    FLAGS.sample_1_of_n_eval_on_train_examples))
TypeError: create_estimator_and_inputs() missing 1 required positional argument: 'hparams'

could someone guided me please

ISS88 avatar Jul 17 '20 09:07 ISS88


ImportError Traceback (most recent call last) in () 9 import collections 10 ---> 11 from tensor2tensor import models 12 from tensor2tensor import problems 13 from tensor2tensor.layers import common_layers

ImportError: cannot import name 'models'

I have the same problem using COLAB models and problems raise ImportError

MatteoZhang avatar Dec 27 '20 22:12 MatteoZhang