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
MiniCMP_classify_pytorch
Commits
7cc0d202
"git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "d69dfb7c8b2183a633bd849839e056e9317d4803"
Commit
7cc0d202
authored
Oct 12, 2024
by
dcuai
Browse files
Update modeling_minicpm.py ——.flatten()
parent
6183fe60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
modeling_minicpm.py
modeling_minicpm.py
+1
-1
No files found.
modeling_minicpm.py
View file @
7cc0d202
...
...
@@ -78,7 +78,7 @@ def _get_unpad_data(attention_mask):
seqlens_in_batch
=
attention_mask
.
sum
(
dim
=-
1
,
dtype
=
torch
.
int32
)
indices
=
torch
.
nonzero
(
attention_mask
.
flatten
(),
as_tuple
=
False
).
flatten
()
max_seqlen_in_batch
=
seqlens_in_batch
.
max
().
item
()
cu_seqlens
=
F
.
pad
(
torch
.
cumsum
(
seqlens_in_batch
,
dim
=
0
,
dtype
=
torch
.
torch
.
int32
),
(
1
,
0
))
cu_seqlens
=
F
.
pad
(
torch
.
cumsum
(
seqlens_in_batch
.
flatten
()
,
dim
=
0
,
dtype
=
torch
.
torch
.
int32
),
(
1
,
0
))
return
(
indices
,
cu_seqlens
,
...
...
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