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
8332327d
Unverified
Commit
8332327d
authored
Nov 29, 2021
by
Rahul Nadkarni
Committed by
GitHub
Nov 29, 2021
Browse files
Fix sentinel token IDs in data collator for Flax T5 pretraining script (#14477)
parent
2bd950ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/flax/language-modeling/run_t5_mlm_flax.py
examples/flax/language-modeling/run_t5_mlm_flax.py
+1
-1
No files found.
examples/flax/language-modeling/run_t5_mlm_flax.py
View file @
8332327d
...
...
@@ -291,7 +291,7 @@ class FlaxDataCollatorForT5MLM:
start_indices
[:,
0
]
=
mask_indices
[:,
0
]
sentinel_ids
=
np
.
where
(
start_indices
!=
0
,
np
.
cumsum
(
start_indices
,
axis
=-
1
),
start_indices
)
sentinel_ids
=
np
.
where
(
sentinel_ids
!=
0
,
(
s
en
tinel_ids
+
self
.
tokenizer
.
vocab_size
-
1
),
0
)
sentinel_ids
=
np
.
where
(
sentinel_ids
!=
0
,
(
l
en
(
self
.
tokenizer
)
-
sentinel_ids
),
0
)
sentinel_ids
-=
mask_indices
-
start_indices
return
sentinel_ids
...
...
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