Skip to content

Commit 661fb55

Browse files
authored
routes: Fix version and hardware metadata routes (livepeer#896)
* base/pipeline: Add name property to pipelines * routes: Use pipeline for default pipeline/model_id * Update docs * Fix openapi spec
1 parent f1c8c89 commit 661fb55

17 files changed

+44
-12
lines changed

docs/custom-pipeline.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ Batch pipelines extend a different base class:
421421
from runner.pipelines.base import Pipeline
422422

423423
class MyBatchPipeline(Pipeline):
424+
name: str = "my-batch-pipeline"
425+
424426
def __init__(self, model_id: str, model_dir: str = "/models"):
425427
self.model_id = model_id
426428
self.model_dir = model_dir

runner/gateway.openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ openapi: 3.1.0
33
info:
44
title: Livepeer AI Runner
55
description: An application to run AI pipelines
6-
version: 0.13.11
6+
version: 0.14.0
77
servers:
88
- url: https://dream-gateway.livepeer.cloud
99
description: Livepeer Cloud Community Gateway

runner/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ openapi: 3.1.0
33
info:
44
title: Livepeer AI Runner
55
description: An application to run AI pipelines
6-
version: 0.13.11
6+
version: 0.14.0
77
servers:
88
- url: https://dream-gateway.livepeer.cloud
99
description: Livepeer Cloud Community Gateway

runner/src/runner/pipelines/audio_to_text.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class ModelConfig:
5959

6060

6161
class AudioToTextPipeline(Pipeline):
62+
name: str = "audio-to-text"
63+
6264
def __init__(self, model_id: str):
6365
self.model_id = model_id
6466
kwargs = {}

runner/src/runner/pipelines/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ class Version(BaseModel):
1515
version: str = Field(..., description="The version of the Runner")
1616

1717
class Pipeline(ABC):
18+
@property
19+
@abstractmethod
20+
def name(self) -> str:
21+
"""The pipeline name used for routing (e.g. 'text-to-image', 'live-video-to-video', etc)."""
22+
...
23+
1824
@abstractmethod
1925
def __init__(self, model_id: str, model_dir: str):
2026
self.model_id: str # declare the field here so the type hint is available when using this abstract class

runner/src/runner/pipelines/frame_interpolation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33

44
class FrameInterpolationPipeline(Pipeline):
5-
pass
5+
name: str = "frame-interpolation"
6+
# TODO: Not implemented

runner/src/runner/pipelines/image_to_image.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def list(cls):
4646

4747

4848
class ImageToImagePipeline(Pipeline):
49+
name: str = "image-to-image"
50+
4951
def __init__(self, model_id: str):
5052
self.model_id = model_id
5153
kwargs = {"cache_dir": get_model_dir()}

runner/src/runner/pipelines/image_to_text.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515

1616
class ImageToTextPipeline(Pipeline):
17+
name: str = "image-to-text"
18+
1719
def __init__(self, model_id: str):
1820
self.model_id = model_id
1921
kwargs = {}

runner/src/runner/pipelines/image_to_video.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222

2323
class ImageToVideoPipeline(Pipeline):
24+
name: str = "image-to-video"
25+
2426
def __init__(self, model_id: str):
2527
self.model_id = model_id
2628
kwargs = {"cache_dir": get_model_dir()}

runner/src/runner/pipelines/live_video_to_video.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
proc_status_important_fields = ["State", "VmRSS", "VmSize", "Threads", "voluntary_ctxt_switches", "nonvoluntary_ctxt_switches", "CoreDumping"]
2020

2121
class LiveVideoToVideoPipeline(Pipeline):
22+
name: str = "live-video-to-video"
23+
2224
def __init__(self, pipeline_spec: PipelineSpec):
2325
self.version = os.getenv("VERSION", "undefined")
2426
self.model_id = pipeline_spec.name # we set the parent class model_id to the pipeline name for compatibility

0 commit comments

Comments
 (0)