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
ChatGLM-6B_pytorch
Commits
23c1ad07
"torchvision/models/_api.py" did not exist on "8fe72d131d6d2862b9db1efb3ffa2a6ded15efc8"
Commit
23c1ad07
authored
May 27, 2024
by
zhaoying1
Browse files
Update modeling_chatglm.py
parent
43fc60f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
model/modeling_chatglm.py
model/modeling_chatglm.py
+1
-1
No files found.
model/modeling_chatglm.py
View file @
23c1ad07
...
@@ -277,7 +277,7 @@ def attention_fn(
...
@@ -277,7 +277,7 @@ def attention_fn(
q
,
k
,
v
=
[
rearrange
(
x
,
'b s h d -> b h s d'
)
for
x
in
[
query_layer
,
key_layer
,
value_layer
]]
q
,
k
,
v
=
[
rearrange
(
x
,
'b s h d -> b h s d'
)
for
x
in
[
query_layer
,
key_layer
,
value_layer
]]
ctx_lens1
=
ctx_lens
.
to
(
q
.
device
)
ctx_lens1
=
ctx_lens
.
to
(
q
.
device
)
output
=
flash_attn_func
(
q
,
k
,
v
,
query_key_layer_scaling_coeff
,
ctx_lens1
)
output
=
flash_attn_func
(
q
,
k
,
v
,
query_key_layer_scaling_coeff
,
ctx_lens1
,
3
)
context_layer
=
output
.
permute
(
2
,
0
,
1
,
3
)
context_layer
=
output
.
permute
(
2
,
0
,
1
,
3
)
new_context_layer_shape
=
context_layer
.
size
()[:
-
2
]
+
(
hidden_size_per_partition
,)
new_context_layer_shape
=
context_layer
.
size
()[:
-
2
]
+
(
hidden_size_per_partition
,)
context_layer
=
context_layer
.
view
(
*
new_context_layer_shape
)
context_layer
=
context_layer
.
view
(
*
new_context_layer_shape
)
...
...
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