Update modeling_tf_utils.py (#2924)

Tensorflow does not use .eval() vs .train().

closes https://github.com/huggingface/transformers/issues/2906
This commit is contained in:
Bram Vanroy
2020-02-21 17:28:32 +01:00
committed by GitHub
parent 3e98f27e4a
commit 5211d333bb

View File

@@ -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.