singlepipe 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. singlepipe/__init__.py +8 -0
  2. singlepipe/adapters/__init__.py +0 -0
  3. singlepipe/adapters/hf_adapter.py +119 -0
  4. singlepipe/model_types/__init__.py +3 -0
  5. singlepipe/model_types/types.py +79 -0
  6. singlepipe/schemas/__init__.py +25 -0
  7. singlepipe/schemas/audio_schemas/__init__.py +0 -0
  8. singlepipe/schemas/audio_schemas/audio_classification.py +40 -0
  9. singlepipe/schemas/audio_schemas/speech_to_text.py +40 -0
  10. singlepipe/schemas/audio_schemas/text_to_audio.py +40 -0
  11. singlepipe/schemas/audio_schemas/zero_shot_audio_classification.py +40 -0
  12. singlepipe/schemas/image_schemas/__init__.py +0 -0
  13. singlepipe/schemas/image_schemas/depth_estimation.py +40 -0
  14. singlepipe/schemas/image_schemas/image_classification.py +40 -0
  15. singlepipe/schemas/image_schemas/image_embedding.py +40 -0
  16. singlepipe/schemas/image_schemas/image_segmentation.py +40 -0
  17. singlepipe/schemas/image_schemas/keypoint_matching.py +40 -0
  18. singlepipe/schemas/image_schemas/mask_generation.py +40 -0
  19. singlepipe/schemas/image_schemas/object_detection.py +290 -0
  20. singlepipe/schemas/image_schemas/zero_shot_image_classification.py +40 -0
  21. singlepipe/schemas/image_schemas/zero_shot_object_detection.py +40 -0
  22. singlepipe/schemas/multimodal_schemas/__init__.py +0 -0
  23. singlepipe/schemas/multimodal_schemas/document_question_answering.py +40 -0
  24. singlepipe/schemas/multimodal_schemas/image_text_to_text.py +40 -0
  25. singlepipe/schemas/multimodal_schemas/table_question_answering.py +40 -0
  26. singlepipe/schemas/ocr_schemas/__init__.py +0 -0
  27. singlepipe/schemas/ocr_schemas/ocr.py +40 -0
  28. singlepipe/schemas/registry.py +97 -0
  29. singlepipe/schemas/table_schemas/__init__.py +0 -0
  30. singlepipe/schemas/table_schemas/tabular_classification.py +40 -0
  31. singlepipe/schemas/table_schemas/tabular_regression.py +40 -0
  32. singlepipe/schemas/text_schemas/__init__.py +0 -0
  33. singlepipe/schemas/text_schemas/fill_mask.py +40 -0
  34. singlepipe/schemas/text_schemas/question_answering.py +40 -0
  35. singlepipe/schemas/text_schemas/summarization.py +40 -0
  36. singlepipe/schemas/text_schemas/text2text_generation.py +40 -0
  37. singlepipe/schemas/text_schemas/text_classification.py +40 -0
  38. singlepipe/schemas/text_schemas/text_embedding.py +40 -0
  39. singlepipe/schemas/text_schemas/text_generation.py +40 -0
  40. singlepipe/schemas/text_schemas/token_classification.py +40 -0
  41. singlepipe/schemas/text_schemas/translation.py +40 -0
  42. singlepipe/schemas/text_schemas/zero_shot_text_classification.py +40 -0
  43. singlepipe/schemas/video_schemas/__init__.py +0 -0
  44. singlepipe/schemas/video_schemas/video_classification.py +40 -0
  45. singlepipe-0.0.1.dist-info/METADATA +135 -0
  46. singlepipe-0.0.1.dist-info/RECORD +49 -0
  47. singlepipe-0.0.1.dist-info/WHEEL +5 -0
  48. singlepipe-0.0.1.dist-info/licenses/LICENSE +21 -0
  49. singlepipe-0.0.1.dist-info/top_level.txt +1 -0
