gpt-2-simple
gpt-2-simple copied to clipboard
README Tutorial fails
I followed the readme.md tutorial. Done the fine tuning. It created \checkpoint\run1\ directory.
But when I run the 2nd part (standalone generate, from same dir I ran fine tuning from) it fails:
import gpt_2_simple as gpt2
sess = gpt2.start_tf_sess()
gpt2.load_gpt2(sess)
gpt2.generate(sess)
λ python generate.py
checkpoint_path checkpoint\run1
ckpt None
2022-05-24 10:59:28.937419: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:354] MLIR V1 optimization pass is not enabled
Loading checkpoint None
Traceback (most recent call last):
File "generate.py", line 8, in <module>
gpt2.load_gpt2(sess)
File "C:\Python37\lib\site-packages\gpt_2_simple\gpt_2.py", line 410, in load_gpt2
saver.restore(sess, ckpt)
File "C:\Python37\lib\site-packages\tensorflow\python\training\saver.py", line 1405, in restore
raise ValueError("Can't load save_path when it is None.")
ValueError: Can't load save_path when it is None.
if I specify checkpoint:
gpt2.load_gpt2(sess, checkpoint='run1')
checkpoint_path checkpoint\run1
ckpt checkpoint\run1\run1
ValueError: The passed save_path is not a valid checkpoint: checkpoint\run1\run1
So I guess it expects an empty string:
Detected at node 'save/RestoreV2' defined at (most recent call last):
File "generate.py", line 8, in <module>
gpt2.load_gpt2(sess, checkpoint='')
File "C:\Python37\lib\site-packages\gpt_2_simple\gpt_2.py", line 403, in load_gpt2
saver = tf.compat.v1.train.Saver(allow_empty=True)
Node: 'save/RestoreV2'
Unable to open table file checkpoint\run1\: NOT_FOUND: NewRandomAccessFile failed to Create/Open: checkpoint\run1\ : The system cannot find the path specified.
; No such process
[[{{node save/RestoreV2}}]]
So it defensively fails out of the box. It did seem to generate some sample text during the fine tuning, but not in standalone generation.
same question