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
5ab21b07
Unverified
Commit
5ab21b07
authored
Aug 28, 2020
by
Sam Shleifer
Committed by
GitHub
Aug 28, 2020
Browse files
[s2s] Test hub configs in self-scheduled CI (#6809)
parent
3cac867f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
examples/seq2seq/test_seq2seq_examples.py
examples/seq2seq/test_seq2seq_examples.py
+22
-2
No files found.
examples/seq2seq/test_seq2seq_examples.py
View file @
5ab21b07
...
...
@@ -13,9 +13,10 @@ import torch
from
torch.utils.data
import
DataLoader
import
lightning_base
from
transformers
import
AutoModelForSeq2SeqLM
,
AutoTokenizer
from
transformers
import
AutoConfig
,
AutoModelForSeq2SeqLM
,
AutoTokenizer
from
transformers.hf_api
import
HfApi
from
transformers.modeling_bart
import
shift_tokens_right
from
transformers.testing_utils
import
CaptureStderr
,
CaptureStdout
,
require_multigpu
from
transformers.testing_utils
import
CaptureStderr
,
CaptureStdout
,
require_multigpu
,
require_torch_and_cuda
,
slow
from
.distillation
import
distill_main
,
evaluate_checkpoint
from
.finetune
import
SummarizationModule
,
main
...
...
@@ -116,6 +117,25 @@ class TestSummarizationDistiller(unittest.TestCase):
logging
.
disable
(
logging
.
CRITICAL
)
# remove noisy download output from tracebacks
return
cls
@
slow
@
require_torch_and_cuda
def
test_hub_configs
(
self
):
"""I put require_torch_and_cuda cause I only want this to run with self-scheduled."""
model_list
=
HfApi
().
model_list
()
org
=
"sshleifer"
model_ids
=
[
x
.
modelId
for
x
in
model_list
if
x
.
modelId
.
startswith
(
org
)]
allowed_to_be_broken
=
[
"sshleifer/blenderbot-3B"
,
"sshleifer/blenderbot-90M"
]
failures
=
[]
for
m
in
model_ids
:
if
m
in
allowed_to_be_broken
:
continue
try
:
AutoConfig
.
from_pretrained
(
m
)
except
Exception
:
failures
.
append
(
m
)
assert
not
failures
,
f
"The following models could not be loaded through AutoConfig:
{
failures
}
"
@
require_multigpu
def
test_multigpu
(
self
):
updates
=
dict
(
...
...
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