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
29a2b142
"test/vscode:/vscode.git/clone" did not exist on "95479e6767b3d254fbc9b030bae28d4863ea48eb"
Unverified
Commit
29a2b142
authored
Jan 12, 2024
by
Siddartha Naidu
Committed by
GitHub
Jan 12, 2024
Browse files
Change progress logging to once across all nodes (#28373)
parent
2382706a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/transformers/trainer_callback.py
src/transformers/trainer_callback.py
+7
-7
No files found.
src/transformers/trainer_callback.py
View file @
29a2b142
...
@@ -489,17 +489,17 @@ class ProgressCallback(TrainerCallback):
...
@@ -489,17 +489,17 @@ class ProgressCallback(TrainerCallback):
self
.
prediction_bar
=
None
self
.
prediction_bar
=
None
def
on_train_begin
(
self
,
args
,
state
,
control
,
**
kwargs
):
def
on_train_begin
(
self
,
args
,
state
,
control
,
**
kwargs
):
if
state
.
is_
local
_process_zero
:
if
state
.
is_
world
_process_zero
:
self
.
training_bar
=
tqdm
(
total
=
state
.
max_steps
,
dynamic_ncols
=
True
)
self
.
training_bar
=
tqdm
(
total
=
state
.
max_steps
,
dynamic_ncols
=
True
)
self
.
current_step
=
0
self
.
current_step
=
0
def
on_step_end
(
self
,
args
,
state
,
control
,
**
kwargs
):
def
on_step_end
(
self
,
args
,
state
,
control
,
**
kwargs
):
if
state
.
is_
local
_process_zero
:
if
state
.
is_
world
_process_zero
:
self
.
training_bar
.
update
(
state
.
global_step
-
self
.
current_step
)
self
.
training_bar
.
update
(
state
.
global_step
-
self
.
current_step
)
self
.
current_step
=
state
.
global_step
self
.
current_step
=
state
.
global_step
def
on_prediction_step
(
self
,
args
,
state
,
control
,
eval_dataloader
=
None
,
**
kwargs
):
def
on_prediction_step
(
self
,
args
,
state
,
control
,
eval_dataloader
=
None
,
**
kwargs
):
if
state
.
is_
local
_process_zero
and
has_length
(
eval_dataloader
):
if
state
.
is_
world
_process_zero
and
has_length
(
eval_dataloader
):
if
self
.
prediction_bar
is
None
:
if
self
.
prediction_bar
is
None
:
self
.
prediction_bar
=
tqdm
(
self
.
prediction_bar
=
tqdm
(
total
=
len
(
eval_dataloader
),
leave
=
self
.
training_bar
is
None
,
dynamic_ncols
=
True
total
=
len
(
eval_dataloader
),
leave
=
self
.
training_bar
is
None
,
dynamic_ncols
=
True
...
@@ -507,24 +507,24 @@ class ProgressCallback(TrainerCallback):
...
@@ -507,24 +507,24 @@ class ProgressCallback(TrainerCallback):
self
.
prediction_bar
.
update
(
1
)
self
.
prediction_bar
.
update
(
1
)
def
on_evaluate
(
self
,
args
,
state
,
control
,
**
kwargs
):
def
on_evaluate
(
self
,
args
,
state
,
control
,
**
kwargs
):
if
state
.
is_
local
_process_zero
:
if
state
.
is_
world
_process_zero
:
if
self
.
prediction_bar
is
not
None
:
if
self
.
prediction_bar
is
not
None
:
self
.
prediction_bar
.
close
()
self
.
prediction_bar
.
close
()
self
.
prediction_bar
=
None
self
.
prediction_bar
=
None
def
on_predict
(
self
,
args
,
state
,
control
,
**
kwargs
):
def
on_predict
(
self
,
args
,
state
,
control
,
**
kwargs
):
if
state
.
is_
local
_process_zero
:
if
state
.
is_
world
_process_zero
:
if
self
.
prediction_bar
is
not
None
:
if
self
.
prediction_bar
is
not
None
:
self
.
prediction_bar
.
close
()
self
.
prediction_bar
.
close
()
self
.
prediction_bar
=
None
self
.
prediction_bar
=
None
def
on_log
(
self
,
args
,
state
,
control
,
logs
=
None
,
**
kwargs
):
def
on_log
(
self
,
args
,
state
,
control
,
logs
=
None
,
**
kwargs
):
if
state
.
is_
local
_process_zero
and
self
.
training_bar
is
not
None
:
if
state
.
is_
world
_process_zero
and
self
.
training_bar
is
not
None
:
_
=
logs
.
pop
(
"total_flos"
,
None
)
_
=
logs
.
pop
(
"total_flos"
,
None
)
self
.
training_bar
.
write
(
str
(
logs
))
self
.
training_bar
.
write
(
str
(
logs
))
def
on_train_end
(
self
,
args
,
state
,
control
,
**
kwargs
):
def
on_train_end
(
self
,
args
,
state
,
control
,
**
kwargs
):
if
state
.
is_
local
_process_zero
:
if
state
.
is_
world
_process_zero
:
self
.
training_bar
.
close
()
self
.
training_bar
.
close
()
self
.
training_bar
=
None
self
.
training_bar
=
None
...
...
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