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
be79cd7d
Unverified
Commit
be79cd7d
authored
Jul 06, 2022
by
Matt
Committed by
GitHub
Jul 06, 2022
Browse files
Protect `TFGenerationMixin.seed_generator` so it's not created at import (#18044)
parent
360719a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
src/transformers/generation_tf_utils.py
src/transformers/generation_tf_utils.py
+8
-1
No files found.
src/transformers/generation_tf_utils.py
View file @
be79cd7d
...
@@ -346,7 +346,14 @@ class TFGenerationMixin:
...
@@ -346,7 +346,14 @@ class TFGenerationMixin:
A class containing all of the functions supporting generation, to be used as a mixin in [`TFPreTrainedModel`].
A class containing all of the functions supporting generation, to be used as a mixin in [`TFPreTrainedModel`].
"""
"""
seed_generator
=
tf
.
random
.
Generator
.
from_non_deterministic_state
()
_seed_generator
=
None
@
property
def
seed_generator
(
self
):
if
self
.
_seed_generator
is
None
:
self
.
_seed_generator
=
tf
.
random
.
Generator
.
from_non_deterministic_state
()
return
self
.
_seed_generator
supports_xla_generation
=
True
supports_xla_generation
=
True
def
prepare_inputs_for_generation
(
self
,
inputs
,
**
kwargs
):
def
prepare_inputs_for_generation
(
self
,
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