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
d90a36d1
Unverified
Commit
d90a36d1
authored
Aug 22, 2022
by
Atharva Ingle
Committed by
GitHub
Aug 22, 2022
Browse files
remove check for main process for trackers initialization (#18706)
parent
0f257a87
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
45 additions
and
63 deletions
+45
-63
examples/pytorch/image-classification/run_image_classification_no_trainer.py
...age-classification/run_image_classification_no_trainer.py
+5
-7
examples/pytorch/language-modeling/run_clm_no_trainer.py
examples/pytorch/language-modeling/run_clm_no_trainer.py
+5
-7
examples/pytorch/language-modeling/run_mlm_no_trainer.py
examples/pytorch/language-modeling/run_mlm_no_trainer.py
+5
-7
examples/pytorch/multiple-choice/run_swag_no_trainer.py
examples/pytorch/multiple-choice/run_swag_no_trainer.py
+5
-7
examples/pytorch/question-answering/run_qa_no_trainer.py
examples/pytorch/question-answering/run_qa_no_trainer.py
+5
-7
examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py
...ntic-segmentation/run_semantic_segmentation_no_trainer.py
+5
-7
examples/pytorch/summarization/run_summarization_no_trainer.py
...les/pytorch/summarization/run_summarization_no_trainer.py
+5
-7
examples/pytorch/text-classification/run_glue_no_trainer.py
examples/pytorch/text-classification/run_glue_no_trainer.py
+5
-7
examples/pytorch/token-classification/run_ner_no_trainer.py
examples/pytorch/token-classification/run_ner_no_trainer.py
+5
-7
No files found.
examples/pytorch/image-classification/run_image_classification_no_trainer.py
View file @
d90a36d1
...
...
@@ -414,14 +414,12 @@ def main():
checkpointing_steps
=
None
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"image_classification_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"image_classification_no_trainer"
,
experiment_config
)
# Get the metric function
metric
=
evaluate
.
load
(
"accuracy"
)
...
...
examples/pytorch/language-modeling/run_clm_no_trainer.py
View file @
d90a36d1
...
...
@@ -516,14 +516,12 @@ def main():
checkpointing_steps
=
None
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"clm_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"clm_no_trainer"
,
experiment_config
)
# Train!
total_batch_size
=
args
.
per_device_train_batch_size
*
accelerator
.
num_processes
*
args
.
gradient_accumulation_steps
...
...
examples/pytorch/language-modeling/run_mlm_no_trainer.py
View file @
d90a36d1
...
...
@@ -560,14 +560,12 @@ def main():
checkpointing_steps
=
None
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"mlm_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"mlm_no_trainer"
,
experiment_config
)
# Train!
total_batch_size
=
args
.
per_device_train_batch_size
*
accelerator
.
num_processes
*
args
.
gradient_accumulation_steps
...
...
examples/pytorch/multiple-choice/run_swag_no_trainer.py
View file @
d90a36d1
...
...
@@ -513,14 +513,12 @@ def main():
checkpointing_steps
=
None
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"swag_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"swag_no_trainer"
,
experiment_config
)
# Metrics
metric
=
evaluate
.
load
(
"accuracy"
)
...
...
examples/pytorch/question-answering/run_qa_no_trainer.py
View file @
d90a36d1
...
...
@@ -787,14 +787,12 @@ def main():
checkpointing_steps
=
None
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"qa_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"qa_no_trainer"
,
experiment_config
)
# Train!
total_batch_size
=
args
.
per_device_train_batch_size
*
accelerator
.
num_processes
*
args
.
gradient_accumulation_steps
...
...
examples/pytorch/semantic-segmentation/run_semantic_segmentation_no_trainer.py
View file @
d90a36d1
...
...
@@ -512,14 +512,12 @@ def main():
metric
=
evaluate
.
load
(
"mean_iou"
)
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"semantic_segmentation_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"semantic_segmentation_no_trainer"
,
experiment_config
)
# Train!
total_batch_size
=
args
.
per_device_train_batch_size
*
accelerator
.
num_processes
*
args
.
gradient_accumulation_steps
...
...
examples/pytorch/summarization/run_summarization_no_trainer.py
View file @
d90a36d1
...
...
@@ -581,14 +581,12 @@ def main():
checkpointing_steps
=
None
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"summarization_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"summarization_no_trainer"
,
experiment_config
)
# Metric
metric
=
evaluate
.
load
(
"rouge"
)
...
...
examples/pytorch/text-classification/run_glue_no_trainer.py
View file @
d90a36d1
...
...
@@ -459,14 +459,12 @@ def main():
checkpointing_steps
=
None
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"glue_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"glue_no_trainer"
,
experiment_config
)
# Get the metric function
if
args
.
task_name
is
not
None
:
...
...
examples/pytorch/token-classification/run_ner_no_trainer.py
View file @
d90a36d1
...
...
@@ -574,14 +574,12 @@ def main():
checkpointing_steps
=
None
# We need to initialize the trackers we use, and also store our configuration.
# We initialize the trackers only on main process because `accelerator.log`
# only logs on main process and we don't want empty logs/runs on other processes.
# The trackers initializes automatically on the main process.
if
args
.
with_tracking
:
if
accelerator
.
is_main_process
:
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"ner_no_trainer"
,
experiment_config
)
experiment_config
=
vars
(
args
)
# TensorBoard cannot log Enums, need the raw value
experiment_config
[
"lr_scheduler_type"
]
=
experiment_config
[
"lr_scheduler_type"
].
value
accelerator
.
init_trackers
(
"ner_no_trainer"
,
experiment_config
)
# Metrics
metric
=
evaluate
.
load
(
"seqeval"
)
...
...
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