add caching to text2text data layer
@@ -182,7 +182,7 @@ class ParallelTextDataLayer(DataLayer):
_src_tgt_dataset = tf.data.Dataset.zip((_sources, _targets)).filter(
lambda t1, t2: tf.logical_and(tf.less_equal(t1[1], self.max_len),
tf.less_equal(t2[1], self.max_len))
- )
+ ).cache()
if self._num_workers > 1:
_src_tgt_dataset = _src_tgt_dataset\
