async function fitModel(
    model, textData, numEpochs, examplesPerEpoch, batchSize, validationSplit,
    callbacks) {
  for (let i = 0; i < numEpochs; ++i) {
    const [xs, ys] = textData.nextDataEpoch(examplesPerEpoch);
    await model.fit(xs, ys, {
      epochs: 1,
      batchSize: batchSize,
      validationSplit,
      callbacks
    });
    xs.dispose();
    ys.dispose();
  }
}
Train model.
@param {tf.Model} model The next-char prediction model, assumed to have an
  input shape of `[null, sampleLen, charSetSize]` and an output shape of
  `[null, charSetSize]`.
@param {TextData} textData The TextData object to use during training.
@param {number} numEpochs Number of training epochs.
@param {number} examplesPerEpoch Number of examples to draw from the
  `textData` object per epoch.
@param {number} batchSize Batch size for training.
@param {number} validationSplit Validation split for training.
@param {tf.CustomCallbackArgs} callbacks Custom callbacks to use during
  `model.fit()` calls.