🍡Selecting Output Variables
When working with configuration functions, not all variables defined within them are needed for the final execution engine.
Consider this configuration function:
Along with this execution function:
This function only requires model
and config_dict
, but our configuration function creates additional variables like cache
, model_type
, and param
. Passing unnecessary variables could:
Cause function signature mismatches
Lead to memory inefficiency
Create potential naming conflicts
Variable Selection Methods
To ensure we pass only the required variables, we have two filtering approaches:
Include specific variables using
final_vars
:
Use final_vars
when you need only a few specific variables
When final_vars
is empty, all variables are returned (except those in exclude_vars
)
Exclude unwanted variables using
exclude_vars
:
Choose exclude_vars
when you have many variables to keep and little to filter out.
Last updated