Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
83f45cd6
Unverified
Commit
83f45cd6
authored
Feb 18, 2022
by
Lysandre Debut
Committed by
GitHub
Feb 18, 2022
Browse files
Fix auto (#15706)
parent
d5083c33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
25 deletions
+15
-25
tests/test_modeling_tf_auto.py
tests/test_modeling_tf_auto.py
+15
-25
No files found.
tests/test_modeling_tf_auto.py
View file @
83f45cd6
...
@@ -85,35 +85,25 @@ if is_tf_available():
...
@@ -85,35 +85,25 @@ if is_tf_available():
class
TFAutoModelTest
(
unittest
.
TestCase
):
class
TFAutoModelTest
(
unittest
.
TestCase
):
@
slow
@
slow
def
test_model_from_pretrained
(
self
):
def
test_model_from_pretrained
(
self
):
import
h5py
model_name
=
"bert-base-cased"
config
=
AutoConfig
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
config
)
self
.
assertIsInstance
(
config
,
BertConfig
)
self
.
assertTrue
(
h5py
.
version
.
hdf5_version
.
startswith
(
"1.10"
))
model
=
TFAutoModel
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
model
)
# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
self
.
assertIsInstance
(
model
,
TFBertModel
)
for
model_name
in
[
"bert-base-uncased"
]:
config
=
AutoConfig
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
config
)
self
.
assertIsInstance
(
config
,
BertConfig
)
model
=
TFAutoModel
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
model
)
self
.
assertIsInstance
(
model
,
TFBertModel
)
@
slow
@
slow
def
test_model_for_pretraining_from_pretrained
(
self
):
def
test_model_for_pretraining_from_pretrained
(
self
):
import
h5py
model_name
=
"bert-base-cased"
config
=
AutoConfig
.
from_pretrained
(
model_name
)
self
.
assertTrue
(
h5py
.
version
.
hdf5_version
.
startswith
(
"1.10"
))
self
.
assertIsNotNone
(
config
)
self
.
assertIsInstance
(
config
,
BertConfig
)
# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
for
model_name
in
[
"bert-base-uncased"
]:
model
=
TFAutoModelForPreTraining
.
from_pretrained
(
model_name
)
config
=
AutoConfig
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
model
)
self
.
assertIsNotNone
(
config
)
self
.
assertIsInstance
(
model
,
TFBertForPreTraining
)
self
.
assertIsInstance
(
config
,
BertConfig
)
model
=
TFAutoModelForPreTraining
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
model
)
self
.
assertIsInstance
(
model
,
TFBertForPreTraining
)
@
slow
@
slow
def
test_model_for_causal_lm
(
self
):
def
test_model_for_causal_lm
(
self
):
...
...
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