Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate TFTrainer #12706

Merged
merged 2 commits into from
Jul 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/transformers/trainer_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import math
import os
from typing import Callable, Dict, Optional, Tuple
import warnings

from .file_utils import ENV_VARS_TRUE_VALUES

Expand Down Expand Up @@ -105,6 +106,13 @@ 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
Rocketknight1 marked this conversation as resolved.
Show resolved Hide resolved
)

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