Skip to content

Commit

Permalink
Always copy metadata files
Browse files Browse the repository at this point in the history
  • Loading branch information
minimaxir committed Aug 28, 2019
1 parent f9734d2 commit e161bbe
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions gpt_2_simple/gpt_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,12 @@ def maketree(path):
maketree(checkpoint_path)
files = [f for f in os.listdir(checkpoint_path)]
for file in ['hparams.json', 'encoder.json', 'vocab.bpe']:
if file not in files:
try:
shutil.copyfile(os.path.join(model_dir, model_name, file),
os.path.join(checkpoint_path, file))
except FileNotFoundError as fnf_error:
print("You need to download the GPT-2 model first via download_gpt2()")
raise(fnf_error)
try:
shutil.copyfile(os.path.join(model_dir, model_name, file),
os.path.join(checkpoint_path, file))
except FileNotFoundError as fnf_error:
print("You need to download the GPT-2 model first via download_gpt2()")
raise(fnf_error)

enc = encoder.get_encoder(checkpoint_path)
hparams = model.default_hparams()
Expand Down

0 comments on commit e161bbe

Please sign in to comment.