PERIAN agent example usage
Once you have a Union account, install union
:
pip install union
Export the following environment variable to build and push images to your own container registry:
# replace with your registry name
export IMAGE_SPEC_REGISTRY="<your-container-registry>"
Then run the following commands to run the workflow:
git clone https://github.com/unionai/unionai-examples
cd unionai-examples
union run --remote tutorials/sentiment_classifier/sentiment_classifier.py main --model distilbert-base-uncased
The source code for this tutorial can be found here {octicon}mark-github
.
from flytekit import ImageSpec, task, workflow
from flytekitplugins.perian_job import PerianConfig
image_spec = ImageSpec(
name="flyte-test",
registry="my-registry",
python_version="3.11",
apt_packages=["wget", "curl", "git"],
packages=[
"flytekitplugins-perian-job",
],
)
PerianConfig
configures PerianTask
. Tasks specified with PerianConfig
will be executed on PERIAN Job Platform.
@task(
container_image=image_spec,
task_config=PerianConfig(
accelerators=1,
accelerator_type="A100",
),
)
def perian_hello(name: str) -> str:
return f"hello {name}!"
@workflow
def my_wf(name: str = "world") -> str:
return perian_hello(name=name)