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
0e402e14
Unverified
Commit
0e402e14
authored
Nov 08, 2023
by
Sergii Dymchenko
Committed by
GitHub
Nov 08, 2023
Browse files
Update deprecated `torch.range` in `test_modeling_ibert.py` (#27355)
* Update deprecated torch.range * Remove comment
parent
a5bee89c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
tests/models/ibert/test_modeling_ibert.py
tests/models/ibert/test_modeling_ibert.py
+2
-3
No files found.
tests/models/ibert/test_modeling_ibert.py
View file @
0e402e14
...
...
@@ -519,7 +519,7 @@ class IBertModelIntegrationTest(unittest.TestCase):
gelu_q
=
IntGELU
(
quant_mode
=
True
)
gelu_dq
=
nn
.
GELU
()
x_int
=
torch
.
range
(
-
10000
,
1000
0
,
1
)
x_int
=
torch
.
a
range
(
-
10000
,
1000
1
,
1
)
x_scaling_factor
=
torch
.
tensor
(
0.001
)
x
=
x_int
*
x_scaling_factor
...
...
@@ -534,7 +534,7 @@ class IBertModelIntegrationTest(unittest.TestCase):
self
.
assertTrue
(
torch
.
allclose
(
q_int
,
q_int
.
round
(),
atol
=
1e-4
))
def
test_force_dequant_gelu
(
self
):
x_int
=
torch
.
range
(
-
10000
,
1000
0
,
1
)
x_int
=
torch
.
a
range
(
-
10000
,
1000
1
,
1
)
x_scaling_factor
=
torch
.
tensor
(
0.001
)
x
=
x_int
*
x_scaling_factor
...
...
@@ -565,7 +565,6 @@ class IBertModelIntegrationTest(unittest.TestCase):
softmax_q
=
IntSoftmax
(
output_bit
,
quant_mode
=
True
)
softmax_dq
=
nn
.
Softmax
()
# x_int = torch.range(-10000, 10000, 1)
def
_test
(
array
):
x_int
=
torch
.
tensor
(
array
)
x_scaling_factor
=
torch
.
tensor
(
0.1
)
...
...
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