Closed necromuralist closed 3 years ago
I had a similar problem and specifying the labels in keys
and train
fixed it. No idea why.
Same problem
@JonathanBechtel: I do not understand your solution
I also have this same issue. @JonathanBechtel can you explain your solution.
I modified the trax/data/tf_inputs.py
file to make it work as follows: (I wonder if there is a work-around without modifying the Trax code)
https://github.com/google/trax/compare/master...vico:fixed_1519
Sorry for the breakage, hopefully https://github.com/google/trax/pull/1641 should fix it.
hi @afrozenator , thank you very much for the fix! It got merged today and I did a check with my sample:
import sys
sys.path.insert(0, ".")
import trax
train_stream_fn = trax.data.TFDS('para_crawl/ende', # 'opus/medical',
data_dir='./data/',
keys=('en', 'de'),
eval_holdout_size=0.01, # 1% for eval
train=True)
train_stream = train_stream_fn()
print(next(train_stream))
I got the following error:
Traceback (most recent call last):
File "/home/cuong/localdev/trax/trax/examples/bug_check.py", line 12, in <module>
train=True)
File "/home/cuong/localdev/trax/venv/lib/python3.7/site-packages/gin/config.py", line 1069, in gin_wrapper
utils.augment_exception_message_and_reraise(e, err_str)
File "/home/cuong/localdev/trax/venv/lib/python3.7/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise
raise proxy.with_traceback(exception.__traceback__) from None
File "/home/cuong/localdev/trax/venv/lib/python3.7/site-packages/gin/config.py", line 1046, in gin_wrapper
return fn(*new_args, **new_kwargs)
File "/home/cuong/localdev/trax/trax/data/tf_inputs.py", line 329, in TFDS
subsplit=subsplit))
File "/home/cuong/localdev/trax/trax/data/tf_inputs.py", line 253, in _train_and_eval_dataset
raise ValueError('We require a validation or test split in the dataset.')
ValueError: We require a validation or test split in the dataset.
In call to configurable 'TFDS' (<function TFDS at 0x7f306252a7a0>)
Can you check it on your side or it only occur on my environment?
Thanks @vico - I see the bug, it should hopefully be fixed in https://github.com/google/trax/pull/1644 -- Was this always a problem for you? Or did it start recently?
Thanks @afrozenator , it's started recently. I followed this issue (#1519) and kept tracking it. Luckily you have fixed it so I just wanted to check if it runs on my local machine as well and then found the above error.
I run the example against master branch and it works now. Thank you @afrozenator !
Thanks all, closing this bug now, feel free to reopen if needed -- 1.3.9 has been pushed out.
Description
This isn't from the current release on pip, but on February 11 a change was made to master that causes TFDS to crash with a "NoneType is not subscriptable" error on my computer.
In trax.trax.data.tf_inputs.TFDS there are these lines:
On my computer
n_hosts
= 1, sosubsplit
is None which gets passed to the_train_and_eval_dataset
function and inside that function are these lines:because the conditional has an
or
and theeval_holdout_examples
is greater than 0, the conditional gets past even thoughsubsplit
is None, so the attempt to subscript itsubsplit[0]
raises an exception.I don't know if now is the time to report this, since I'm pulling from master (reverting to the last February 10 commit it fixes it for me) but I thought it might be helpful to know if it's not already.
Environment information
For bugs: reproduction and error logs
Steps to reproduce:
Error logs: