Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unsupported operand type(s) for /: 'str' and 'str' when using MlflowArtifactDataSet with MlflowModelSaverDataSet #116

Closed
turn1a opened this issue Nov 6, 2020 · 0 comments · Fixed by #117
Assignees
Labels
bug Something isn't working

Comments

@turn1a
Copy link
Contributor

turn1a commented Nov 6, 2020

Description

TypeError: unsupported operand type(s) for /: 'str' and 'str' occurs when MlflowArtifactDataSet is used with MlflowModelSaverDataSet.

Context

Logging locally and to MLflow in one step.

Steps to Reproduce

sklearn_model:
    type: kedro_mlflow.io.artifacts.MlflowArtifactDataSet
    data_set:
        type: kedro_mlflow.io.models.MlflowModelSaverDataSet
        flavor: mlflow.sklearn
        filepath: data/06_models/sklearn_model
        versioned: true

Expected Result

The model should be saved locally and in MLflow run at the same time.

Actual Result

Traceback (most recent call last):
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/io/core.py", line 240, in save
    self._save(data)
  File "/Users/olszewk2/dev/pyzypad-example/src/kedro-mlflow/kedro_mlflow/io/artifacts/mlflow_artifact_dataset.py", line 40, in _save
    if hasattr(self, "_version")
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/io/core.py", line 605, in _get_save_path
    versioned_path = self._get_versioned_path(save_version)  # type: ignore
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/io/core.py", line 616, in _get_versioned_path
    return self._filepath / version / self._filepath.name
TypeError: unsupported operand type(s) for /: 'str' and 'str'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/bin/kedro", line 8, in <module>
    sys.exit(main())
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/framework/cli/cli.py", line 725, in main
    cli_collection()
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/olszewk2/dev/pyzypad-example/kedro_cli.py", line 230, in run
    pipeline_name=pipeline,
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/framework/context/context.py", line 767, in run
    raise exc
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/framework/context/context.py", line 759, in run
    run_result = runner.run(filtered_pipeline, catalog, run_id)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/runner/runner.py", line 101, in run
    self._run(pipeline, catalog, run_id)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/runner/sequential_runner.py", line 90, in _run
    run_node(node, catalog, self._is_async, run_id)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/runner/runner.py", line 213, in run_node
    node = _run_node_sequential(node, catalog, run_id)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/runner/runner.py", line 249, in _run_node_sequential
    catalog.save(name, data)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/io/data_catalog.py", line 448, in save
    func(data)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/io/core.py", line 625, in save
    super().save(data)
  File "/Users/olszewk2/miniconda3/envs/pyzypad-example-env/lib/python3.7/site-packages/kedro/io/core.py", line 247, in save
    raise DataSetError(message) from exc
kedro.io.core.DataSetError: Failed while saving data to data set MlflowMlflowModelSaverDataSet(filepath=/Users/olszewk2/dev/pyzypad-example/data/06_models/pclass_encoder, flavor=mlflow.sklearn, load_args={}, save_args={}, version=Version(load=None, save='2020-11-06T12.28.57.593Z')).
unsupported operand type(s) for /: 'str' and 'str'

Your Environment

Include as many relevant details about the environment in which you experienced the bug:

  • kedro 0.16.6
  • kedro-mlflow 0.4.0
  • Python 3.7.7
  • MacOS Catalina

Does the bug also happen with the last version on develop?

Yes.

@turn1a turn1a added the bug Something isn't working label Nov 6, 2020
@turn1a turn1a self-assigned this Nov 6, 2020
@turn1a turn1a added this to To do in Ongoing development via automation Nov 6, 2020
turn1a pushed a commit that referenced this issue Nov 6, 2020
@Galileo-Galilei Galileo-Galilei moved this from To do to Planned for next release in Ongoing development Nov 9, 2020
@Galileo-Galilei Galileo-Galilei moved this from Planned for next release to In progress in Ongoing development Nov 9, 2020
@Galileo-Galilei Galileo-Galilei moved this from In progress to Pending review in Ongoing development Nov 9, 2020
turn1a pushed a commit that referenced this issue Nov 13, 2020
Galileo-Galilei pushed a commit that referenced this issue Nov 18, 2020
…tDataSet by turning filepath argument to a pathlib object instead of string
Ongoing development automation moved this from Pending review to Done Nov 18, 2020
Galileo-Galilei pushed a commit that referenced this issue Nov 18, 2020
…tDataSet by turning filepath argument to a pathlib object instead of string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
1 participant