Skip to content

Conversation

avishniakov
Copy link
Contributor

Describe changes

I fixed the logic of reading artifacts from ZenML to achieve the following snippet to work as usual, without the need to activate the stack before that:

from zenml.client import Client

artifact = Client().get_artifact_version('some-uuid')
loaded_artifact = artifact.load()

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • If my change requires a change to docs, I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have based my new branch on develop and the open PR is targeting develop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.
  • If my changes require changes to the dashboard, these changes are communicated/requested.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

Copy link
Contributor

coderabbitai bot commented Mar 20, 2024

Important

Auto Review Skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@avishniakov avishniakov changed the base branch from main to develop March 20, 2024 09:41
@github-actions github-actions bot added internal To filter out internal PRs and issues bug Something isn't working labels Mar 20, 2024
Copy link
Contributor

Images automagically compressed by Calibre's image-actions

Compression reduced images by 46.9%, saving 248.77 KB.

Filename Before After Improvement Visual comparison
examples/llm_finetuning/.assets/model.png 530.17 KB 281.40 KB -46.9% View diff

234 images did not require optimisation.

Update required: Update image-actions configuration to the latest version before 1/1/21. See README for instructions.

…ing-to-activate-the-artifact-store' of https://github.com/zenml-io/zenml into bugfix/OSSK-490-allow-loading-of-artifacts-without-needing-to-activate-the-artifact-store
Copy link
Contributor

LLM Finetuning template updates in examples/llm_finetuning have been pushed.

…s-without-needing-to-activate-the-artifact-store
@avishniakov avishniakov requested a review from safoinme March 22, 2024 08:28
Copy link
Contributor

@schustmi schustmi left a comment

Choose a reason for hiding this comment

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

Haven't looked at it in detail yet, just a more general question: What's the technical reason why this is not possible with fileio anymore and we have to use the artifact store methods in the materializers?

@avishniakov
Copy link
Contributor Author

Haven't looked at it in detail yet, just a more general question: What's the technical reason why this is not possible with fileio anymore and we have to use the artifact store methods in the materializers?

There is one main reason behind it: fileio works smoothly (meaning in a protected fashion, according to previous PRs) for all FS types, except local, while local is used in many other places outside of materializers' story, so to keep writing of artifacts and logs in scope-aware mode without the need to care about the underlying FS - I moved them to go via Artifact Stores. This PR is not changing that (it was already done and released) it just adds the possibility to set an artifact store explicitly in the materializer class, so we can pull smoothly without the need to switch stacks.

@avishniakov avishniakov requested a review from schustmi March 22, 2024 12:40
@schustmi
Copy link
Contributor

schustmi commented Apr 2, 2024

I see, with that in mind the changes in this PR look good to me.
However I still don't really get why we made those changes to use the artifact stores in the first place, doesn't fileio contains some useful methods built on top of the artifact store interface (e.g. copying from one store to another) that are very useful inside the materializers?

@avishniakov
Copy link
Contributor Author

I see, with that in mind the changes in this PR look good to me. However I still don't really get why we made those changes to use the artifact stores in the first place, doesn't fileio contains some useful methods built on top of the artifact store interface (e.g. copying from one store to another) that are very useful inside the materializers?

This might be indeed the case, that usage of some fileio methods might come in handy on top of the artifact store methods, but the PR merged previously was aiming to close the gap with the usage of unsafe paths (e.g. outside of artifact store bounds) since it was reported as a bug.

I cannot think of a scenario, where a materializer has to work with some data from outside of the configured artifact store. My reasoning: materializer is used only in steps (using them directly is possible, but is not what is officially supported) and inside a step, we always have a stack set, so we never face multi-artifact store use-case, as of now. If going forward, we will support different artifact stores for different steps inside one pipeline, my assumption still stands, since in one step we only deal with one AS. Does it make any sense or I missed something important? @schustmi

@schustmi
Copy link
Contributor

schustmi commented Apr 2, 2024

The scenario I was thinking of was actually copying local directories <-> artifact store.

@avishniakov
Copy link
Contributor Author

The scenario I was thinking of was actually copying local directories <-> artifact store.

I see, so fileio.copy still covers this case, but the previous PR I mentioned is protecting a bit of our standard materialized from malicious use. I understand that cannot fully get rid of the cases when we go beyond artifact store bounds and this can be kept as is in other materialized with more complex logic.

I will merge this one now and we can create a follow-up for that if you find this needed.

What can be actually done for the use case you described is also achievable with the artifact store interface, but with a bit more sugar around:

with self.artifact_store.open("s3://some_path/05b56688-931a-44f8-8777-035b046e191f.log","rb") as src:
     with open("local-file.log","wb") as tgt:
         tgt.write(src.read())

@avishniakov avishniakov merged commit ebf041e into develop Apr 2, 2024
@avishniakov avishniakov deleted the bugfix/OSSK-490-allow-loading-of-artifacts-without-needing-to-activate-the-artifact-store branch April 2, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal To filter out internal PRs and issues run-slow-ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants