Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
03585f37
Unverified
Commit
03585f37
authored
Jun 09, 2023
by
Matt
Committed by
GitHub
Jun 09, 2023
Browse files
Correctly build models and import call_context for older TF versions (#24138)
parent
a6d05d55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/modeling_tf_utils.py
src/transformers/modeling_tf_utils.py
+2
-2
No files found.
src/transformers/modeling_tf_utils.py
View file @
03585f37
...
...
@@ -81,7 +81,7 @@ elif parse(tf.__version__).minor >= 11:
from
keras.engine.keras_tensor
import
KerasTensor
else
:
from
tensorflow.python.keras
import
backend
as
K
from
tensorflow.python.keras.engine
import
call_context
from
tensorflow.python.keras.engine
.base_layer_utils
import
call_context
from
tensorflow.python.keras.engine.keras_tensor
import
KerasTensor
...
...
@@ -1156,8 +1156,8 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
if
self
.
built
or
call_context
().
in_call
:
self
.
built
=
True
else
:
self
(
self
.
dummy_inputs
,
training
=
False
)
self
.
built
=
True
self
(
self
.
dummy_inputs
,
training
=
False
)
def
__init__
(
self
,
config
,
*
inputs
,
**
kwargs
):
super
().
__init__
(
*
inputs
,
**
kwargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment