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
76681015
"...lm-evaluation-harness.git" did not exist on "d8f9640482912d6c5bba596bc940253e99c9a620"
Unverified
Commit
76681015
authored
Apr 15, 2024
by
LZR
Committed by
GitHub
Apr 15, 2024
Browse files
round epoch only in console (#30237)
parent
fe2d20d2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
src/transformers/trainer.py
src/transformers/trainer.py
+1
-1
src/transformers/trainer_callback.py
src/transformers/trainer_callback.py
+6
-0
No files found.
src/transformers/trainer.py
View file @
76681015
...
...
@@ -3048,7 +3048,7 @@ class Trainer:
The values to log.
"""
if
self
.
state
.
epoch
is
not
None
:
logs
[
"epoch"
]
=
round
(
self
.
state
.
epoch
,
2
)
logs
[
"epoch"
]
=
self
.
state
.
epoch
if
self
.
args
.
include_num_input_tokens_seen
:
logs
[
"num_input_tokens_seen"
]
=
self
.
state
.
num_input_tokens_seen
...
...
src/transformers/trainer_callback.py
View file @
76681015
...
...
@@ -15,6 +15,7 @@
"""
Callbacks to use with the Trainer class and customize the training loop.
"""
import
copy
import
dataclasses
import
json
from
dataclasses
import
dataclass
...
...
@@ -520,7 +521,12 @@ class ProgressCallback(TrainerCallback):
def
on_log
(
self
,
args
,
state
,
control
,
logs
=
None
,
**
kwargs
):
if
state
.
is_world_process_zero
and
self
.
training_bar
is
not
None
:
# avoid modifying the logs object as it is shared between callbacks
logs
=
copy
.
deepcopy
(
logs
)
_
=
logs
.
pop
(
"total_flos"
,
None
)
# round numbers so that it looks better in console
if
"epoch"
in
logs
:
logs
[
"epoch"
]
=
round
(
logs
[
"epoch"
],
2
)
self
.
training_bar
.
write
(
str
(
logs
))
def
on_train_end
(
self
,
args
,
state
,
control
,
**
kwargs
):
...
...
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