"...git@developer.sourcefind.cn:guobj/qwen_lmdeploy.git" did not exist on "97dcdff7ab0dffdbcdc89294f9819739f98dccce"
Unverified Commit 3a726777 authored by Victor Sonck's avatar Victor Sonck Committed by GitHub
Browse files

Fix ClearML Integration to run in ClearML pipelines and external Tasks. (#21531)

* Added clearml pipeline fix for when task is already initialized

* Correctly initialize
parent 17109ecf
...@@ -1430,17 +1430,26 @@ class ClearMLCallback(TrainerCallback): ...@@ -1430,17 +1430,26 @@ class ClearMLCallback(TrainerCallback):
def setup(self, args, state, model, tokenizer, **kwargs): def setup(self, args, state, model, tokenizer, **kwargs):
if self._clearml is None: if self._clearml is None:
return return
if self._initialized:
return
if state.is_world_process_zero: if state.is_world_process_zero:
logger.info("Automatic ClearML logging enabled.") logger.info("Automatic ClearML logging enabled.")
if self._clearml_task is None: if self._clearml_task is None:
self._clearml_task = self._clearml.Task.init( # This might happen when running inside of a pipeline, where the task is already initialized
project_name=os.getenv("CLEARML_PROJECT", "HuggingFace Transformers"), # from outside of Hugging Face
task_name=os.getenv("CLEARML_TASK", "Trainer"), if self._clearml.Task.current_task():
auto_connect_frameworks={"tensorboard": False, "pytorch": False}, self._clearml_task = self._clearml.Task.current_task()
output_uri=True, self._initialized = True
) logger.info("External ClearML Task has been connected.")
self._initialized = True else:
logger.info("ClearML Task has been initialized.") self._clearml_task = self._clearml.Task.init(
project_name=os.getenv("CLEARML_PROJECT", "HuggingFace Transformers"),
task_name=os.getenv("CLEARML_TASK", "Trainer"),
auto_connect_frameworks={"tensorboard": False, "pytorch": False},
output_uri=True,
)
self._initialized = True
logger.info("ClearML Task has been initialized.")
self._clearml_task.connect(args, "Args") self._clearml_task.connect(args, "Args")
if hasattr(model, "config") and model.config is not None: if hasattr(model, "config") and model.config is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment