Skip to content

Incorrect check for MLFlow active run in MLflowCallback #17066

@orieg

Description

@orieg

System Info

- mlflow==1.25.1
- `transformers` version: 4.19.0.dev0
- Platform: Linux-5.10.76-linuxkit-aarch64-with-glibc2.31
- Python version: 3.9.7
- Huggingface_hub version: 0.2.1
- PyTorch version (GPU?): 1.10.2 (False)

Who can help?

Should be fixed by #17067

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Steps to reproduce:

  1. Follow Training tutorial as per https://huggingface.co/docs/transformers/training
  2. Change the training arguments to use TrainingArguments(output_dir="test_trainer", report_to=['mlflow'], run_name="run0")
  3. On trainer.train() the MLFlow UI should report a run with a Run Name of run0 which is not currently the case.

Cause of the Issue:

>> import mlflow
>> print(mlflow.active_run is None, mlflow.active_run() is None)
False True

In src/transformers/integrations.py the line if self._ml_flow.active_run is None: need to be replaced by if self._ml_flow.active_run() is None:

Expected behavior

PR #14894 introduce support for run_name in the MLflowCallback. Though, this does not work as expected since the active run is checked using a method reference that always returns true. Bug introduced by #16131.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions