acoustic-carpenter-78188
10/04/2023, 8:17 AMFROM python:3.9-slim-buster
USER root
WORKDIR /root
ENV PYTHONPATH /root
RUN apt-get update && apt-get install build-essential -y
RUN apt-get install git -y
# The following line is an example of how to install your modified plugins. In this case, it demonstrates how to install the 'deck' plugin.
# RUN pip install -U git+https://github.com/Yicheng-Lu-llll/flytekit.git@"demo#egg=flytekitplugins-deck-standard&subdirectory=plugins/flytekit-deck-standard" # replace with your own repo and branch
RUN pip install -U git+https://github.com/Future-Outlier/flytekit.git@98ddd542a02551a9a9eb122b98004d0d092abbe9#subdirectory=plugins/flytekit-kf-tensorflow
RUN pip install -U git+https://github.com/Future-Outlier/flyte.git@647b8f4eeeab1a65866d19fab13c416ed0e4a07f#subdirectory=flyteidl
RUN pip install -U git+https://github.com/Future-Outlier/flytekit.git@98ddd542a02551a9a9eb122b98004d0d092abbe9
Use the code below
from flytekit import ImageSpec, Resources, task
from flytekit.configuration import Image, ImageConfig, SerializationSettings
from flytekitplugins.kftensorflow import (PS, Chief, CleanPodPolicy, Evaluator,
RestartPolicy, RunPolicy, TfJob,
Worker)
task_config = TfJob(
worker=Worker(replicas=1),
chief=Chief(replicas=1),
ps=PS(replicas=1),
evaluator=Evaluator(replicas=1),
)
@task(
task_config=task_config,
cache=True,
requests=Resources(cpu="1"),
cache_version="1",
)
def my_tensorflow_task(x: int, y: str) -> int:
return x
if __name__ == "__main__":
print(my_tensorflow_task(x=10, y="hello"))
Run it to flyte-console by this command
pyflyte run --remote --image futureoutlier/kubeflow:tfoperator-v2 \
kubeflow_tf_evaluator.py my_tensorflow_task --x 100 --y acc
ImageSpec
from flytekit import ImageSpec, Resources, task
from flytekit.configuration import Image, ImageConfig, SerializationSettings
from flytekitplugins.kftensorflow import (PS, Chief, CleanPodPolicy, Evaluator,
RestartPolicy, RunPolicy, TfJob,
Worker)
kubeflow_plugin = "git+https://github.com/Future-Outlier/flytekit.git@98ddd542a02551a9a9eb122b98004d0d092abbe9#subdirectory=plugins/flytekit-kf-tensorflow"
kubeflow_idl = "git+https://github.com/Future-Outlier/flyte.git@e3d022ae86466632f0b8eeae80bc07441827e403#subdirectory=flyteidl"
flytekit = "git+https://github.com/Future-Outlier/flytekit.git@98ddd542a02551a9a9eb122b98004d0d092abbe9"
# base_image="futureoutlier/kubeflow:tfoperator-v2"
image_spec = ImageSpec(
packages=[flytekit, kubeflow_idl, kubeflow_plugin],
apt_packages=["git"],
registry="futureoutlier",
)
# build-essential git
task_config = TfJob(
worker=Worker(replicas=1),
chief=Chief(replicas=1),
ps=PS(replicas=1),
evaluator=Evaluator(replicas=1),
)
@task(
task_config=task_config,
cache=True,
requests=Resources(cpu="1"),
cache_version="1",
container_image=image_spec,
)
def my_tensorflow_task(x: int, y: str) -> int:
return x
if __name__ == "__main__":
print(my_tensorflow_task(x=10, y="hello"))
pyflyte run --remote kubeflow_tf_evaluator.py my_tensorflow_task --x 20231008 --y AMAZING
Screenshot
Dockerfile
image▾
image▾
image▾