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
ModelZoo
UMT5_pytorch
Commits
2950b694
Commit
2950b694
authored
Aug 22, 2024
by
wanglch
Browse files
Update train_multi_dcu.py
parent
a5866d29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
train_multi_dcu.py
train_multi_dcu.py
+1
-1
No files found.
train_multi_dcu.py
View file @
2950b694
...
...
@@ -66,7 +66,7 @@ def collate_fn(batch_samples):
truncation
=
True
,
return_tensors
=
"pt"
)[
"input_ids"
]
batch_data
[
'decoder_input_ids'
]
=
model
.
prepare_decoder_input_ids_from_labels
(
labels
)
batch_data
[
'decoder_input_ids'
]
=
model
.
module
.
prepare_decoder_input_ids_from_labels
(
labels
)
end_token_index
=
torch
.
where
(
labels
==
tokenizer
.
eos_token_id
)[
1
]
for
idx
,
end_idx
in
enumerate
(
end_token_index
):
labels
[
idx
][
end_idx
+
1
:]
=
-
100
...
...
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