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
c63bfc30
Unverified
Commit
c63bfc30
authored
May 31, 2023
by
Younes Belkada
Committed by
GitHub
May 31, 2023
Browse files
[`RWKV`] Fix RWKV 4bit (#23910)
fix RWKV 4bit
parent
55451c66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
src/transformers/models/rwkv/modeling_rwkv.py
src/transformers/models/rwkv/modeling_rwkv.py
+7
-0
No files found.
src/transformers/models/rwkv/modeling_rwkv.py
View file @
c63bfc30
...
...
@@ -710,6 +710,13 @@ class RwkvModel(RwkvPreTrainedModel):
if
hasattr
(
block
.
attention
.
output
.
weight
,
"SCB"
):
block
.
attention
.
output
.
weight
.
SCB
.
div_
(
2
**
int
(
block_id
//
self
.
config
.
rescale_every
))
block
.
feed_forward
.
value
.
weight
.
SCB
.
div_
(
2
**
int
(
block_id
//
self
.
config
.
rescale_every
))
elif
hasattr
(
block
.
attention
.
output
.
weight
,
"quant_state"
):
block
.
attention
.
output
.
weight
.
quant_state
[
0
].
div_
(
2
**
int
(
block_id
//
self
.
config
.
rescale_every
)
)
block
.
feed_forward
.
value
.
weight
.
quant_state
[
0
].
div_
(
2
**
int
(
block_id
//
self
.
config
.
rescale_every
)
)
else
:
block
.
attention
.
output
.
weight
.
div_
(
2
**
int
(
block_id
//
self
.
config
.
rescale_every
))
block
.
feed_forward
.
value
.
weight
.
div_
(
2
**
int
(
block_id
//
self
.
config
.
rescale_every
))
...
...
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