Skip to content

Instantly share code, notes, and snippets.

@robgon-art
Last active August 20, 2020 02:17
Show Gist options
  • Save robgon-art/49096fd0c7f5ceea4f97e9d9c9594f69 to your computer and use it in GitHub Desktop.
Save robgon-art/49096fd0c7f5ceea4f97e9d9c9594f69 to your computer and use it in GitHub Desktop.
Train GPT-2
# Use TensorFlow 1.15
%tensorflow_version 1.x
# Install GPT-2, download the medium model, and start the session
!pip install -q gpt-2-simple
import gpt_2_simple as gpt2
model = "774M" # 124M 355M 774M 1558M
gpt2.download_gpt2(model_name=model)
sess = gpt2.start_tf_sess()
# Run the fine-tuning for 10,000 steps
gpt2.finetune(sess, dataset='story_plots.txt', model_name=model, steps=10000,
restore_from='fresh', run_name='run1', print_every=10, sample_every=1000,
save_every=10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment