"docs/source/en/pipeline_tutorial.md" did not exist on "370f0ca18c8e4577357df59936e790acdecef4ac"
Unverified Commit 3fae83d2 authored by Joao Gante's avatar Joao Gante Committed by GitHub
Browse files

TF: Add informative warning for inexistent CPU backprop ops (#15612)

* Add informative warning
parent 7e4844fc
...@@ -1293,6 +1293,13 @@ class TFHubertPreTrainedModel(TFPreTrainedModel): ...@@ -1293,6 +1293,13 @@ class TFHubertPreTrainedModel(TFPreTrainedModel):
} }
return dummy_inputs return dummy_inputs
def __init__(self, config, *inputs, **kwargs):
super().__init__(config, *inputs, **kwargs)
logger.warning(
f"\n{self.__class__.__name__} has backpropagation operations that are NOT supported on CPU. If you wish "
"to train/fine-tine this model, you need a GPU or a TPU"
)
@tf.function @tf.function
def serving(self, inputs): def serving(self, inputs):
output = self.call(input_values=inputs, training=False) output = self.call(input_values=inputs, training=False)
......
...@@ -1319,6 +1319,13 @@ class TFWav2Vec2PreTrainedModel(TFPreTrainedModel): ...@@ -1319,6 +1319,13 @@ class TFWav2Vec2PreTrainedModel(TFPreTrainedModel):
} }
return dummy_inputs return dummy_inputs
def __init__(self, config, *inputs, **kwargs):
super().__init__(config, *inputs, **kwargs)
logger.warning(
f"\n{self.__class__.__name__} has backpropagation operations that are NOT supported on CPU. If you wish "
"to train/fine-tine this model, you need a GPU or a TPU"
)
@tf.function @tf.function
def serving(self, inputs): def serving(self, inputs):
output = self.call(input_values=inputs, training=False) output = self.call(input_values=inputs, training=False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment