acoustic-carpenter-78188
10/24/2023, 4:57 PMExtendedResources from the @task decorator or node .with_overrides(). Currently only supports the ability to specify the GPU accelerator to use for a specific task node. The following syntaxes are valid when specifying a task:
No preference of GPU accelerator to use:
@task(limits=Resources(gpu="1"))
def my_task() -> None:
...
Schedule on a specific GPU accelerator:
from flytekit.extras.accelerators import T4
@task(
limits=Resources(gpu="1"),
accelerator=T4,
)
def my_task() -> None:
...
Schedule on a Multi-instance GPU (MIG) accelerator with no preference of partition size:
from flytekit.extras.accelerators import A100
@task(
limits=Resources(gpu="1"),
accelerator=A100,
)
def my_task() -> None:
...
Schedule on a Multi-instance GPU (MIG) accelerator with a specific partition size:
from flytekit.extras.accelerators import A100
@task(
limits=Resources(gpu="1"),
accelerator=A100.partition_1g_5gb,
)
def my_task() -> None:
...
Schedule on an unpartitioned Multi-instance GPU (MIG) accelerator:
from flytekit.extras.accelerators import A100
@task(
limits=Resources(gpu="1"),
accelerator=A100.unpartitioned,
)
def my_task() -> None:
...
An override can also be specified for the GPU accelerator to use, as follows:
from flytekit.extra.accelerators import A100, T4
@task(
limits=Resources(gpu="1"),
accelerator=T4,
)
def my_task() -> str:
return "hello"
@workflow
def my_wf() -> str:
return my_task().with_overrides(
accelerator=A100.partition_1g_5gb
)
Tracking Issue
https://github.com/flyteorg/flyte/issues/
Follow-up issue
NA
OR
https://github.com/flyteorg/flyte/issues/
flyteorg/flytekit
✅ All checks have passed
30/30 successful checksacoustic-carpenter-78188
10/24/2023, 4:57 PMacoustic-carpenter-78188
11/01/2023, 4:17 AM