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
OpenDAS
ColossalAI
Commits
5d88ef1a
"runtime/tests/vscode:/vscode.git/clone" did not exist on "9322edef4c792425e0b6381b9dda3a3541cddc18"
Unverified
Commit
5d88ef1a
authored
Apr 25, 2024
by
flybird11111
Committed by
GitHub
Apr 25, 2024
Browse files
[shardformer] remove useless code (#5645)
parent
148506c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
14 deletions
+0
-14
colossalai/shardformer/modeling/opt.py
colossalai/shardformer/modeling/opt.py
+0
-14
No files found.
colossalai/shardformer/modeling/opt.py
View file @
5d88ef1a
...
@@ -58,20 +58,6 @@ class OPTPipelineForwards:
...
@@ -58,20 +58,6 @@ class OPTPipelineForwards:
under pipeline setting.
under pipeline setting.
"""
"""
@
staticmethod
def
_expand_mask
(
mask
:
torch
.
Tensor
,
dtype
:
torch
.
dtype
,
tgt_len
:
Optional
[
int
]
=
None
):
"""
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
"""
bsz
,
src_len
=
mask
.
size
()
tgt_len
=
tgt_len
if
tgt_len
is
not
None
else
src_len
expanded_mask
=
mask
[:,
None
,
None
,
:].
expand
(
bsz
,
1
,
tgt_len
,
src_len
).
to
(
dtype
)
inverted_mask
=
1.0
-
expanded_mask
return
inverted_mask
.
masked_fill
(
inverted_mask
.
to
(
torch
.
bool
),
torch
.
finfo
(
dtype
).
min
)
@
staticmethod
@
staticmethod
def
opt_model_forward
(
def
opt_model_forward
(
self
:
OPTModel
,
self
:
OPTModel
,
...
...
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