Skip to content

Commit

Permalink
Deprecate TFTrainer (#12706)
Browse files Browse the repository at this point in the history
* Deprecate TFTrainer

* Style pass
  • Loading branch information
Rocketknight1 authored Jul 14, 2021
1 parent 084873b commit 79c57e1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/transformers/trainer_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import datetime
import math
import os
import warnings
from typing import Callable, Dict, Optional, Tuple

from .file_utils import ENV_VARS_TRUE_VALUES
Expand Down Expand Up @@ -105,6 +106,14 @@ def __init__(
self.epoch_logging = 0
self.eval_loss = tf.keras.metrics.Sum()

warnings.warn(
"The class `TFTrainer` is deprecated and will be removed in version 5 of Transformers. "
"We recommend using native Keras instead, by calling methods like `fit()` and `predict()` "
"directly on the model object. Detailed examples of the Keras style can be found in our "
"examples at https://github.com/huggingface/transformers/tree/master/examples/tensorflow",
FutureWarning,
)

if tb_writer is not None:
self.tb_writer = tb_writer
else:
Expand Down

0 comments on commit 79c57e1

Please sign in to comment.