Reputation: 3334
I have a Vertex AI pipeline that uses a Python component.
@component(
base_image="python:3.9",
packages_to_install=[lots!],
)
def my_comp(
parms
) -> str:
from google.cloud import aiplatform
aiplatform.init(project=project, location=location)
bill=x.y()
and in x.py:
class y:
How do I use x.y in the component? I have tried importing into the component and the jupyter notebook that creates the whole pipeline but the component doesn't see it.
I have tried from x import y
and also import x
. x.py is in the same folder as the jupyter notebook.
Upvotes: 1
Views: 828
Reputation: 391
You can't just load a class from a local file.
Each component runs a standalone container (defined in the @component
decorator) that does not have access to your local machine or anything outside itself.
If you need a library that you cannot just pip install
and make use of the packages_to_install
input, your best solution is probably to create a custom container that includes it, and update the base_image
keyword input.
Upvotes: 0