*help* Do not shuffle dataset
Hi, I'm trying to define a new problem.py to train on my data but I don't know how can I specify that the data examples shouldn't be shuffled? Also, is there an example of Problem.py where you can load the vocabulary, training and evaluation datasets instead of creating them( is_generate_per_split= True )?
Thanks,
First, you need to
- disable the shuffling in t2t-datagen. There is no flag for this, so you need to hack the source code and/or delete the UNSHUFFLED_SUFFIX from the TFRecord files before these files are deleted. I think it would be nice to send a PR adding a flag for no shuffling.
However, there are few more places where shuffling takes place when reading the TFRecords. By default 100 data shards (files) are created and
- their order is shuffled when loading (the
shuffle_filesparameter isTrueby default for most problems) - a random portion of each file is skipped before the start of training (each training, in case of the default
--schedule=continous_train_and_eval, but rather than turning this off, I suggest to use--schedule=train) - several files are read in parallel in a non-deterministic way.
Especially the last one is tricky to solve. My workaround is creating just one data shard:
@registry.register_problem
class MyProblem(TranslateEncsWmt32k):
"""no shuffling workaround using a single datashard file"""
@property
def dataset_splits(self):
"""Splits of data to produce and number of output shards for each."""
return [{
"split": problem.DatasetSplit.TRAIN,
"shards": 1,
}, {
"split": problem.DatasetSplit.EVAL,
"shards": 1,
}]
Do you mean that the data should not be shuffled when writing to disk, or do you mean that the data should not be shuffled during training?