Skip to content
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

Integrate argument inference #788

Merged
merged 5 commits into from
Jan 18, 2024
Merged

Conversation

RobbeSneyders
Copy link
Member

Follow-up to use the argument inference functionality added in #763

@@ -20,7 +20,7 @@ def __post_init__(self):
self.base_image = "fondant:latest"


class PythonComponent:
class PythonComponent(BaseComponent):
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed this to satisfy typing.

)

DockerCompiler().compile(pipeline)
Copy link
Member Author

Choose a reason for hiding this comment

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

This expands the coverage of this test by including the compilation without errors of lightweight components.

@@ -42,12 +42,12 @@ def wrapper(cls):

# updated=() is needed to prevent an attempt to update the class's __dict__
@wraps(cls, updated=())
class AppliedPythonComponent(cls, PythonComponent):
class PythonComponentOp(cls, PythonComponent):
Copy link
Member Author

Choose a reason for hiding this comment

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

The component is not applied yet at this point.

Base automatically changed from feature/python-in-docker to main January 17, 2024 10:35
Copy link
Contributor

@PhilippeMoussalli PhilippeMoussalli left a comment

Choose a reason for hiding this comment

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

Thanks Robbe!

return dataframe


_ = dataset.apply(
ref=CalculateChunkLength,
consumes={"text": pa.string()},
produces={"chunk_length": pa.int32()},
arguments={"feature_name": "chunk_length"},
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit confusing, can't we just keep it as it was before and pass a random string argument

@@ -222,6 +223,7 @@ def from_ref(cls, ref: t.Any, **kwargs) -> "ComponentOp":
description=description,
consumes={"additionalProperties": True},
produces={"additionalProperties": True},
args={k: v.to_spec() for k, v in infer_arguments(ref).items()},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
args={k: v.to_spec() for k, v in infer_arguments(ref).items()},
args={arg_name: arg.to_spec() for arg_name, arg in infer_arguments(ref).items()},

just for clarity

return dataframe


_ = dataset.apply(
ref=CalculateChunkLength,
consumes={"text": pa.string()},
produces={"chunk_length": pa.int32()},
arguments={"feature_name": "chunk_length"},
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: looks on a first view a bit confusing. Could we pass an dummy argument which is not used and keep dataframe["chunk_length"]?

Copy link
Contributor

Choose a reason for hiding this comment

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

great minds think alike

Copy link
Collaborator

@GeorgesLorre GeorgesLorre left a comment

Choose a reason for hiding this comment

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

no comment only approve

@RobbeSneyders RobbeSneyders merged commit 71a8f72 into main Jan 18, 2024
9 checks passed
@RobbeSneyders RobbeSneyders deleted the feature/integrate-arg-inference branch January 18, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants