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
acb709d5
Unverified
Commit
acb709d5
authored
Jun 23, 2022
by
Zachary Mueller
Committed by
GitHub
Jun 23, 2022
Browse files
Change no trainer image_classification test (#17635)
* Adjust test arguments and use a new example test
parent
e70abdad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
examples/pytorch/test_accelerate_examples.py
examples/pytorch/test_accelerate_examples.py
+15
-9
No files found.
examples/pytorch/test_accelerate_examples.py
View file @
acb709d5
...
...
@@ -300,19 +300,25 @@ class ExamplesTestsNoTrainer(TestCasePlus):
tmp_dir
=
self
.
get_auto_remove_tmp_dir
()
testargs
=
f
"""
{
self
.
examples_dir
}
/pytorch/image-classification/run_image_classification_no_trainer.py
--dataset_name huggingface/image-classification-test-sample
--model_name_or_path google/vit-base-patch16-224-in21k
--dataset_name hf-internal-testing/cats_vs_dogs_sample
--learning_rate 1e-4
--per_device_train_batch_size 2
--per_device_eval_batch_size 1
--max_train_steps 2
--train_val_split 0.1
--seed 42
--output_dir
{
tmp_dir
}
--num_warmup_steps=8
--learning_rate=3e-3
--per_device_train_batch_size=2
--per_device_eval_batch_size=1
--checkpointing_steps epoch
--with_tracking
--
seed 42
--
checkpointing_steps 1
"""
.
split
()
if
is_cuda_and_apex_available
():
testargs
.
append
(
"--fp16"
)
_
=
subprocess
.
run
(
self
.
_launch_args
+
testargs
,
stdout
=
subprocess
.
PIPE
)
result
=
get_results
(
tmp_dir
)
self
.
assertGreaterEqual
(
result
[
"eval_accuracy"
],
0.50
)
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"epoch_0"
)))
# The base model scores a 25%
self
.
assertGreaterEqual
(
result
[
"eval_accuracy"
],
0.625
)
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"step_1"
)))
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
tmp_dir
,
"image_classification_no_trainer"
)))
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