-
Sujet
-
Bonjour, j’ouvre l’invite de commande et j’entre ça :
pip install –upgrade tensorflow gpt-2-simple
pip install gpt-2-simple tensorflow
pip install transformers
pythonimport gpt_2_simple as gpt2
import tensorflow as tf
import osmodel_name = ‘124M’
checkpoint_path = os.path.join(‘C:\’, ‘Users’, ‘Enzo.Pasquier’, ‘models’, ‘124M’)gpt2.download_gpt2(model_name=model_name)
tf.compat.v1.reset_default_graph()
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.compat.v1.Session(config=config)
sess = gpt2.start_tf_sess()checkpoint_dir = checkpoint_path
gpt2.load_gpt2(sess, checkpoint_dir=checkpoint_dir)text = gpt2.generate(sess, length=100, temperature=0.7, prefix= »Il était une fois »)
print(text)
Puis, l’invite de commande me renvoie ça :
>> import gpt_2_simple as gpt2
>>> import tensorflow as tf
>>> import os
>>>
>>> model_name = ‘124M’
>>> checkpoint_path = os.path.join(‘C:\’, ‘Users’, ‘Enzo.Pasquier’, ‘models’, ‘124M’)
>>>
>>> gpt2.download_gpt2(model_name=model_name)
Fetching checkpoint: 1.05Mit [00:00, ?it/s]
Fetching encoder.json: 1.05Mit [00:01, 931kit/s]
Fetching hparams.json: 1.05Mit [00:00, ?it/s]
Fetching model.ckpt.data-00000-of-00001: 98%|█████████████████▋| 488M/498M [07:58<00:09, 1.02Mit/s]
Fetching model.ckpt.index: 1.05Mit [00:00, ?it/s]
Fetching model.ckpt.meta: 1.05Mit [00:00, 1.71Mit/s]
Fetching vocab.bpe: 1.05Mit [00:00, 1.33Mit/s]
>>>
>>> tf.compat.v1.reset_default_graph()
>>> config = tf.compat.v1.ConfigProto()
>>> config.gpu_options.allow_growth = True
>>> sess = tf.compat.v1.Session(config=config)
>>> sess = gpt2.start_tf_sess()
>>>
>>> checkpoint_dir = checkpoint_path
>>> gpt2.load_gpt2(sess, checkpoint_dir=checkpoint_dir)
Traceback (most recent call last):
File « <stdin> », line 1, in <module>
File « C:UsersEnzo.PasquierAppDataLocalProgramsPythonPython311Libsite-packagesgpt_2_simplegpt_2.py », line 385, in load_gpt2
with open(os.path.join(checkpoint_path, ‘hparams.json’)) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: ‘C:\Users\Enzo.Pasquier\models\124M\run1\hparams.json’
>>>
>>> text = gpt2.generate(sess, length=100, temperature=0.7, prefix= »Il était une fois »)
Traceback (most recent call last):
File « <stdin> », line 1, in <module>
File « C:UsersEnzo.PasquierAppDataLocalProgramsPythonPython311Libsite-packagesgpt_2_simplegpt_2.py », line 450, in generate
enc = encoder.get_encoder(checkpoint_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « C:UsersEnzo.PasquierAppDataLocalProgramsPythonPython311Libsite-packagesgpt_2_simplesrcencoder.py », line 109, in get_encoder
with open(os.path.join(checkpoint_path, ‘encoder.json’), ‘r’) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: ‘checkpoint\run1\encoder.json’
>>>
>>> print(text)
Traceback (most recent call last):
File « <stdin> », line 1, in <module>
NameError: name ‘text’ is not defined. Did you mean: ‘next’?il me dis que mon répértoire n’est pas correcte, sauf qu’il l’est, aidez-moi s’il vous plait 🙂
- Le sujet ‘GPT-2 Erreur invite de commande python’ est fermé à de nouvelles réponses.