title: how to save torchtext Dataset?
body: <p>I'm working with text and use <a href="https://torchtext.readthedocs.io/en/latest/data.html#torchtext.data.Dataset" rel="noreferrer"><code>torchtext.data.Dataset</code></a>.
  Creating the dataset takes a considerable amount of time.
  For just running the program this is still acceptable. But I would like to debug the torch code for the neural network. And if python is started in debug mode, the dataset creation takes roughly 20 minutes (!!). That's just to get a working environment where I can debug-step through the neural network code.</p>
  
  <p>I would like to save the Dataset, for example with pickle. This sample code is taken from <a href="https://github.com/fastai/fastai/blob/master/courses/dl1/lesson4-imdb.ipynb" rel="noreferrer">here</a>, but I removed everything that is not necessary for this example:</p>
  
  <pre><code>from torchtext import data
  from fastai.nlp import *
  
  PATH = 'data/aclImdb/'
  
  TRN_PATH = 'train/all/'
  VAL_PATH = 'test/all/'
  TRN = f'{PATH}{TRN_PATH}'
  VAL = f'{PATH}{VAL_PATH}'
  
  TEXT = data.Field(lower=True, tokenize="spacy")
  
  bs = 64;
  bptt = 70
  
  FILES = dict(train=TRN_PATH, validation=VAL_PATH, test=VAL_PATH)
  md = LanguageModelData.from_text_files(PATH, TEXT, **FILES, bs=bs, bptt=bptt, min_freq=10)
  
  with open("md.pkl", "wb") as file:
      pickle.dump(md, file)
  </code></pre>
  
  <p>To run the code, you need the aclImdb dataset, it can be downloaded from <a href="http://files.fast.ai/data/aclImdb.tgz" rel="noreferrer">here</a>. Extract it into a <code>data/</code> folder next to this code snippet. The code produces an error in the last line, where pickle is used:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/lhk/programming/fastai_sandbox/lesson4-imdb2.py", line 27, in &lt;module&gt;
      pickle.dump(md, file)
  TypeError: 'generator' object is not callable
  </code></pre>
  
  <p>The samples from fastai often use <a href="https://pypi.org/project/dill/" rel="noreferrer">dill</a> instead of pickle. But that doesn't work for me either.</p>