-
Notifications
You must be signed in to change notification settings - Fork 919
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
Runtime Parameters in Kedro Not Working as Expected #4437
Comments
I think, but we should confirm with @ankatiyar (If I remember correctly she was the one who implemented I also tag @astrojuanlu as I think this is part of another discussion about unifying globals /runtime / "normal" parameters and clarifying what is allowed or not (preferably before 0.20 😉) |
Hi, sorry I missed the tag earlier. So the I've tried to reproduce the error with the information mentioned above and the runtime parameters work for me as expected. Have you been able to resolve this issue in the mean time @fpiedrah? I would like to see the full stacktrace if it's possible otherwise? |
Sorry for the delay—I went on a bit of a deep dive trying to track down the source of this weird behavior, and it took longer than expected. @ankatiyar, you’re absolutely right. If I start with an empty project and use the same example I provided, everything works as expected. However, the issue arises when I try to load parameters from code as described in the documentation. Here’s how I’m loading the parameters: First, I add the following to import os
CODE_SOURCE = os.path.dirname(os.path.abspath(__file__))
PROJECT_SOURCE = os.path.join(CODE_SOURCE, "../../")
BASE_ENVIRONMENT = "base"
__version__ = "0.1" Then, in one of my pipelines, I load the parameters like this: import os
from kedro.config import OmegaConfigLoader
from kedro.framework.project import settings
from kedro.pipeline import Pipeline, pipeline
from instructple import BASE_ENVIRONMENT, PROJECT_SOURCE
from .nodes import ...
base_pipeline = pipeline(
[...]
)
def build_pipeline(model_parameters: dict) -> Pipeline:
return pipeline(
[base_pipeline],
namespace="pipeline",
inputs={...},
outputs={...},
parameters={...},
)
def create_pipeline(**kwargs) -> Pipeline:
configuration = OmegaConfigLoader(
base_env=BASE_ENVIRONMENT,
conf_source=os.path.join(PROJECT_SOURCE, settings.CONF_SOURCE),
)["parameters"]
model_parameters = configuration["model"]
return build_pipeline(model_parameters) The problem happens when I use OmegaConfigLoader this way—I start getting the error:
If I remove the code-based parameter loading, everything works fine. Any ideas on what might be going wrong? |
Hey @fpiedrah, thanks for getting back on this! Is there a reason you need to load the parameters yourself in your If you specify |
I see, that makes sense. My goal is to add new LLMs into my pipelines seamlessly without needing to explicitly add them to the catalog. To achieve this, I dynamically create the pipeline using a dataset factory for the LLMs. Here’s my current approach: base_pipeline = pipeline(
[
node(
func=to_zero_shot,
inputs=[
"tasks",
"tokenizer",
"params:to_zero_shot.use_chat_formatting",
"params:to_zero_shot.max_prompts",
"params:to_zero_shot.random_seed",
],
outputs="zero_shot",
),
...
]
)
def build_pipeline(model_parameters: dict) -> Pipeline:
return pipeline(
[base_pipeline],
namespace="prompting",
inputs={
"tasks": "tasks",
"tokenizer": f"{model_parameters['identifier']}#HFTokenizer",
},
outputs={...},
parameters={...},
)
def create_pipeline(**kwargs) -> Pipeline:
configuration = OmegaConfigLoader(
base_env=BASE_ENVIRONMENT,
conf_source=os.path.join(PROJECT_SOURCE, settings.CONF_SOURCE),
)["parameters"]
model_parameters = configuration["model"]
return build_pipeline(model_parameters) In the data catalog, I currently have: "{organization}/{model}#HFTokenizer":
type: instructple.datasets.HFTokenizer
model_identifier: "{organization}/{model}" I’m thinking that an alternative approach would be modifying this entry to: HFTokenizer:
type: instructple.datasets.HFTokenizer
model_identifier: "${runtime_params:model_identifier}, ${globals:model.identifier}}" This makes sense to me. However, I believe it would be helpful to include a warning in the documentation clarifying that |
Description
Runtime parameters in Kedro are not being recognized when passed via
--params
in the CLI.Context
I am trying to pass runtime parameters for
model_name
andmodel_identifier
, with default values specified in a global file. However, Kedro does not recognize the runtime parameters and always falls back to the global defaults. If only the runtime parameter is provided, Kedro returns an error.My
parameters.yml
file:When running:
I get the error:
This prevents overriding these values dynamically at runtime.
Steps to Reproduce
Define
parameters.yml
with runtime parameters:Run the pipeline with:
Get the following error:
Expected Result
Runtime parameters should be injected when passed via --params in the CLI.
Actual Result
Your Environment
I also made a change by commenting out parts of the
settings.py
file. While I don't believe this is related, I’m including mysettings.py
file:The text was updated successfully, but these errors were encountered: