From 5211d333bbb3dfb8660f67e8556bcec62fc51bf1 Mon Sep 17 00:00:00 2001 From: Bram Vanroy Date: Fri, 21 Feb 2020 17:28:32 +0100 Subject: [PATCH] Update modeling_tf_utils.py (#2924) Tensorflow does not use .eval() vs .train(). closes https://github.com/huggingface/transformers/issues/2906 --- src/transformers/modeling_tf_utils.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/transformers/modeling_tf_utils.py b/src/transformers/modeling_tf_utils.py index d15b02fbd8..452d377cd5 100644 --- a/src/transformers/modeling_tf_utils.py +++ b/src/transformers/modeling_tf_utils.py @@ -192,9 +192,6 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin): def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs): r"""Instantiate a pretrained TF 2.0 model from a pre-trained model configuration. - The model is set in evaluation mode by default using ``model.eval()`` (Dropout modules are deactivated) - To train the model, you should first set it back in training mode with ``model.train()`` - The warning ``Weights from XXX not initialized from pretrained model`` means that the weights of XXX do not come pre-trained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning task.