Pytorch-lightning: MLFlowLogger throws a JSONDecodeError

Created on 19 Aug 2020  路  3Comments  路  Source: PyTorchLightning/pytorch-lightning

馃悰 Bug

To Reproduce

Steps to reproduce the behavior:

Code sample

from pytorch_lightning import Trainer
from pytorch_lightning.loggers import MLFlowLogger
mlflow_logger = MLFlowLogger(experiment_name="test-experiment", tracking_uri="URI_HERE")
t = Trainer(logger=mlflow_logger)
t.logger.experiment_id

throws a JSONDecodeError exception.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/envs/pl_env/lib/python3.7/site-packages/pytorch_lightning/loggers/mlflow.py", line 120, in experiment_id
    _ = self.experiment
  File "/envs/pl_env/lib/python3.7/site-packages/pytorch_lightning/loggers/base.py", line 421, in experiment
    return get_experiment() or DummyExperiment()
  File "/envs/pl_env/lib/python3.7/site-packages/pytorch_lightning/utilities/distributed.py", line 13, in wrapped_fn
    return fn(*args, **kwargs)
  File "/envs/pl_env/lib/python3.7/site-packages/pytorch_lightning/loggers/base.py", line 420, in get_experiment
    return fn(self)
  File "/envs/pl_env/lib/python3.7/site-packages/pytorch_lightning/loggers/mlflow.py", line 98, in experiment
    expt = self._mlflow_client.get_experiment_by_name(self._experiment_name)
  File "/envs/pl_env/lib/python3.7/site-packages/mlflow/tracking/client.py", line 154, in get_experiment_by_name
    return self._tracking_client.get_experiment_by_name(name)
  File "/envs/pl_env/lib/python3.7/site-packages/mlflow/tracking/_tracking_service/client.py", line 114, in get_experiment_by_name
    return self.store.get_experiment_by_name(name)
  File "/envs/pl_env/lib/python3.7/site-packages/mlflow/store/tracking/rest_store.py", line 219, in get_experiment_by_name
    response_proto = self._call_endpoint(GetExperimentByName, req_body)
  File "/envs/pl_env/lib/python3.7/site-packages/mlflow/store/tracking/rest_store.py", line 32, in _call_endpoint
    return call_endpoint(self.get_host_creds(), endpoint, method, json_body, response_proto)
  File "/envs/pl_env/lib/python3.7/site-packages/mlflow/utils/rest_utils.py", line 145, in call_endpoint
    js_dict = json.loads(response.text)
  File "/envs/pl_env/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/envs/pl_env/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/envs/pl_env/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Expected behavior

Environment

Environment details
```

  • PyTorch Version (e.g., 1.0): 1.6.0
  • PyTorch Lightning Version: 0.9.0rc12
  • OS (e.g., Linux): Linux
  • How you installed PyTorch (conda, pip, source): conda
  • Build command you used (if compiling from source):
  • Python version: 3.7.7
  • CUDA/cuDNN version: Not relevant
  • GPU models and configuration: Not relevant
  • Any other relevant information: Not relevant

Additional context

bug / fix help wanted information needed

Most helpful comment

Thanks for the quick response, @awaelchli!

I did nothing different this morning and I am able to log metrics/parameters to mlflow. I will close this now and in case I encounter this again, I will reopen this issue.

All 3 comments

Hi! thanks for your contribution!, great first issue!

Hi, thanks for submitting the bug. I don't know what's going on here. I cannot reproduce with your instructions.

I'm running your sample code

    mlflow_logger = MLFlowLogger(experiment_name="test-experiment", tracking_uri="http://127.0.0.1:5000")
    trainer = Trainer(logger=mlflow_logger)
    trainer.logger.experiment_id

and the tracking uri I got from running

mlflow ui

The experiment shows up in the UI and I get no errors. I verified this with the latest version of PL and mlflow, python 3.7.

Is there any other information you can provide on the issue?

Thanks for the quick response, @awaelchli!

I did nothing different this morning and I am able to log metrics/parameters to mlflow. I will close this now and in case I encounter this again, I will reopen this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iakremnev picture iakremnev  路  3Comments

mmsamiei picture mmsamiei  路  3Comments

srush picture srush  路  3Comments

remisphere picture remisphere  路  3Comments

maxime-louis picture maxime-louis  路  3Comments