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.
- singlepipe/__init__.py +8 -0
- singlepipe/adapters/__init__.py +0 -0
- singlepipe/adapters/hf_adapter.py +119 -0
- singlepipe/model_types/__init__.py +3 -0
- singlepipe/model_types/types.py +79 -0
- singlepipe/schemas/__init__.py +25 -0
- singlepipe/schemas/audio_schemas/__init__.py +0 -0
- singlepipe/schemas/audio_schemas/audio_classification.py +40 -0
- singlepipe/schemas/audio_schemas/speech_to_text.py +40 -0
- singlepipe/schemas/audio_schemas/text_to_audio.py +40 -0
- singlepipe/schemas/audio_schemas/zero_shot_audio_classification.py +40 -0
- singlepipe/schemas/image_schemas/__init__.py +0 -0
- singlepipe/schemas/image_schemas/depth_estimation.py +40 -0
- singlepipe/schemas/image_schemas/image_classification.py +40 -0
- singlepipe/schemas/image_schemas/image_embedding.py +40 -0
- singlepipe/schemas/image_schemas/image_segmentation.py +40 -0
- singlepipe/schemas/image_schemas/keypoint_matching.py +40 -0
- singlepipe/schemas/image_schemas/mask_generation.py +40 -0
- singlepipe/schemas/image_schemas/object_detection.py +290 -0
- singlepipe/schemas/image_schemas/zero_shot_image_classification.py +40 -0
- singlepipe/schemas/image_schemas/zero_shot_object_detection.py +40 -0
- singlepipe/schemas/multimodal_schemas/__init__.py +0 -0
- singlepipe/schemas/multimodal_schemas/document_question_answering.py +40 -0
- singlepipe/schemas/multimodal_schemas/image_text_to_text.py +40 -0
- singlepipe/schemas/multimodal_schemas/table_question_answering.py +40 -0
- singlepipe/schemas/ocr_schemas/__init__.py +0 -0
- singlepipe/schemas/ocr_schemas/ocr.py +40 -0
- singlepipe/schemas/registry.py +97 -0
- singlepipe/schemas/table_schemas/__init__.py +0 -0
- singlepipe/schemas/table_schemas/tabular_classification.py +40 -0
- singlepipe/schemas/table_schemas/tabular_regression.py +40 -0
- singlepipe/schemas/text_schemas/__init__.py +0 -0
- singlepipe/schemas/text_schemas/fill_mask.py +40 -0
- singlepipe/schemas/text_schemas/question_answering.py +40 -0
- singlepipe/schemas/text_schemas/summarization.py +40 -0
- singlepipe/schemas/text_schemas/text2text_generation.py +40 -0
- singlepipe/schemas/text_schemas/text_classification.py +40 -0
- singlepipe/schemas/text_schemas/text_embedding.py +40 -0
- singlepipe/schemas/text_schemas/text_generation.py +40 -0
- singlepipe/schemas/text_schemas/token_classification.py +40 -0
- singlepipe/schemas/text_schemas/translation.py +40 -0
- singlepipe/schemas/text_schemas/zero_shot_text_classification.py +40 -0
- singlepipe/schemas/video_schemas/__init__.py +0 -0
- singlepipe/schemas/video_schemas/video_classification.py +40 -0
- singlepipe-0.0.1.dist-info/METADATA +135 -0
- singlepipe-0.0.1.dist-info/RECORD +49 -0
- singlepipe-0.0.1.dist-info/WHEEL +5 -0
- singlepipe-0.0.1.dist-info/licenses/LICENSE +21 -0
- singlepipe-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.TABULAR_REGRESSION.
|
|
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 TabularRegressionInput(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
|
+
"TabularRegressionInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"TabularRegressionInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TabularRegressionOutput(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
|
+
"TabularRegressionOutput is not implemented yet."
|
|
40
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.FILL_MASK.
|
|
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 FillMaskInput(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
|
+
"FillMaskInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"FillMaskInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class FillMaskOutput(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
|
+
"FillMaskOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.QUESTION_ANSWERING.
|
|
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 QuestionAnsweringInput(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
|
+
"QuestionAnsweringInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"QuestionAnsweringInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class QuestionAnsweringOutput(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
|
+
"QuestionAnsweringOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.SUMMARIZATION.
|
|
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 SummarizationInput(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
|
+
"SummarizationInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"SummarizationInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SummarizationOutput(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
|
+
"SummarizationOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.TEXT2TEXT_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 Text2TextGenerationInput(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
|
+
"Text2TextGenerationInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"Text2TextGenerationInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Text2TextGenerationOutput(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
|
+
"Text2TextGenerationOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.TEXT_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 TextClassificationInput(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
|
+
"TextClassificationInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"TextClassificationInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TextClassificationOutput(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
|
+
"TextClassificationOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.TEXT_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 TextEmbeddingInput(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
|
+
"TextEmbeddingInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"TextEmbeddingInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TextEmbeddingOutput(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
|
+
"TextEmbeddingOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.TEXT_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 TextGenerationInput(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
|
+
"TextGenerationInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"TextGenerationInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TextGenerationOutput(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
|
+
"TextGenerationOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.TOKEN_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 TokenClassificationInput(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
|
+
"TokenClassificationInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"TokenClassificationInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TokenClassificationOutput(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
|
+
"TokenClassificationOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.TRANSLATION.
|
|
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 TranslationInput(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
|
+
"TranslationInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"TranslationInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TranslationOutput(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
|
+
"TranslationOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.ZERO_SHOT_TEXT_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 ZeroShotTextClassificationInput(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
|
+
"ZeroShotTextClassificationInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"ZeroShotTextClassificationInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ZeroShotTextClassificationOutput(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
|
+
"ZeroShotTextClassificationOutput is not implemented yet."
|
|
40
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Placeholder schemas for TaskType.VIDEO_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 VideoClassificationInput(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
|
+
"VideoClassificationInput is not implemented yet."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def to_pipeline_input(self) -> Any:
|
|
24
|
+
raise NotImplementedError(
|
|
25
|
+
"VideoClassificationInput is not implemented yet."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def output_context(self) -> dict[str, Any]:
|
|
30
|
+
return {}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class VideoClassificationOutput(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
|
+
"VideoClassificationOutput is not implemented yet."
|
|
40
|
+
)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: singlepipe
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Typed interface for ML model inference across HuggingFace, PyTorch, and other backends
|
|
5
|
+
Author-email: Gleb <glebov274@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: ml,inference,huggingface,pytorch,pydantic,typed
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: httpx>=0.28.1
|
|
20
|
+
Requires-Dist: pillow>=12.3.0
|
|
21
|
+
Requires-Dist: pydantic>=2.13.4
|
|
22
|
+
Requires-Dist: numpy>=2.0
|
|
23
|
+
Requires-Dist: transformers>=5.14.1
|
|
24
|
+
Provides-Extra: torch
|
|
25
|
+
Requires-Dist: torch>=2.13.0; extra == "torch"
|
|
26
|
+
Provides-Extra: detr
|
|
27
|
+
Requires-Dist: torch>=2.13.0; extra == "detr"
|
|
28
|
+
Requires-Dist: timm>=1.0.28; extra == "detr"
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Requires-Dist: torch>=2.13.0; extra == "all"
|
|
31
|
+
Requires-Dist: timm>=1.0.28; extra == "all"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# SinglePipe
|
|
35
|
+
|
|
36
|
+
> Typed interface for ML model inference: one API for HuggingFace, PyTorch, and (eventually) other backends.
|
|
37
|
+
|
|
38
|
+
⚠️ **Status: pre-alpha.** This PyPI release reserves the package name. The library is under active development, the API is unstable, and only one task — object detection via HuggingFace — is currently supported. Not recommended for production use.
|
|
39
|
+
|
|
40
|
+
## Why
|
|
41
|
+
|
|
42
|
+
Working with ML models means drowning in mismatched formats: HuggingFace returns `list[dict]`, a custom `nn.Module` returns tensors, a remote API returns JSON with its own schema. SinglePipe gives you **one entry point** and a **typed output** regardless of what's under the hood.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- **Typed input/output schemas** built on pydantic — validation out of the box, IDE autocomplete, JSON serialization ready.
|
|
47
|
+
- **Flexible input** — an image can arrive as `PIL.Image`, `numpy.ndarray`, `torch.Tensor`, a file path, a URL, or raw bytes; SinglePipe normalizes it to a canonical format.
|
|
48
|
+
- **Unified interface across backends** — HuggingFace today, PyTorch, ONNX, and remote APIs next.
|
|
49
|
+
- **Pipeline composition** *(in progress)* — combine multiple models into one typed flow (detector → OCR → classifier) with automatic type-based wiring.
|
|
50
|
+
- **Async and parallel execution of independent nodes** *(on the roadmap)*.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
Not available yet. This release reserves the package name on PyPI.
|
|
55
|
+
|
|
56
|
+
Requires Python 3.11+.
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from singlepipe.adapters.hf_adapter import HFAdapter
|
|
62
|
+
from singlepipe.model_types import TaskType
|
|
63
|
+
|
|
64
|
+
adapter = HFAdapter(
|
|
65
|
+
model_name="facebook/detr-resnet-50",
|
|
66
|
+
task=TaskType.OBJECT_DETECTION,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
result = adapter("http://images.cocodataset.org/val2017/000000039769.jpg")
|
|
70
|
+
|
|
71
|
+
print(f"Found {len(result)} objects")
|
|
72
|
+
for det in result:
|
|
73
|
+
print(f" {det.label}: score={det.score:.2f}, box={det.box.as_tuple()}")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Accepted inputs: `PIL.Image`, `numpy.ndarray` (HWC), `torch.Tensor` (CHW), a file path (`str` or `Path`), an `http(s)://` URL, or raw `bytes`.
|
|
77
|
+
|
|
78
|
+
## Working with results
|
|
79
|
+
|
|
80
|
+
The result is a typed pydantic object with a rich API:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
# Filtering
|
|
84
|
+
confident = result.filter_by_score(0.7)
|
|
85
|
+
cats_only = result.filter_by_label("cat")
|
|
86
|
+
some = result.filter_by_label(["cat", "dog", "person"])
|
|
87
|
+
|
|
88
|
+
# Iteration
|
|
89
|
+
for det in result:
|
|
90
|
+
print(det.label, det.score)
|
|
91
|
+
print(f"Total: {len(result)}")
|
|
92
|
+
|
|
93
|
+
# Geometry
|
|
94
|
+
box = result.predictions[0].box
|
|
95
|
+
box.width, box.height, box.area, box.center
|
|
96
|
+
box.clip(image_width=800, image_height=600)
|
|
97
|
+
box.iou(other_box)
|
|
98
|
+
|
|
99
|
+
# Serialization
|
|
100
|
+
result.model_dump()
|
|
101
|
+
result.model_dump_json()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Supported tasks
|
|
105
|
+
|
|
106
|
+
| Task | Backend | Status |
|
|
107
|
+
|---|---|---|
|
|
108
|
+
| Object detection | HuggingFace | ✅ |
|
|
109
|
+
| Image classification | HuggingFace | 🚧 planned |
|
|
110
|
+
| Text classification | HuggingFace | 🚧 planned |
|
|
111
|
+
| Text generation | HuggingFace | 🚧 planned |
|
|
112
|
+
|
|
113
|
+
## Roadmap
|
|
114
|
+
|
|
115
|
+
- [x] HF adapter for single-model inference
|
|
116
|
+
- [x] Typed schemas for object detection
|
|
117
|
+
- [ ] Second task (image classification) — verifies the pattern generalizes
|
|
118
|
+
- [ ] `Node` interface for unified pipeline nodes
|
|
119
|
+
- [ ] Linear pipeline composition (`Sequential`)
|
|
120
|
+
- [ ] PyTorch adapter (for custom `nn.Module`)
|
|
121
|
+
- [ ] Full DAG with branching
|
|
122
|
+
- [ ] Async and parallel execution of independent nodes
|
|
123
|
+
- [ ] ONNX Runtime backend
|
|
124
|
+
- [ ] Remote-API backend (OpenAI-compatible)
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
uv sync --group dev
|
|
130
|
+
uv run pytest
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
singlepipe/__init__.py,sha256=VItgDZvFLYwbZ1mWDXsWASc0jO0pYgSN-besvu5A9co,217
|
|
2
|
+
singlepipe/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
singlepipe/adapters/hf_adapter.py,sha256=5fdfUeC8G7TK5BU5-AX2lHpCunNyK3BQiJ2EpUwtBJw,3918
|
|
4
|
+
singlepipe/model_types/__init__.py,sha256=acUbWWor13M_3RTStsWCoE_p3V9dQbOY_iqBltsT_0E,51
|
|
5
|
+
singlepipe/model_types/types.py,sha256=GtvKihHuhoM3P6x6BIVI2KUTo8Kgk9lmbrvxlT0v_74,2861
|
|
6
|
+
singlepipe/schemas/__init__.py,sha256=CSvQq5QErESK_bOYNkiYK50W3CP1QOv4uGtlg28YRTo,491
|
|
7
|
+
singlepipe/schemas/registry.py,sha256=8vK_CXhJL_0_s1USMkUP4deelhHrMuC6QqMsXI8S3xA,2829
|
|
8
|
+
singlepipe/schemas/audio_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
singlepipe/schemas/audio_schemas/audio_classification.py,sha256=SP-BkhIx4XMZ3InDOu0bUG6S1HPP6slqKQyk3Uj7UPk,1122
|
|
10
|
+
singlepipe/schemas/audio_schemas/speech_to_text.py,sha256=QGBfQ3ONIt6PD8BCvx9mEJlWC4JawRLZy4Zr-tUmGDM,1081
|
|
11
|
+
singlepipe/schemas/audio_schemas/text_to_audio.py,sha256=KmZUzLeUWvL_b-nDTMnWsjwxwNtuxpuMrbkRWdgHWTk,1075
|
|
12
|
+
singlepipe/schemas/audio_schemas/zero_shot_audio_classification.py,sha256=Mb-G1QeK8xnwKSa86GdPxqj1rZtLySTvqRgtvudl7pI,1172
|
|
13
|
+
singlepipe/schemas/image_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
singlepipe/schemas/image_schemas/depth_estimation.py,sha256=kRKZYsECaAWp-pU9SLMZlo6Qk8jkzh1l6SUjyELg4QY,1098
|
|
15
|
+
singlepipe/schemas/image_schemas/image_classification.py,sha256=c1NnaWkjzsd9Emu4LHqjUnzbM5aTpxx4BHk0YQ1I74U,1122
|
|
16
|
+
singlepipe/schemas/image_schemas/image_embedding.py,sha256=_R8THMeDt3icKbMpSrryVUbTDK4UGs-TmEEpiADPXIA,1092
|
|
17
|
+
singlepipe/schemas/image_schemas/image_segmentation.py,sha256=1tO7tQS-xJTxHG5qml9F7C_41xZoimDCe6AlQG5R7OU,1109
|
|
18
|
+
singlepipe/schemas/image_schemas/keypoint_matching.py,sha256=4p_8yFPkgUvCXSvQBzJ6Z_joV17nTWT9Qh6H_iXmbpA,1104
|
|
19
|
+
singlepipe/schemas/image_schemas/mask_generation.py,sha256=FTm7mBIzDr3ai5FpY_gFBhsLP2kwIFkLA3ePDsDteLQ,1092
|
|
20
|
+
singlepipe/schemas/image_schemas/object_detection.py,sha256=d_kuRsxwHD9DOiKWgfG_QQCTPb_Fayt89RPR2NI1ldc,9552
|
|
21
|
+
singlepipe/schemas/image_schemas/zero_shot_image_classification.py,sha256=11sGXS7ojMGgsZqjiagPkDinZ3HIoCYnRQmSCm1GuPo,1172
|
|
22
|
+
singlepipe/schemas/image_schemas/zero_shot_object_detection.py,sha256=V_t7_oicYe_8L0fwZyL8YMGIS7K9ium3UO-CZecLaP8,1148
|
|
23
|
+
singlepipe/schemas/multimodal_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
singlepipe/schemas/multimodal_schemas/document_question_answering.py,sha256=dviI4HQmGd5QAAMJcdtmlhd01hg3VoW6Xl7lM6zB8rs,1159
|
|
25
|
+
singlepipe/schemas/multimodal_schemas/image_text_to_text.py,sha256=TIQvE9J0m7MbRo4X_KYx5CO-HawxfintPMYyEX5T-1w,1100
|
|
26
|
+
singlepipe/schemas/multimodal_schemas/table_question_answering.py,sha256=nE1p_U1Z3w06RMJukiL1-xs7C4xf5aCFg6SoN7CNQ6U,1141
|
|
27
|
+
singlepipe/schemas/ocr_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
+
singlepipe/schemas/ocr_schemas/ocr.py,sha256=eiS0Mhb95FXEs_xFiG8a43UHrm56Vt9WP8PVU1PVwiI,1025
|
|
29
|
+
singlepipe/schemas/table_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
singlepipe/schemas/table_schemas/tabular_classification.py,sha256=h4c3BHBKZ2bDB25XjGYd7nJMRY6pN8f4wmhpoCXGRpw,1134
|
|
31
|
+
singlepipe/schemas/table_schemas/tabular_regression.py,sha256=FmqIi_nSQyEY5j13OkQr1GAqPlW-Mnb-lLo-3VbXjM8,1110
|
|
32
|
+
singlepipe/schemas/text_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
|
+
singlepipe/schemas/text_schemas/fill_mask.py,sha256=OQc5TWh5mFBNzcgBuyflXjUDFUmqgGAMiRMcomV_UHc,1056
|
|
34
|
+
singlepipe/schemas/text_schemas/question_answering.py,sha256=u1XDjv9T5l0zJzjR-EAFP3Jol4j4PZpoR7myjBnqcrA,1110
|
|
35
|
+
singlepipe/schemas/text_schemas/summarization.py,sha256=YBhAJ73M-qb6-I-BWJF63SQsUs_qlygtdBWavdaX70w,1085
|
|
36
|
+
singlepipe/schemas/text_schemas/text2text_generation.py,sha256=bcuTYEmUe0-A6LJTIdSAxV6J85tborg4Wraaw2XJhdU,1122
|
|
37
|
+
singlepipe/schemas/text_schemas/text_classification.py,sha256=7e1sUAjp3oLD-Q1PxBUsDD6fuS_s3vbCvpp2rPLyeZg,1116
|
|
38
|
+
singlepipe/schemas/text_schemas/text_embedding.py,sha256=4nIziCXkWSMoCzUEx8UkdRq8-EmQF8RjcXvNxpf5okU,1086
|
|
39
|
+
singlepipe/schemas/text_schemas/text_generation.py,sha256=7agtr5QsVxgL97pkKKRJgIifYDM587h5ShNPksH6nGM,1092
|
|
40
|
+
singlepipe/schemas/text_schemas/token_classification.py,sha256=9EfXg_ClH49V5zNnAemS4ck4hxURkDwWZ78kJQDxFKo,1122
|
|
41
|
+
singlepipe/schemas/text_schemas/translation.py,sha256=DbkxJ2TvjOyHV0gtb3q0mDHA22ofLe4b-fbgbsGieR4,1073
|
|
42
|
+
singlepipe/schemas/text_schemas/zero_shot_text_classification.py,sha256=gstDg74eqKcWwCEg0-vGT1xbhwa0fsmnI5G_VnnEPpw,1166
|
|
43
|
+
singlepipe/schemas/video_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
+
singlepipe/schemas/video_schemas/video_classification.py,sha256=9L2iQh4yTccA8KZzRLergDHYmYcfPGpZ8JCWbzEHEQA,1122
|
|
45
|
+
singlepipe-0.0.1.dist-info/licenses/LICENSE,sha256=FobJkgtqDhnEsARt8AAhaiJRbGXe3aduDLCsdXlF2NI,1069
|
|
46
|
+
singlepipe-0.0.1.dist-info/METADATA,sha256=-Vq3B3vFxOuCeKrzX8IY70t2q5oEOqAfjIKJAIMSRKQ,4657
|
|
47
|
+
singlepipe-0.0.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
48
|
+
singlepipe-0.0.1.dist-info/top_level.txt,sha256=5GFbiUg3fDn0oyFqyeTaLxu7qv91fUl9cBvBTkRLIsU,11
|
|
49
|
+
singlepipe-0.0.1.dist-info/RECORD,,
|