"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "c7d1fb6964cf584ec29dd94345248aa6c23890ad"
Unverified Commit 2f611f85 authored by Nicolas Brousse's avatar Nicolas Brousse Committed by GitHub
Browse files

Mlflowcallback fix nonetype error (#17171)

* Fix edge cases TypeError: 'NoneType' object is not callable

* fix style
parent 95b6bef6
......@@ -880,7 +880,11 @@ class MLflowCallback(TrainerCallback):
def __del__(self):
# if the previous run is not terminated correctly, the fluent API will
# not let you start a new run before the previous one is killed
if self._auto_end_run and self._ml_flow and self._ml_flow.active_run() is not None:
if (
self._auto_end_run
and callable(getattr(self._ml_flow, "active_run", None))
and self._ml_flow.active_run() is not None
):
self._ml_flow.end_run()
......
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