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
776c9d3a
Unverified
Commit
776c9d3a
authored
Mar 20, 2024
by
NielsRogge
Committed by
GitHub
Mar 20, 2024
Browse files
[Tests] Remove unused code (#29737)
Remove unused code
parent
a1a74541
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
17 deletions
+0
-17
tests/test_modeling_common.py
tests/test_modeling_common.py
+0
-17
No files found.
tests/test_modeling_common.py
View file @
776c9d3a
...
@@ -1946,28 +1946,11 @@ class ModelTesterMixin:
...
@@ -1946,28 +1946,11 @@ class ModelTesterMixin:
# Check that the embedding layer and decoding layer are the same in size and in value
# Check that the embedding layer and decoding layer are the same in size and in value
# self.assertTrue(check_same_values(embeddings, decoding))
# self.assertTrue(check_same_values(embeddings, decoding))
# # Check that after modification, they remain the same.
# embeddings.weight.data.div_(2)
# # Check that the embedding layer and decoding layer are the same in size and in value
# self.assertTrue(embeddings.weight.shape, decoding.weight.shape)
# self.assertTrue(check_same_values(embeddings, decoding))
# # Check that after modification, they remain the same.
# decoding.weight.data.div_(4)
# # Check that the embedding layer and decoding layer are the same in size and in value
# self.assertTrue(embeddings.weight.shape, decoding.weight.shape)
# self.assertTrue(check_same_values(embeddings, decoding))
# Check that after resize they remain tied.
# Check that after resize they remain tied.
model_tied
.
resize_token_embeddings
(
config
.
vocab_size
+
10
)
model_tied
.
resize_token_embeddings
(
config
.
vocab_size
+
10
)
params_tied_2
=
list
(
model_tied
.
parameters
())
params_tied_2
=
list
(
model_tied
.
parameters
())
self
.
assertEqual
(
len
(
params_tied_2
),
len
(
params_tied
))
self
.
assertEqual
(
len
(
params_tied_2
),
len
(
params_tied
))
# decoding.weight.data.mul_(20)
# # Check that the embedding layer and decoding layer are the same in size and in value
# self.assertTrue(model.transformer.wte.weight.shape, model.lm_head.weight.shape)
# self.assertTrue(check_same_values(model.transformer.wte, model.lm_head))
@
require_safetensors
@
require_safetensors
def
test_can_use_safetensors
(
self
):
def
test_can_use_safetensors
(
self
):
config
,
_
=
self
.
model_tester
.
prepare_config_and_inputs_for_common
()
config
,
_
=
self
.
model_tester
.
prepare_config_and_inputs_for_common
()
...
...
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