google / trax

Trax — Deep Learning with Clear Code and Speed
Apache License 2.0
8.1k stars 816 forks source link

Question #1213

Open tvjoseph opened 4 years ago

tvjoseph commented 4 years ago

Description

I was trying to load data sets using trax using the trax.data.TFDS

trax.data.TFDS('opus/medical',
keys=('en', 'de'), eval_holdout_size=0.01, # 1% for eval train=True)

However I get attribute error saying

AttributeError: module 'trax' has no attribute 'data'

Environment information

I am working on Ubuntu version 19.0

OS:Ubuntu 19.0

$ pip freeze | grep trax
trax==1.3.1

$ pip freeze | grep tensor
mesh-tensorflow==0.1.16
tensor2tensor==1.15.7
tensorboard==2.3.0
tensorboard-plugin-wit==1.7.0
tensorflow==2.3.0
tensorflow-addons==0.10.0
tensorflow-datasets==3.2.1
tensorflow-estimator==2.3.0
tensorflow-gan==2.0.0
tensorflow-hub==0.8.0
tensorflow-metadata==0.22.2
tensorflow-probability==0.7.0
tensorflow-text==2.3.0

$ pip freeze | grep jax
jax==0.1.73
jaxlib==0.1.52

$ python -V
Python 3.7.7

For bugs: reproduction and error logs

# Steps to reproduce:
These are the steps I followed

train_stream_fn = trax.data.TFDS('opus/medical',                                 
                                 keys=('en', 'de'),
                                 eval_holdout_size=0.01, # 1% for eval
                                 train=True)

# Get generator function for the eval set
eval_stream_fn = trax.data.TFDS('opus/medical',                                
                                keys=('en', 'de'),
                                eval_holdout_size=0.01, # 1% for eval
                                train=False)
# Error logs:
AttributeError                            Traceback (most recent call last)
<ipython-input-2-67df9da45792> in <module>
      1 # Get generator function for the training set
      2 # This will download the train dataset if no data_dir is specified.
----> 3 train_stream_fn = trax.data.TFDS('opus/medical',                                 
      4                                  keys=('en', 'de'),
      5                                  eval_holdout_size=0.01, # 1% for eval

AttributeError: module 'trax' has no attribute 'data'
hurun commented 4 years ago

i get the same question,hope someone can help

hurun commented 4 years ago

use this to solve problem https://github.com/google/trax

1 uninstall trax 2 !pip install -q -U trax 3 restart your python enviroment

tvjoseph commented 4 years ago

Thanks. It worked when I reinstalled Trax

mokshasoft commented 3 years ago

I get the same error, but reinstalling didn't work. I tried several times.

% pip freeze | grep trax
trax==1.3.7
% pip freeze | grep tensor
mesh-tensorflow==0.1.18
tensorboard==2.4.1
tensorboard-plugin-wit==1.8.0
tensorflow==2.4.1
tensorflow-datasets==4.2.0
tensorflow-estimator==2.4.0
tensorflow-hub==0.11.0
tensorflow-metadata==0.27.0
tensorflow-text==2.4.3
% pip freeze | grep jax
jax==0.2.12
jaxlib==0.1.65
% python3 -V           
Python 3.9.4
% sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15.7
BuildVersion:   19H524

Code:

data_pipeline = trax.data.Serial(

Error:

...
WARNING:root:Argument blacklist is deprecated. Please use denylist.
WARNING:root:Argument blacklist is deprecated. Please use denylist.
Traceback (most recent call last):
  File "<file>.py", line 127, in <module>
    data_pipeline = trax.data.Serial(
AttributeError: module 'trax' has no attribute 'data'
oendnsk675 commented 1 year ago

but r

can you show how you import the Trax module? because on me is work well