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
fe41647a
Unverified
Commit
fe41647a
authored
Nov 30, 2023
by
Dave Berenbaum
Committed by
GitHub
Nov 30, 2023
Browse files
uses dvclive_test mode in examples/pytorch/test_accelerate_examples.py (#27763)
parent
62ab32b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
examples/pytorch/test_accelerate_examples.py
examples/pytorch/test_accelerate_examples.py
+9
-9
No files found.
examples/pytorch/test_accelerate_examples.py
View file @
fe41647a
...
...
@@ -75,7 +75,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
def
tearDownClass
(
cls
):
shutil
.
rmtree
(
cls
.
tmpdir
)
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_glue_no_trainer
(
self
):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
...
...
@@ -100,7 +100,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"glue_no_trainer"
)))
@
unittest
.
skip
(
"Zach is working on this."
)
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_clm_no_trainer
(
self
):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
...
...
@@ -128,7 +128,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"clm_no_trainer"
)))
@
unittest
.
skip
(
"Zach is working on this."
)
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_mlm_no_trainer
(
self
):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
...
...
@@ -148,7 +148,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"epoch_0"
)))
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"mlm_no_trainer"
)))
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_ner_no_trainer
(
self
):
# with so little data distributed training needs more epochs to get the score on par with 0/1 gpu
epochs
=
7
if
backend_device_count
(
torch_device
)
>
1
else
2
...
...
@@ -176,7 +176,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"epoch_0"
)))
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"ner_no_trainer"
)))
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_squad_no_trainer
(
self
):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
...
...
@@ -204,7 +204,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"epoch_0"
)))
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"qa_no_trainer"
)))
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_swag_no_trainer
(
self
):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
...
...
@@ -227,7 +227,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"swag_no_trainer"
)))
@
slow
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_summarization_no_trainer
(
self
):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
...
...
@@ -255,7 +255,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"summarization_no_trainer"
)))
@
slow
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_translation_no_trainer
(
self
):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
...
...
@@ -306,7 +306,7 @@ class ExamplesTestsNoTrainer(TestCasePlus):
result
=
get_results
(
tmp_dir
)
self
.
assertGreaterEqual
(
result
[
"eval_overall_accuracy"
],
0.10
)
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
})
@
mock
.
patch
.
dict
(
os
.
environ
,
{
"WANDB_MODE"
:
"offline"
,
"DVCLIVE_TEST"
:
"true"
})
def
test_run_image_classification_no_trainer
(
self
):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
...
...
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