ConnorJL / GPT2

An implementation of training for GPT2, supports TPUs
MIT License
1.42k stars 334 forks source link

Error on output #31

Open silicahd opened 3 years ago

silicahd commented 3 years ago

After about 5 hours I think I am throwing in the towel here. I have ran all the commands at noted. I am running this in google colab where I tested a few other systems. However this one works great until I try to run this last command.

!python3 main.py --model 1.5B.json [--top_k Top-K-Truncation] --predict_text "Hello there! My name is"

Error:

2020-10-16 23:42:00.183472: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
Traceback (most recent call last):
  File "main.py", line 12, in <module>
    from model_fns import *
  File "/home/GPT2/model_fns.py", line 6, in <module>
    from optimizers import create_train_op
  File "/home/GPT2/optimizers.py", line 100, in <module>
    class AdafactorOptimizer(tf.train.Optimizer):
AttributeError: module 'tensorflow._api.v2.train' has no attribute 'Optimizer'
ConnorJL commented 3 years ago

This repo is deprecated and you should use transformers if possible. Are you using Tensorflow version 1.15 or earlier? This repo does not work with Tensorflow 2. (Also, the command line parameters in brackets are optional and shouldn't be passed like that)