Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
c186e816
Unverified
Commit
c186e816
authored
Oct 20, 2022
by
Lianmin Zheng
Committed by
GitHub
Oct 20, 2022
Browse files
[FLAX] Add dtype to embedding for gpt2 model (#18462)
* [FLAX] Add dtype to embedding for gpt2 model * lint
parent
baa00f65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
src/transformers/models/gpt2/modeling_flax_gpt2.py
src/transformers/models/gpt2/modeling_flax_gpt2.py
+2
-0
No files found.
src/transformers/models/gpt2/modeling_flax_gpt2.py
View file @
c186e816
...
@@ -597,11 +597,13 @@ class FlaxGPT2Module(nn.Module):
...
@@ -597,11 +597,13 @@ class FlaxGPT2Module(nn.Module):
self
.
config
.
vocab_size
,
self
.
config
.
vocab_size
,
self
.
embed_dim
,
self
.
embed_dim
,
embedding_init
=
jax
.
nn
.
initializers
.
normal
(
stddev
=
self
.
config
.
initializer_range
),
embedding_init
=
jax
.
nn
.
initializers
.
normal
(
stddev
=
self
.
config
.
initializer_range
),
dtype
=
self
.
dtype
,
)
)
self
.
wpe
=
nn
.
Embed
(
self
.
wpe
=
nn
.
Embed
(
self
.
config
.
max_position_embeddings
,
self
.
config
.
max_position_embeddings
,
self
.
embed_dim
,
self
.
embed_dim
,
embedding_init
=
jax
.
nn
.
initializers
.
normal
(
stddev
=
self
.
config
.
initializer_range
),
embedding_init
=
jax
.
nn
.
initializers
.
normal
(
stddev
=
self
.
config
.
initializer_range
),
dtype
=
self
.
dtype
,
)
)
self
.
dropout
=
nn
.
Dropout
(
rate
=
self
.
config
.
embd_pdrop
)
self
.
dropout
=
nn
.
Dropout
(
rate
=
self
.
config
.
embd_pdrop
)
self
.
h
=
FlaxGPT2BlockCollection
(
self
.
config
,
dtype
=
self
.
dtype
)
self
.
h
=
FlaxGPT2BlockCollection
(
self
.
config
,
dtype
=
self
.
dtype
)
...
...
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