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
9e78c9ac
Unverified
Commit
9e78c9ac
authored
Oct 05, 2023
by
eajechiloae
Committed by
GitHub
Oct 05, 2023
Browse files
Don't close ClearML task if it was created externally (#26614)
don't close clearml task if it was created externally
parent
0a3b9d02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/transformers/integrations/integration_utils.py
src/transformers/integrations/integration_utils.py
+3
-1
No files found.
src/transformers/integrations/integration_utils.py
View file @
9e78c9ac
...
...
@@ -1447,6 +1447,7 @@ class ClearMLCallback(TrainerCallback):
raise
RuntimeError
(
"ClearMLCallback requires 'clearml' to be installed. Run `pip install clearml`."
)
self
.
_initialized
=
False
self
.
_initialized_externally
=
False
self
.
_clearml_task
=
None
self
.
_log_model
=
os
.
getenv
(
"CLEARML_LOG_MODEL"
,
"FALSE"
).
upper
()
in
ENV_VARS_TRUE_VALUES
.
union
({
"TRUE"
})
...
...
@@ -1464,6 +1465,7 @@ class ClearMLCallback(TrainerCallback):
if
self
.
_clearml
.
Task
.
current_task
():
self
.
_clearml_task
=
self
.
_clearml
.
Task
.
current_task
()
self
.
_initialized
=
True
self
.
_initialized_externally
=
True
logger
.
info
(
"External ClearML Task has been connected."
)
else
:
self
.
_clearml_task
=
self
.
_clearml
.
Task
.
init
(
...
...
@@ -1490,7 +1492,7 @@ class ClearMLCallback(TrainerCallback):
def
on_train_end
(
self
,
args
,
state
,
control
,
model
=
None
,
tokenizer
=
None
,
metrics
=
None
,
logs
=
None
,
**
kwargs
):
if
self
.
_clearml
is
None
:
return
if
self
.
_clearml_task
and
state
.
is_world_process_zero
:
if
self
.
_clearml_task
and
state
.
is_world_process_zero
and
not
self
.
_initialized_externally
:
# Close ClearML Task at the end end of training
self
.
_clearml_task
.
close
()
...
...
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