singlepipe/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """SinglePipe: typed multi-model inference orchestrator."""
2
+
3
+ from singlepipe.adapters.hf_adapter import HFAdapter
4
+ from singlepipe.model_types import TaskType
5
+
6
+ __version__ = "0.0.1"
7
+
8
+ __all__ = ["HFAdapter", "TaskType"]
File without changes
@@ -0,0 +1,119 @@
1
+ from typing import TYPE_CHECKING, Any
2
+
3
+ from transformers import pipeline as hf_pipeline
4
+
5
+ from singlepipe.model_types import TaskType
6
+ from singlepipe.schemas import get_schemas
7
+
8
+ if TYPE_CHECKING:
9
+ pass
10
+
11
+
12
+ class HFAdapter:
13
+ """Typed adapter around ``transformers.pipeline`` for a specific task.
14
+
15
+ Wraps a HuggingFace pipeline with SinglePipe's input/output schemas:
16
+ the raw input is validated and normalized into the schema's canonical
17
+ form, the pipeline is invoked, and its raw output is validated and
18
+ materialized as a typed SinglePipe output object.
19
+
20
+ The heavy work (loading the model, tokenizer/processor, and running
21
+ pre- and post-processing) is delegated to ``transformers.pipeline``.
22
+ This class only enforces the typed boundary on both sides.
23
+
24
+ Parameters
25
+ ----------
26
+ model_name:
27
+ HuggingFace model id (e.g. ``"facebook/detr-resnet-50"``) or a
28
+ local path to model weights.
29
+ task:
30
+ SinglePipe task identifier. Its ``.value`` must match a valid
31
+ ``transformers.pipeline`` task string (e.g. ``"object-detection"``).
32
+ Determines which input/output schemas are pulled from the registry.
33
+ device:
34
+ Device to place the model on. ``None`` = CPU, an ``int`` = CUDA
35
+ device index, or a device string such as ``"cpu"`` or ``"cuda:0"``.
36
+ **pipeline_kwargs:
37
+ Extra keyword arguments passed straight to ``transformers.pipeline``
38
+ (e.g. ``torch_dtype``, ``trust_remote_code``, ``revision``).
39
+
40
+ Attributes
41
+ ----------
42
+ model_name : str
43
+ The model id or path this adapter was constructed with.
44
+ task : TaskType
45
+ The task this adapter is bound to.
46
+ pipeline : transformers.Pipeline
47
+ The underlying HuggingFace pipeline instance.
48
+
49
+ Examples
50
+ --------
51
+ >>> adapter = HFAdapter("facebook/detr-resnet-50", TaskType.OBJECT_DETECTION)
52
+ >>> result = adapter("http://images.cocodataset.org/val2017/000000039769.jpg")
53
+ >>> for det in result:
54
+ ... print(det.label, det.score, det.box.as_tuple())
55
+
56
+ Notes
57
+ -----
58
+ - The model is loaded once at construction; subsequent calls reuse it.
59
+ - Batching, streaming, and async execution are not supported at this
60
+ layer — one input, one output per call.
61
+ - Task↔model compatibility is not pre-validated: mismatches surface as
62
+ errors from ``transformers.pipeline`` at construction time.
63
+ """
64
+
65
+
66
+
67
+
68
+ def __init__(
69
+ self,
70
+ model_name: str,
71
+ task: TaskType,
72
+ device: int | str | None = None,
73
+ **pipeline_kwargs: Any,
74
+ ) -> None:
75
+ self.model_name = model_name
76
+ self.task = task
77
+
78
+ self.pipeline = hf_pipeline(
79
+ task=task.value, # type: ignore[arg-type]
80
+ model=model_name,
81
+ device=device, # type: ignore[arg-type]
82
+ **pipeline_kwargs,
83
+ )
84
+
85
+ self._input_schema, self._output_schema = get_schemas(task)
86
+
87
+
88
+
89
+
90
+
91
+ def __call__(self, raw_input):
92
+
93
+ if isinstance(raw_input, self._input_schema):
94
+ validated_in = raw_input
95
+ elif isinstance(raw_input, dict):
96
+ validated_in = self._input_schema.model_validate(raw_input)
97
+ else:
98
+ validated_in = self._input_schema.from_raw(raw_input)
99
+
100
+
101
+ raw_output = self.pipeline(validated_in.to_pipeline_input())
102
+
103
+ return self._output_schema.from_pipeline_output(
104
+ raw_output,
105
+ **validated_in.output_context
106
+ )
107
+
108
+ def __repr__(self) -> str:
109
+ return f"HFAdapter(model={self.model_name!r}, task={self.task.value!r})"
110
+
111
+
112
+ if __name__ == "__main__":
113
+ adapter = HFAdapter("facebook/detr-resnet-50", TaskType.OBJECT_DETECTION)
114
+ print(adapter)
115
+
116
+ result = adapter("http://images.cocodataset.org/val2017/000000039769.jpg")
117
+ print(f"Found {len(result)} objects")
118
+ for det in result:
119
+ print(f" {det.label}: {det.score:.3f}")
@@ -0,0 +1,3 @@
1
+ from .types import TaskType
2
+
3
+ __all__ = ["TaskType"]
@@ -0,0 +1,79 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class TaskType(StrEnum):
5
+ """Semantic identifier of an ML task in SinglePipe.
6
+
7
+ ``TaskType`` is the vocabulary the schema registry keys on:
8
+ each member corresponds to a pair of input/output schemas
9
+ describing the contract of that task.
10
+
11
+ Enum values are intentionally aligned with HuggingFace
12
+ ``transformers.pipeline`` task strings whenever a matching HF
13
+ pipeline exists — this lets ``HFAdapter`` pass the value straight
14
+ through without a lookup table. Tasks with no HF equivalent
15
+ (``TABULAR_CLASSIFICATION``, ``TABULAR_REGRESSION``, ``OCR``)
16
+ keep values chosen for readability; they are served by other
17
+ adapters.
18
+
19
+ Because ``TaskType`` inherits from ``StrEnum``, members compare
20
+ equal to their string values and can be used interchangeably
21
+ with strings — in dict keys, HF pipeline arguments, JSON, etc.
22
+
23
+ The enum grows as new tasks gain first-class support. A member
24
+ listed here is *known* to SinglePipe; whether schemas are actually
25
+ registered for it is a separate question answered by the registry
26
+ (``get_schemas`` raises a descriptive error for known-but-
27
+ unregistered tasks).
28
+
29
+ Examples
30
+ --------
31
+ >>> TaskType.OBJECT_DETECTION == "object-detection"
32
+ True
33
+ >>> TaskType.OBJECT_DETECTION.value
34
+ 'object-detection'
35
+ """
36
+
37
+ # Image
38
+ IMAGE_CLASSIFICATION = "image-classification"
39
+ IMAGE_SEGMENTATION = "image-segmentation"
40
+ OBJECT_DETECTION = "object-detection"
41
+ DEPTH_ESTIMATION = "depth-estimation"
42
+ IMAGE_EMBEDDING = "image-feature-extraction"
43
+ ZERO_SHOT_IMAGE_CLASSIFICATION = "zero-shot-image-classification"
44
+ ZERO_SHOT_OBJECT_DETECTION = "zero-shot-object-detection"
45
+ MASK_GENERATION = "mask-generation"
46
+ KEYPOINT_MATCHING = "keypoint-matching"
47
+
48
+ # Text
49
+ TEXT_CLASSIFICATION = "text-classification"
50
+ TOKEN_CLASSIFICATION = "token-classification"
51
+ TEXT_GENERATION = "text-generation"
52
+ TEXT2TEXT_GENERATION = "text2text-generation"
53
+ FILL_MASK = "fill-mask"
54
+ SUMMARIZATION = "summarization"
55
+ TRANSLATION = "translation"
56
+ QUESTION_ANSWERING = "question-answering"
57
+ TEXT_EMBEDDING = "feature-extraction"
58
+ ZERO_SHOT_TEXT_CLASSIFICATION = "zero-shot-classification"
59
+
60
+ # Audio
61
+ AUDIO_CLASSIFICATION = "audio-classification"
62
+ SPEECH_TO_TEXT = "automatic-speech-recognition"
63
+ TEXT_TO_AUDIO = "text-to-audio"
64
+ ZERO_SHOT_AUDIO_CLASSIFICATION = "zero-shot-audio-classification"
65
+
66
+ # Vidio
67
+ VIDEO_CLASSIFICATION = "video-classification"
68
+
69
+ # Multimodel
70
+ IMAGE_TEXT_TO_TEXT = "image-text-to-text"
71
+ DOCUMENT_QUESTION_ANSWERING = "document-question-answering"
72
+ TABLE_QUESTION_ANSWERING = "table-question-answering"
73
+
74
+ # Table
75
+ TABULAR_CLASSIFICATION = "tabular-classification"
76
+ TABULAR_REGRESSION = "tabular-regression"
77
+
78
+ # OCR
79
+ OCR = "ocr"
@@ -0,0 +1,25 @@
1
+ from singlepipe.model_types import TaskType
2
+
3
+ from .image_schemas.object_detection import (
4
+ BBox,
5
+ Detection,
6
+ ObjectDetectionInput,
7
+ ObjectDetectionOutput,
8
+ )
9
+ from .registry import InputOutputSchema, get_schemas, register
10
+
11
+ register(
12
+ TaskType.OBJECT_DETECTION,
13
+ ObjectDetectionInput,
14
+ ObjectDetectionOutput,
15
+ )
16
+
17
+ __all__ = [
18
+ "BBox",
19
+ "Detection",
20
+ "InputOutputSchema",
21
+ "ObjectDetectionInput",
22
+ "ObjectDetectionOutput",
23
+ "get_schemas",
24
+ "register",
25
+ ]
File without changes
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.AUDIO_CLASSIFICATION.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class AudioClassificationInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "AudioClassificationInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "AudioClassificationInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class AudioClassificationOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "AudioClassificationOutput is not implemented yet."
40
+ )
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.SPEECH_TO_TEXT.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class SpeechToTextInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "SpeechToTextInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "SpeechToTextInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class SpeechToTextOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "SpeechToTextOutput is not implemented yet."
40
+ )
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.TEXT_TO_AUDIO.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class TextToAudioInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "TextToAudioInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "TextToAudioInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class TextToAudioOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "TextToAudioOutput is not implemented yet."
40
+ )
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.ZERO_SHOT_AUDIO_CLASSIFICATION.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class ZeroShotAudioClassificationInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "ZeroShotAudioClassificationInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "ZeroShotAudioClassificationInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class ZeroShotAudioClassificationOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "ZeroShotAudioClassificationOutput is not implemented yet."
40
+ )
File without changes
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.DEPTH_ESTIMATION.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class DepthEstimationInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "DepthEstimationInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "DepthEstimationInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class DepthEstimationOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "DepthEstimationOutput is not implemented yet."
40
+ )
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.IMAGE_CLASSIFICATION.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class ImageClassificationInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "ImageClassificationInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "ImageClassificationInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class ImageClassificationOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "ImageClassificationOutput is not implemented yet."
40
+ )
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.IMAGE_EMBEDDING.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class ImageEmbeddingInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "ImageEmbeddingInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "ImageEmbeddingInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class ImageEmbeddingOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "ImageEmbeddingOutput is not implemented yet."
40
+ )
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.IMAGE_SEGMENTATION.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class ImageSegmentationInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "ImageSegmentationInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "ImageSegmentationInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class ImageSegmentationOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "ImageSegmentationOutput is not implemented yet."
40
+ )
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.KEYPOINT_MATCHING.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class KeypointMatchingInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "KeypointMatchingInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "KeypointMatchingInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class KeypointMatchingOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "KeypointMatchingOutput is not implemented yet."
40
+ )
@@ -0,0 +1,40 @@
1
+ """Placeholder schemas for TaskType.MASK_GENERATION.
2
+
3
+ Not yet implemented. Exists to unlock ``HFAdapter`` type overloads.
4
+ Replace with real schemas when this task gains first-class support.
5
+ """
6
+
7
+ from typing import Any, Self
8
+
9
+ from pydantic import BaseModel, ConfigDict
10
+
11
+
12
+ class MaskGenerationInput(BaseModel):
13
+ """Placeholder input schema. Fields TBD."""
14
+
15
+ model_config = ConfigDict(arbitrary_types_allowed=True)
16
+
17
+ @classmethod
18
+ def from_raw(cls, raw: Any) -> Self:
19
+ raise NotImplementedError(
20
+ "MaskGenerationInput is not implemented yet."
21
+ )
22
+
23
+ def to_pipeline_input(self) -> Any:
24
+ raise NotImplementedError(
25
+ "MaskGenerationInput is not implemented yet."
26
+ )
27
+
28
+ @property
29
+ def output_context(self) -> dict[str, Any]:
30
+ return {}
31
+
32
+
33
+ class MaskGenerationOutput(BaseModel):
34
+ """Placeholder output schema. Fields TBD."""
35
+
36
+ @classmethod
37
+ def from_pipeline_output(cls, raw_output: Any, **context: Any) -> Self:
38
+ raise NotImplementedError(
39
+ "MaskGenerationOutput is not implemented yet."
40
+ )