-
Notifications
You must be signed in to change notification settings - Fork 442
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
Lazy loading improvements #3140
base: develop
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
@@ -208,6 +208,9 @@ def _inner(*args: Any, **kwargs: Any) -> Any: | |||
with contextlib.suppress(ValueError): | |||
kwargs[k] = ClientLazyLoader(**v).evaluate() | |||
|
|||
# Why do we check for `isinstance(v, ClientLazyLoader)` for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works as expected and evaluates at runtime because intermediate
it passed as an arg:
@pipeline(enable_cache=False, model=Model(name=MODEL_NAME))
def test_pipeline():
intermediate = Client().get_model(MODEL_NAME).latest_version_id
cll = (
Client()
.get_model_version(
MODEL_NAME, intermediate
)
.get_artifact(ARTIFACT_NAME)
)
If we pass it as a keyword argument instead, the intermediate
lazy loader already gets evaluated at pipeline compilation time
@pipeline(enable_cache=False, model=Model(name=MODEL_NAME))
def test_pipeline():
intermediate = Client().get_model(MODEL_NAME).latest_version_id
cll = (
Client()
.get_model_version(
MODEL_NAME, model_version_name_or_number_or_id=intermediate
)
.get_artifact(ARTIFACT_NAME)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avishniakov I tried to understand the reason for the evaluate_all_lazy_load_args_in_client_methods
decorator, and the only thing I could come up with were these nested lazy loaders. Then I ran into this issue with the args/kwargs and was wondering what the expected behaviour would be in your opinion
Describe changes
This is still a draft which contains some questions that need to be answered first before any improvements can be implemented.
Current improvement ideas:
__getattr__
and__call__
has some nasty interactions with pydantic methods, which have previously caused some bugslazy: bool = False
argument on the client methods that support it). Right now it is very intransparent what's happening.LazyModel
class that gets returned byPipelineContext.model
?Pre-requisites
Please ensure you have done the following:
develop
and the open PR is targetingdevelop
. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes