Introduce consistent handling of warm_up
for components
#8823
Labels
P2
Medium priority, add to the next sprint if no P1 available
topic:core
type:refactor
Not necessarily visible to the users
This issue was brought up by @davidsbatista during the review of
We defer time-consuming or resource expensive operations when initializing components so that loading of a pipeline to validate it is a fast and lightweight operation.
Instead of performing expensive operations in a component's
__init__
-method, we advise to move them to awarm_up
-method. Thewarm_up
-method should only be called when the intention is to actually run a component.We also advise that components should only perform an expensive
warm_up
once.For example, our embedders and rankers only load and initialize their model when it wasn't loaded and initialized before.
In the
run
-method of ourPipeline
, we callwarm_up
on each component, to make sure that we don't run any components that haven't been warmed up.However, if a component doesn't respect our guideline of checking if it has been warmed up before, this might cause slow operations to run on every invocation of the pipeline's run-method.
We should agree on an approach to make sure that this doesn't happen.
The text was updated successfully, but these errors were encountered: