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

Fixes #5582 #5657

Merged
merged 2 commits into from
Apr 12, 2022
Merged

Fixes #5582 #5657

merged 2 commits into from
Apr 12, 2022

Conversation

kyle-jarvis
Copy link
Contributor

@kyle-jarvis kyle-jarvis commented Apr 11, 2022

Signed-off-by: Kyle Jarvis kyle.jarvis1905@gmail.com

What changes are proposed in this pull request?

The PR pertains to issue #5582 . It proposes to include a sub-directory to index artifacts as they are downloaded when saving an mlflow.pyfunc.PythonModel. This helps to avoid cases where artifacts may overwrite one-another due to common relative paths from distinct base uris, resulting in possibly unexpected behaviour.

How is this patch tested?

A new test has been introduced to illustrate the problem that this patch addresses:

test_model_export_with_class_and_artifacts.py::test_multiple_artifacts_with_common_sub_paths_resolve_correctly_when_saving_model

Does this PR change the documentation?

  • No. You can skip the rest of this section.
  • Yes. Make sure the changed pages / sections render correctly by following the steps below.
  1. Check the status of the ci/circleci: build_doc check. If it's successful, proceed to the
    next step, otherwise fix it.
  2. Click Details on the right to open the job page of CircleCI.
  3. Click the Artifacts tab.
  4. Click docs/build/html/index.html.
  5. Find the changed pages / sections and make sure they render correctly.

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

(Details in 1-2 sentences. You can just refer to another PR with a description if this PR is part of a larger change.)

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages
  • area/examples: Example code
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/projects: MLproject format, project running backends
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/server-infra: MLflow Tracking server backend
  • area/tracking: Tracking Service, tracking client APIs, autologging

Interface

  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
  • area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • area/windows: Windows support

Language

  • language/r: R APIs and clients
  • language/java: Java APIs and clients
  • language/new: Proposals for new client languages

Integrations

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations

How should the PR be classified in the release notes? Choose one:

  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Signed-off-by: Kyle Jarvis <kyle.jarvis1905@gmail.com>
@github-actions github-actions bot added area/models MLmodel format, model serialization/deserialization, flavors rn/none List under Small Changes in Changelogs. labels Apr 11, 2022
mlflow/pyfunc/model.py Outdated Show resolved Hide resolved
@harupy
Copy link
Member

harupy commented Apr 11, 2022

@kyle-jarvis Thanks for the PR, left a few comments!

Signed-off-by: Kyle Jarvis <kyle.jarvis1905@gmail.com>
@kyle-jarvis
Copy link
Contributor Author

@harupy Thanks for tidying that up, incorporated your suggestions!

@kyle-jarvis kyle-jarvis requested a review from harupy April 11, 2022 13:03
Copy link
Member

@harupy harupy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@harupy harupy merged commit 10523e8 into mlflow:master Apr 12, 2022
BenWilson2 pushed a commit that referenced this pull request Apr 13, 2022
* Fixes #5582

Signed-off-by: Kyle Jarvis <kyle.jarvis1905@gmail.com>

* Fixes #5582: Incorporate suggestions

Signed-off-by: Kyle Jarvis <kyle.jarvis1905@gmail.com>
@vilmar-hillow
Copy link

This seems to be a minor breaking change for us. Is there a more elegant way to handle it?
We are downloading specific artifacts from the run, for example a Pipfile to initialize an environment. Previously we would reference it via something like mlflow artifacts download --artifact-uri=${MODEL_URI}/artifacts/Pipfile. Now we have to make sure we are referencing the correct subdirectory, i.e. artifacts/0/Pipfile. It seems possible by ensuring the order of artifact mapping passed to save_model(), but seems kind of unintuitive and prone to introducing errors in the future.

@MajerMartin
Copy link

MajerMartin commented Apr 28, 2022

Hi, this is a breaking change for us as well.

We sometimes use “multi-models”, which are basically models that encapsulates different weights for different use-cases but under single common interface. Imagine sentiment analysis model for different languages - all languages share the same code but use different weights.

The weights used to be stored in separate subdirectories as follows:

artifacts/
  en/
    weights.pt
  cs/
    weights.pt
  …      

This allowed us to simply download only the weights we need and run the model for english only. Or for english and czech at the same time. Or for all languages. All of this with just one model in registry and correctly downloaded weights.

Now the subdirectories are prefixed with index:

artifacts/
  0/
    en/
      weights.pt
  1/
    cs/
      weights.pt
  …    

so I have to agree with @vilmar-hillow that this change makes it unintuitive and more difficult to work with. I do not know internals of MLflow that well, but could we consider different way how the handle the original issue?

Furthermore, I do not think that such changes should be under patch release. It is presented as a bug fix, but it only fixes behavior for one particular use-case and as you can see, it actually is a breaking change.

kyle-jarvis added a commit to kyle-jarvis/mlflow that referenced this pull request May 18, 2022
PR mlflow#5657 was original made to fix mlflow#5582. However, based on the
community feedback / discussion mlflow#5657 has caused more problems
then it solved, so a different solution seems preferable.

Signed-off-by: Kyle Jarvis <kyle.jarvis1905@gmail.com>
@kyle-jarvis kyle-jarvis mentioned this pull request May 18, 2022
29 tasks
@kyle-jarvis
Copy link
Contributor Author

@vilmar-hillow @MajerMartin Sorry about that! Interesting to see how you folks are working with these kinds of things. I have raised #5891 to revert these changes and will look back at the original issue my use case was experiencing with the points you raised in mind.
@harupy thanks for your original input on this.

@MajerMartin
Copy link

Hi @kyle-jarvis, thank you for your response and for taking an initiative to fix this. I really appreciate it and hope someone suggests another way to make your use-case work too.

dbczumar pushed a commit that referenced this pull request May 19, 2022
PR #5657 was original made to fix #5582. However, based on the
community feedback / discussion #5657 has caused more problems
then it solved, so a different solution seems preferable.

Signed-off-by: Kyle Jarvis <kyle.jarvis1905@gmail.com>
dbczumar pushed a commit that referenced this pull request May 26, 2022
PR #5657 was original made to fix #5582. However, based on the
community feedback / discussion #5657 has caused more problems
then it solved, so a different solution seems preferable.

Signed-off-by: Kyle Jarvis <kyle.jarvis1905@gmail.com>
postrational pushed a commit to postrational/mlflow that referenced this pull request Jul 27, 2022
PR mlflow#5657 was original made to fix mlflow#5582. However, based on the
community feedback / discussion mlflow#5657 has caused more problems
then it solved, so a different solution seems preferable.

Signed-off-by: Kyle Jarvis <kyle.jarvis1905@gmail.com>
Signed-off-by: Michal Karzynski <michal.karzynski@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/models MLmodel format, model serialization/deserialization, flavors rn/none List under Small Changes in Changelogs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants