salesforce / ctrl

Conditional Transformer Language Model for Controllable Generation
https://arxiv.org/abs/1909.05858
BSD 3-Clause "New" or "Revised" License
1.87k stars 208 forks source link

'tensorflow._api.v1.keras.layers' has no attribute 'LayerNormalization' #62

Closed manueltonneau closed 4 years ago

manueltonneau commented 4 years ago

Thanks for the great contribution. I'm following the instructions to fine-tune CTRL on the Moby-Dick dataset and faced this error. Any idea why this could happen? Thanks a lot in advance!

More details on the error here: Traceback (most recent call last): File "training.py", line 116, in transformed = transformer.Encoder()(embedded, training=False) File "../transformer.py", line 116, in init setattr(self, "layer%i" % i, EncoderLayer(d_model_size, num_heads, dff, rate)) File "../transformer.py", line 83, in init self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-6) AttributeError: module 'tensorflow._api.v1.keras.layers' has no attribute 'LayerNormalization'

keskarnitish commented 4 years ago

Can you verify that you're using pip install tensorflow[-gpu]==1.14 ?

manueltonneau commented 4 years ago

This solved the problem, thanks!