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
69511cdc
Unverified
Commit
69511cdc
authored
Nov 26, 2021
by
Suraj Patil
Committed by
GitHub
Nov 26, 2021
Browse files
unfreeze initial cache in gpt models (#14535)
parent
2318bf77
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
src/transformers/models/gpt2/modeling_flax_gpt2.py
src/transformers/models/gpt2/modeling_flax_gpt2.py
+1
-1
src/transformers/models/gpt_neo/modeling_flax_gpt_neo.py
src/transformers/models/gpt_neo/modeling_flax_gpt_neo.py
+1
-1
No files found.
src/transformers/models/gpt2/modeling_flax_gpt2.py
View file @
69511cdc
...
@@ -444,7 +444,7 @@ class FlaxGPT2PreTrainedModel(FlaxPreTrainedModel):
...
@@ -444,7 +444,7 @@ class FlaxGPT2PreTrainedModel(FlaxPreTrainedModel):
init_variables
=
self
.
module
.
init
(
init_variables
=
self
.
module
.
init
(
jax
.
random
.
PRNGKey
(
0
),
input_ids
,
attention_mask
,
position_ids
,
return_dict
=
False
,
init_cache
=
True
jax
.
random
.
PRNGKey
(
0
),
input_ids
,
attention_mask
,
position_ids
,
return_dict
=
False
,
init_cache
=
True
)
)
return
init_variables
[
"cache"
]
return
unfreeze
(
init_variables
[
"cache"
]
)
@
add_start_docstrings_to_model_forward
(
GPT2_INPUTS_DOCSTRING
)
@
add_start_docstrings_to_model_forward
(
GPT2_INPUTS_DOCSTRING
)
def
__call__
(
def
__call__
(
...
...
src/transformers/models/gpt_neo/modeling_flax_gpt_neo.py
View file @
69511cdc
...
@@ -388,7 +388,7 @@ class FlaxGPTNeoPreTrainedModel(FlaxPreTrainedModel):
...
@@ -388,7 +388,7 @@ class FlaxGPTNeoPreTrainedModel(FlaxPreTrainedModel):
init_variables
=
self
.
module
.
init
(
init_variables
=
self
.
module
.
init
(
jax
.
random
.
PRNGKey
(
0
),
input_ids
,
attention_mask
,
position_ids
,
return_dict
=
False
,
init_cache
=
True
jax
.
random
.
PRNGKey
(
0
),
input_ids
,
attention_mask
,
position_ids
,
return_dict
=
False
,
init_cache
=
True
)
)
return
init_variables
[
"cache"
]
return
unfreeze
(
init_variables
[
"cache"
]
)
@
add_start_docstrings_to_model_forward
(
GPT_NEO_INPUTS_DOCSTRING
)
@
add_start_docstrings_to_model_forward
(
GPT_NEO_INPUTS_DOCSTRING
)
def
__call__
(
def
__call__
(
...
...
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