title: Set the number of iterations gpt-2
body: <p>I'm fine tuning a gpt-2 model following this tutorial:</p>
  <p><a href="https://medium.com/@ngwaifoong92/beginners-guide-to-retrain-gpt-2-117m-to-generate-custom-text-content-8bb5363d8b7f" rel="nofollow noreferrer">https://medium.com/@ngwaifoong92/beginners-guide-to-retrain-gpt-2-117m-to-generate-custom-text-content-8bb5363d8b7f</a></p>
  <p>With its associated GitHub repository:</p>
  <p><a href="https://github.com/nshepperd/gpt-2" rel="nofollow noreferrer">https://github.com/nshepperd/gpt-2</a></p>
  <p>I have been able to replicate the examples, my issue is that I'm not finding a parameter to set the number of iterations.
  Basically the training script shows a sample every 100 iterations and save a model version every 1000 iterations. But I'm not finding a parameter to train it for say, 5000 iterations and then close it.</p>
  <p>The script for training is here:
  <a href="https://github.com/nshepperd/gpt-2/blob/finetuning/train.py" rel="nofollow noreferrer">https://github.com/nshepperd/gpt-2/blob/finetuning/train.py</a></p>
  <p>EDIT:</p>
  <p>As suggested by cronoik I'm trying to replace the while for a for loop.</p>
  <p>I'm adding these changes:</p>
  <ol>
  <li><p>Adding one additional argument:</p>
  <p>parser.add_argument('--training_steps', metavar='STEPS', type=int, default=1000, help='a number representing how many training steps the model shall be trained for')</p>
  </li>
  <li><p>Changing the loop:</p>
  <pre><code> try:
       for iter_count in range(training_steps):
           if counter % args.save_every == 0:
               save()
  </code></pre>
  </li>
  <li><p>Using the new argument:</p>
  <p>python3 train.py --training_steps 300</p>
  </li>
  </ol>
  <p>But I'm getting this error:</p>
  <pre><code>  File &quot;train.py&quot;, line 259, in main
      for iter_count in range(training_steps):
  NameError: name 'training_steps' is not defined
  </code></pre>