model-compose 0.2.11__tar.gz → 0.2.12__tar.gz
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.
- {model_compose-0.2.11/src/model_compose.egg-info → model_compose-0.2.12}/PKG-INFO +2 -2
- {model_compose-0.2.11 → model_compose-0.2.12}/pyproject.toml +2 -2
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/model/tasks/__init__.py +1 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/model/tasks/summarization.py +22 -19
- model_compose-0.2.12/src/mindor/core/component/services/model/tasks/text_classification.py +78 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/model/tasks/text_embedding.py +18 -14
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/model/tasks/text_generation.py +21 -18
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/model/tasks/translation.py +21 -18
- {model_compose-0.2.11/src/mindor/dsl/schema/component → model_compose-0.2.12/src/mindor/dsl/schema/action}/impl/model/impl/__init__.py +1 -0
- model_compose-0.2.12/src/mindor/dsl/schema/action/impl/model/impl/summarization.py +18 -0
- model_compose-0.2.12/src/mindor/dsl/schema/action/impl/model/impl/text_classification.py +12 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/model/impl/text_embedding.py +4 -4
- model_compose-0.2.12/src/mindor/dsl/schema/action/impl/model/impl/text_generation.py +16 -0
- model_compose-0.2.12/src/mindor/dsl/schema/action/impl/model/impl/translation.py +16 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/model/model.py +1 -0
- {model_compose-0.2.11/src/mindor/dsl/schema/action → model_compose-0.2.12/src/mindor/dsl/schema/component}/impl/model/impl/__init__.py +1 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/model/impl/common.py +3 -0
- model_compose-0.2.12/src/mindor/dsl/schema/component/impl/model/impl/text_classification.py +9 -0
- model_compose-0.2.12/src/mindor/dsl/schema/component/impl/model/impl/types.py +8 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/model/model.py +1 -0
- {model_compose-0.2.11 → model_compose-0.2.12/src/model_compose.egg-info}/PKG-INFO +2 -2
- {model_compose-0.2.11 → model_compose-0.2.12}/src/model_compose.egg-info/SOURCES.txt +3 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/model_compose.egg-info/requires.txt +1 -1
- model_compose-0.2.11/src/mindor/dsl/schema/action/impl/model/impl/summarization.py +0 -17
- model_compose-0.2.11/src/mindor/dsl/schema/action/impl/model/impl/text_generation.py +0 -15
- model_compose-0.2.11/src/mindor/dsl/schema/action/impl/model/impl/translation.py +0 -15
- model_compose-0.2.11/src/mindor/dsl/schema/component/impl/model/impl/types.py +0 -7
- {model_compose-0.2.11 → model_compose-0.2.12}/LICENSE +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/README.md +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/setup.cfg +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/cli/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/cli/compose.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/base.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/component.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/context.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/http_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/http_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/mcp_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/mcp_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/model/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/model/base.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/model/model.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/shell.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/component/services/workflow.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/compose/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/compose/compose.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/compose/manager.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/base.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/controller.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/runner/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/runner/client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/runner/http_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/runner/mcp_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/runner/runner.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/services/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/services/http_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/services/mcp_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/webui/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/webui/gradio.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/controller/webui/webui.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/gateway/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/gateway/base.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/gateway/gateway.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/gateway/services/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/gateway/services/http_tunnel.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/gateway/services/ssh_tunnel.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/listener/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/listener/base.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/listener/listener.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/listener/services/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/listener/services/http_callback.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/logger/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/logger/base.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/logger/logger.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/logger/logging.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/logger/services/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/logger/services/console.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/logger/services/file.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/runtime/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/runtime/env.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/services/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/services/async_service.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/expiring.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/http_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/http_request.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/http_status.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/image.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/mcp_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/renderer.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/ssh_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/streaming.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/time.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/utils/workqueue.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/context.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/job/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/job/base.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/job/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/job/impl/action.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/job/impl/delay.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/job/job.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/schema.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/core/workflow/workflow.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/loader.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/action.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/http_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/http_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/mcp_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/mcp_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/model/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/model/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/shell.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/action/impl/workflow.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/component.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/http_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/http_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/mcp_client.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/mcp_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/model/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/model/impl/summarization.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/model/impl/text_embedding.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/model/impl/text_generation.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/model/impl/translation.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/shell.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/types.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/component/impl/workflow.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/compose.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/controller/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/controller/controller.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/controller/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/controller/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/controller/impl/http_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/controller/impl/mcp_server.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/controller/impl/types.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/controller/impl/webui.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/gateway/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/gateway/gateway.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/gateway/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/gateway/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/gateway/impl/http_tunnel.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/gateway/impl/ssh_tunnel.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/gateway/impl/types.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/job/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/job/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/job/impl/action.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/job/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/job/impl/delay.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/job/impl/types.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/job/job.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/listener/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/listener/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/listener/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/listener/impl/http_callback.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/listener/impl/types.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/listener/listener.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/logger/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/logger/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/logger/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/logger/impl/console.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/logger/impl/file.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/logger/impl/types.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/logger/logger.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/runtime/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/runtime/impl/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/runtime/impl/common.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/runtime/impl/docker.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/runtime/impl/types.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/runtime/runtime.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/schema/workflow.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/utils/__init__.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/mindor/dsl/utils/annotation.py +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/model_compose.egg-info/dependency_links.txt +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/model_compose.egg-info/entry_points.txt +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/src/model_compose.egg-info/top_level.txt +0 -0
- {model_compose-0.2.11 → model_compose-0.2.12}/tests/test_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: model-compose
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: model-compose: Declarative AI Model and Workflow Orchestrator
|
|
5
5
|
Author-email: Hanyeol Cho <hanyeol.cho@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -20,7 +20,7 @@ Requires-Dist: pyngrok
|
|
|
20
20
|
Requires-Dist: ulid
|
|
21
21
|
Requires-Dist: gradio
|
|
22
22
|
Requires-Dist: Pillow
|
|
23
|
-
Requires-Dist: transformers
|
|
23
|
+
Requires-Dist: transformers>=4.21.0
|
|
24
24
|
Requires-Dist: torch
|
|
25
25
|
Requires-Dist: sentencepiece
|
|
26
26
|
Requires-Dist: accelerate
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "model-compose"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.12"
|
|
4
4
|
description = "model-compose: Declarative AI Model and Workflow Orchestrator"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Hanyeol Cho", email = "hanyeol.cho@gmail.com" }
|
|
@@ -21,7 +21,7 @@ dependencies = [
|
|
|
21
21
|
"ulid",
|
|
22
22
|
"gradio",
|
|
23
23
|
"Pillow",
|
|
24
|
-
"transformers",
|
|
24
|
+
"transformers>=4.21.0",
|
|
25
25
|
"torch",
|
|
26
26
|
"sentencepiece",
|
|
27
27
|
"accelerate"
|
|
@@ -16,7 +16,6 @@ class SummarizationTaskAction:
|
|
|
16
16
|
async def run(self, context: ComponentActionContext) -> Any:
|
|
17
17
|
text: Union[str, List[str]] = await context.render_variable(self.config.text)
|
|
18
18
|
|
|
19
|
-
# Model parameters
|
|
20
19
|
max_input_length = await context.render_variable(self.config.params.max_input_length)
|
|
21
20
|
max_output_length = await context.render_variable(self.config.params.max_output_length)
|
|
22
21
|
min_output_length = await context.render_variable(self.config.params.min_output_length)
|
|
@@ -24,28 +23,32 @@ class SummarizationTaskAction:
|
|
|
24
23
|
length_penalty = await context.render_variable(self.config.params.length_penalty)
|
|
25
24
|
early_stopping = await context.render_variable(self.config.params.early_stopping)
|
|
26
25
|
do_sample = await context.render_variable(self.config.params.do_sample)
|
|
26
|
+
batch_size = await context.render_variable(self.config.params.batch_size)
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
texts: List[str] = [ text ] if isinstance(text, str) else text
|
|
29
|
+
results = []
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
**inputs,
|
|
35
|
-
max_length=max_output_length,
|
|
36
|
-
min_length=min_output_length,
|
|
37
|
-
num_beams=num_beams,
|
|
38
|
-
length_penalty=length_penalty,
|
|
39
|
-
early_stopping=early_stopping,
|
|
40
|
-
do_sample=do_sample,
|
|
41
|
-
pad_token_id=getattr(self.tokenizer, "pad_token_id", None),
|
|
42
|
-
eos_token_id=getattr(self.tokenizer, "eos_token_id", None)
|
|
43
|
-
)
|
|
31
|
+
for index in range(0, len(texts), batch_size):
|
|
32
|
+
batch_texts = texts[index:index + batch_size]
|
|
33
|
+
inputs = self.tokenizer(batch_texts, return_tensors="pt", max_length=max_input_length, padding=True, truncation=True).to(self.model.device)
|
|
44
34
|
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
with torch.no_grad():
|
|
36
|
+
outputs = self.model.generate(
|
|
37
|
+
**inputs,
|
|
38
|
+
max_length=max_output_length,
|
|
39
|
+
min_length=min_output_length,
|
|
40
|
+
num_beams=num_beams,
|
|
41
|
+
length_penalty=length_penalty,
|
|
42
|
+
early_stopping=early_stopping,
|
|
43
|
+
do_sample=do_sample,
|
|
44
|
+
pad_token_id=getattr(self.tokenizer, "pad_token_id", None),
|
|
45
|
+
eos_token_id=getattr(self.tokenizer, "eos_token_id", None)
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
outputs = self.tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
|
49
|
+
results.extend(outputs)
|
|
47
50
|
|
|
48
|
-
result =
|
|
51
|
+
result = results if len(results) > 1 else results[0]
|
|
49
52
|
context.register_source("result", result)
|
|
50
53
|
|
|
51
54
|
return (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else result
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
+
from mindor.dsl.schema.component import ModelComponentConfig
|
|
3
|
+
from mindor.dsl.schema.action import ModelActionConfig, TextClassificationModelActionConfig
|
|
4
|
+
from mindor.core.logger import logging
|
|
5
|
+
from ..base import ModelTaskService, ModelTaskType, register_model_task_service
|
|
6
|
+
from ..base import ComponentActionContext
|
|
7
|
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer, PreTrainedModel, PreTrainedTokenizer
|
|
8
|
+
from transformers.modeling_outputs import SequenceClassifierOutput
|
|
9
|
+
import torch.nn.functional as F
|
|
10
|
+
import torch
|
|
11
|
+
|
|
12
|
+
class TextClassificationTaskAction:
|
|
13
|
+
def __init__(self, config: TextClassificationModelActionConfig, model: PreTrainedModel, tokenizer: PreTrainedTokenizer):
|
|
14
|
+
self.config: TextClassificationModelActionConfig = config
|
|
15
|
+
self.model: PreTrainedModel = model
|
|
16
|
+
self.tokenizer: PreTrainedTokenizer = tokenizer
|
|
17
|
+
|
|
18
|
+
async def run(self, context: ComponentActionContext, labels: Optional[List[str]]) -> Any:
|
|
19
|
+
text: Union[str, List[str]] = await context.render_variable(self.config.text)
|
|
20
|
+
|
|
21
|
+
return_probabilities = await context.render_variable(self.config.params.return_probabilities)
|
|
22
|
+
batch_size = await context.render_variable(self.config.params.batch_size)
|
|
23
|
+
|
|
24
|
+
texts: List[str] = [ text ] if isinstance(text, str) else text
|
|
25
|
+
results = []
|
|
26
|
+
|
|
27
|
+
for index in range(0, len(texts), batch_size):
|
|
28
|
+
batch_texts = texts[index:index + batch_size]
|
|
29
|
+
inputs = self.tokenizer(batch_texts, return_tensors="pt", padding=True, truncation=True).to(self.model.device)
|
|
30
|
+
|
|
31
|
+
with torch.no_grad():
|
|
32
|
+
outputs: SequenceClassifierOutput = self.model(**inputs)
|
|
33
|
+
logits = outputs.logits # shape: (batch_size, num_classes)
|
|
34
|
+
|
|
35
|
+
predicted = []
|
|
36
|
+
if return_probabilities:
|
|
37
|
+
probs = F.softmax(logits, dim=-1).cpu()
|
|
38
|
+
for prob in probs:
|
|
39
|
+
predicted_index = torch.argmax(prob).item()
|
|
40
|
+
predicted.append({
|
|
41
|
+
"label": labels[predicted_index] if labels else predicted_index,
|
|
42
|
+
"probabilities": prob.tolist()
|
|
43
|
+
})
|
|
44
|
+
else:
|
|
45
|
+
predicted_indices = torch.argmax(logits, dim=-1).tolist()
|
|
46
|
+
for predicted_index in predicted_indices:
|
|
47
|
+
predicted.append(labels[predicted_index] if labels else predicted_index)
|
|
48
|
+
|
|
49
|
+
results.extend(predicted)
|
|
50
|
+
|
|
51
|
+
result = results if len(results) > 1 else results[0]
|
|
52
|
+
context.register_source("result", result)
|
|
53
|
+
|
|
54
|
+
return (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else result
|
|
55
|
+
|
|
56
|
+
@register_model_task_service(ModelTaskType.TEXT_CLASSIFICATION)
|
|
57
|
+
class TextClassificationTaskService(ModelTaskService):
|
|
58
|
+
def __init__(self, id: str, config: ModelComponentConfig, daemon: bool):
|
|
59
|
+
super().__init__(id, config, daemon)
|
|
60
|
+
|
|
61
|
+
self.model: Optional[PreTrainedModel] = None
|
|
62
|
+
self.tokenizer: Optional[PreTrainedTokenizer] = None
|
|
63
|
+
|
|
64
|
+
async def _serve(self) -> None:
|
|
65
|
+
try:
|
|
66
|
+
self.model = AutoModelForSequenceClassification.from_pretrained(self.config.model).to(torch.device(self.config.device))
|
|
67
|
+
self.tokenizer = AutoTokenizer.from_pretrained(self.config.model, use_fast=self.config.fast_tokenizer)
|
|
68
|
+
logging.info(f"Model and tokenizer loaded successfully on device '{self.config.device}': {self.config.model}")
|
|
69
|
+
except Exception as e:
|
|
70
|
+
logging.error(f"Failed to load model '{self.config.model}': {e}")
|
|
71
|
+
raise
|
|
72
|
+
|
|
73
|
+
async def _shutdown(self) -> None:
|
|
74
|
+
self.model = None
|
|
75
|
+
self.tokenizer = None
|
|
76
|
+
|
|
77
|
+
async def _run(self, action: ModelActionConfig, context: ComponentActionContext) -> Any:
|
|
78
|
+
return await TextClassificationTaskAction(action, self.model, self.tokenizer).run(context, self.config.labels)
|
|
@@ -16,29 +16,33 @@ class TextEmbeddingTaskAction:
|
|
|
16
16
|
self.tokenizer: PreTrainedTokenizer = tokenizer
|
|
17
17
|
|
|
18
18
|
async def run(self, context: ComponentActionContext) -> Any:
|
|
19
|
-
text = await context.render_variable(self.config.text)
|
|
19
|
+
text: Union[str, List[str]] = await context.render_variable(self.config.text)
|
|
20
20
|
|
|
21
|
-
# Model parameters
|
|
22
21
|
max_input_length = await context.render_variable(self.config.params.max_input_length)
|
|
23
22
|
pooling = await context.render_variable(self.config.params.pooling)
|
|
24
23
|
normalize = await context.render_variable(self.config.params.normalize)
|
|
24
|
+
batch_size = await context.render_variable(self.config.params.batch_size)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
attention_mask: Tensor = inputs.get("attention_mask", None)
|
|
26
|
+
texts: List[str] = [ text ] if isinstance(text, str) else text
|
|
27
|
+
results = []
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
for index in range(0, len(texts), batch_size):
|
|
30
|
+
batch_texts = texts[index:index + batch_size]
|
|
31
|
+
inputs = self.tokenizer(batch_texts, return_tensors="pt", max_length=max_input_length, padding=True, truncation=True).to(self.model.device)
|
|
32
|
+
attention_mask: Tensor = inputs.get("attention_mask", None)
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
with torch.no_grad():
|
|
35
|
+
outputs: BaseModelOutput = self.model(**inputs)
|
|
36
|
+
last_hidden_state = outputs.last_hidden_state # (batch_size, seq_len, hidden_size)
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
embedding = torch.nn.functional.normalize(embedding, p=2, dim=1)
|
|
38
|
+
embeddings = self._pool_hidden_state(last_hidden_state, attention_mask, pooling)
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
if normalize:
|
|
41
|
+
embeddings = torch.nn.functional.normalize(embeddings, p=2, dim=1)
|
|
42
|
+
|
|
43
|
+
results.extend(embeddings.cpu().tolist())
|
|
44
|
+
|
|
45
|
+
result = results if len(results) > 1 else results[0]
|
|
42
46
|
context.register_source("result", result)
|
|
43
47
|
|
|
44
48
|
return (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else result
|
|
@@ -16,32 +16,35 @@ class TextGenerationTaskAction:
|
|
|
16
16
|
async def run(self, context: ComponentActionContext) -> Any:
|
|
17
17
|
prompt: Union[str, List[str]] = await context.render_variable(self.config.prompt)
|
|
18
18
|
|
|
19
|
-
# Model parameters
|
|
20
19
|
max_output_length = await context.render_variable(self.config.params.max_output_length)
|
|
21
20
|
num_return_sequences = await context.render_variable(self.config.params.num_return_sequences)
|
|
22
21
|
temperature = await context.render_variable(self.config.params.temperature)
|
|
23
22
|
top_k = await context.render_variable(self.config.params.top_k)
|
|
24
23
|
top_p = await context.render_variable(self.config.params.top_p)
|
|
24
|
+
batch_size = await context.render_variable(self.config.params.batch_size)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
prompts: List[str] = [ prompt ] if isinstance(prompt, str) else prompt
|
|
27
|
+
results = []
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
**inputs,
|
|
33
|
-
max_length=max_output_length,
|
|
34
|
-
num_return_sequences=num_return_sequences,
|
|
35
|
-
temperature=temperature,
|
|
36
|
-
top_k=top_k,
|
|
37
|
-
top_p=top_p,
|
|
38
|
-
do_sample=True
|
|
39
|
-
)
|
|
29
|
+
for index in range(0, len(prompts), batch_size):
|
|
30
|
+
batch_prompts = prompts[index:index + batch_size]
|
|
31
|
+
inputs = self.tokenizer(batch_prompts, return_tensors="pt").to(self.model.device)
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
with torch.no_grad():
|
|
34
|
+
outputs = self.model.generate(
|
|
35
|
+
**inputs,
|
|
36
|
+
max_new_tokens=max_output_length,
|
|
37
|
+
num_return_sequences=num_return_sequences,
|
|
38
|
+
temperature=temperature,
|
|
39
|
+
top_k=top_k,
|
|
40
|
+
top_p=top_p,
|
|
41
|
+
do_sample=True
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
outputs = self.tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
|
45
|
+
results.extend(outputs)
|
|
46
|
+
|
|
47
|
+
result = results if len(results) > 1 else results[0]
|
|
45
48
|
context.register_source("result", result)
|
|
46
49
|
|
|
47
50
|
return (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else result
|
|
@@ -16,33 +16,36 @@ class TranslationTaskAction:
|
|
|
16
16
|
async def run(self, context: ComponentActionContext) -> Any:
|
|
17
17
|
text: Union[str, List[str]] = await context.render_variable(self.config.text)
|
|
18
18
|
|
|
19
|
-
# Model parameters
|
|
20
19
|
max_input_length = await context.render_variable(self.config.params.max_input_length)
|
|
21
20
|
max_output_length = await context.render_variable(self.config.params.max_output_length)
|
|
22
21
|
min_output_length = await context.render_variable(self.config.params.min_output_length)
|
|
23
22
|
num_beams = await context.render_variable(self.config.params.num_beams)
|
|
24
23
|
length_penalty = await context.render_variable(self.config.params.length_penalty)
|
|
24
|
+
batch_size = await context.render_variable(self.config.params.batch_size)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
texts: List[str] = [ text ] if isinstance(text, str) else text
|
|
27
|
+
results = []
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
**inputs,
|
|
33
|
-
max_length=max_output_length,
|
|
34
|
-
min_length=min_output_length,
|
|
35
|
-
num_beams=num_beams,
|
|
36
|
-
length_penalty=length_penalty,
|
|
37
|
-
do_sample=False,
|
|
38
|
-
pad_token_id=getattr(self.tokenizer, "pad_token_id", None),
|
|
39
|
-
eos_token_id=getattr(self.tokenizer, "eos_token_id", None)
|
|
40
|
-
)
|
|
29
|
+
for index in range(0, len(texts), batch_size):
|
|
30
|
+
batch_texts = texts[index:index + batch_size]
|
|
31
|
+
inputs = self.tokenizer(batch_texts, return_tensors="pt", max_length=max_input_length, padding=True, truncation=True).to(self.model.device)
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
with torch.no_grad():
|
|
34
|
+
outputs = self.model.generate(
|
|
35
|
+
**inputs,
|
|
36
|
+
max_length=max_output_length,
|
|
37
|
+
min_length=min_output_length,
|
|
38
|
+
num_beams=num_beams,
|
|
39
|
+
length_penalty=length_penalty,
|
|
40
|
+
do_sample=False,
|
|
41
|
+
pad_token_id=getattr(self.tokenizer, "pad_token_id", None),
|
|
42
|
+
eos_token_id=getattr(self.tokenizer, "eos_token_id", None)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
outputs = self.tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
|
46
|
+
results.extend(outputs)
|
|
44
47
|
|
|
45
|
-
result =
|
|
48
|
+
result = results if len(results) > 1 else results[0]
|
|
46
49
|
context.register_source("result", result)
|
|
47
50
|
|
|
48
51
|
return (await context.render_variable(self.config.output, ignore_files=True)) if self.config.output else result
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from pydantic import model_validator
|
|
4
|
+
from .common import CommonModelActionConfig
|
|
5
|
+
|
|
6
|
+
class SummarizationParamsConfig(BaseModel):
|
|
7
|
+
max_input_length: Union[int, str] = Field(default=1024, description="Maximum number of tokens per input text.")
|
|
8
|
+
max_output_length: Union[int, str] = Field(default=256, description="The maximum number of tokens to generate.")
|
|
9
|
+
min_output_length: Union[int, str] = Field(default=30, description="The minimum number of tokens to generate.")
|
|
10
|
+
num_beams: Union[int, str] = Field(default=4, description="Number of beams to use for beam search.")
|
|
11
|
+
length_penalty: Union[float, str] = Field(default=2.0, description="Length penalty applied during beam search.")
|
|
12
|
+
early_stopping: bool = Field(default=True, description="Whether to stop the beam search when all beams finish generating.")
|
|
13
|
+
do_sample: bool = Field(default=True, description="Whether to use sampling.")
|
|
14
|
+
batch_size: Union[int, str] = Field(default=32, description="Number of input texts to process in a single batch.")
|
|
15
|
+
|
|
16
|
+
class SummarizationModelActionConfig(CommonModelActionConfig):
|
|
17
|
+
text: Union[str, List[str]] = Field(..., description="Input text to summarize.")
|
|
18
|
+
params: SummarizationParamsConfig = Field(default_factory=SummarizationParamsConfig, description="Summarization configuration parameters.")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from pydantic import model_validator
|
|
4
|
+
from .common import CommonModelActionConfig
|
|
5
|
+
|
|
6
|
+
class TextClassificationParamsConfig(BaseModel):
|
|
7
|
+
return_probabilities: Union[bool, str] = Field(default=False, description="Whether to return class probabilities for each prediction.")
|
|
8
|
+
batch_size: Union[int, str] = Field(default=32, description="Number of input texts to process in a single batch.")
|
|
9
|
+
|
|
10
|
+
class TextClassificationModelActionConfig(CommonModelActionConfig):
|
|
11
|
+
text: Union[str, List[str]] = Field(..., description="Input text to classify.")
|
|
12
|
+
params: TextClassificationParamsConfig = Field(default_factory=TextClassificationParamsConfig, description="Text classification configuration parameters.")
|
|
@@ -4,11 +4,11 @@ from pydantic import model_validator
|
|
|
4
4
|
from .common import CommonModelActionConfig
|
|
5
5
|
|
|
6
6
|
class TextEmbeddingParamsConfig(BaseModel):
|
|
7
|
-
max_input_length: int = Field(default=512, description="Maximum number of tokens per input text.")
|
|
7
|
+
max_input_length: Union[int, str] = Field(default=512, description="Maximum number of tokens per input text.")
|
|
8
8
|
pooling: Literal[ "mean", "cls", "max" ] = Field(default="mean", description="Pooling strategy used to aggregate token embeddings.")
|
|
9
|
-
normalize: bool = Field(default=True, description="Whether to apply L2 normalization to the output embeddings.")
|
|
10
|
-
batch_size: int = Field(default=
|
|
9
|
+
normalize: Union[bool, str] = Field(default=True, description="Whether to apply L2 normalization to the output embeddings.")
|
|
10
|
+
batch_size: Union[int, str] = Field(default=32, description="Number of input texts to process in a single batch.")
|
|
11
11
|
|
|
12
12
|
class TextEmbeddingModelActionConfig(CommonModelActionConfig):
|
|
13
|
-
text: str = Field(..., description="Input text to be embedded.")
|
|
13
|
+
text: Union[str, List[str]] = Field(..., description="Input text to be embedded.")
|
|
14
14
|
params: TextEmbeddingParamsConfig = Field(default_factory=TextEmbeddingParamsConfig, description="Configuration parameters for embedding generation.")
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from pydantic import model_validator
|
|
4
|
+
from .common import CommonModelActionConfig
|
|
5
|
+
|
|
6
|
+
class TextGenerationParamsConfig(BaseModel):
|
|
7
|
+
max_output_length: Union[int, str] = Field(default=1024, description="The maximum number of tokens to generate.")
|
|
8
|
+
num_return_sequences: Union[int, str] = Field(default=1, description="The number of generated sequences to return.")
|
|
9
|
+
temperature: Union[float, str] = Field(default=1.0, description="Sampling temperature; higher values produce more random results.")
|
|
10
|
+
top_k: Union[int, str] = Field(default=50, description="Top-K sampling; restricts sampling to the top K tokens.")
|
|
11
|
+
top_p: Union[int, str] = Field(default=0.9, description="Top-p (nucleus) sampling; restricts sampling to tokens with cumulative probability >= top_p.")
|
|
12
|
+
batch_size: Union[int, str] = Field(default=32, description="Number of input texts to process in a single batch.")
|
|
13
|
+
|
|
14
|
+
class TextGenerationModelActionConfig(CommonModelActionConfig):
|
|
15
|
+
prompt: Union[str, List[str]] = Field(..., description="Input prompt to generate text from.")
|
|
16
|
+
params: TextGenerationParamsConfig = Field(default_factory=TextGenerationParamsConfig, description="Text generation configuration parameters.")
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from pydantic import model_validator
|
|
4
|
+
from .common import CommonModelActionConfig
|
|
5
|
+
|
|
6
|
+
class TranslationParamsConfig(BaseModel):
|
|
7
|
+
max_input_length: Union[int, str] = Field(default=1024, description="Maximum number of tokens per input text.")
|
|
8
|
+
max_output_length: Union[int, str] = Field(default=256, description="The maximum number of tokens to generate.")
|
|
9
|
+
min_output_length: Union[int, str] = Field(default=10, description="The minimum number of tokens to generate.")
|
|
10
|
+
num_beams: Union[int, str] = Field(default=4, description="Number of beams to use for beam search.")
|
|
11
|
+
length_penalty: Union[float, str] = Field(default=1.0, description="Length penalty applied during beam search.")
|
|
12
|
+
batch_size: Union[int, str] = Field(default=32, description="Number of input texts to process in a single batch.")
|
|
13
|
+
|
|
14
|
+
class TranslationModelActionConfig(CommonModelActionConfig):
|
|
15
|
+
text: Union[str, List[str]] = Field(..., description="Input text to translate.")
|
|
16
|
+
params: TranslationParamsConfig = Field(default_factory=TranslationParamsConfig, description="Translation configuration parameters.")
|
|
@@ -21,3 +21,6 @@ class CommonModelComponentConfig(CommonComponentConfig):
|
|
|
21
21
|
if any(k in values for k in action_keys):
|
|
22
22
|
values["actions"] = { "__default__": { k: values.pop(k) for k in action_keys if k in values } }
|
|
23
23
|
return values
|
|
24
|
+
|
|
25
|
+
class ClassificationModelComponentConfig(CommonModelComponentConfig):
|
|
26
|
+
labels: Optional[List[str]] = Field(default=None, description="List of class labels for classification tasks.")
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
+
from pydantic import BaseModel, Field
|
|
3
|
+
from pydantic import model_validator
|
|
4
|
+
from mindor.dsl.schema.action import TextClassificationModelActionConfig
|
|
5
|
+
from .common import ClassificationModelComponentConfig, ModelTaskType
|
|
6
|
+
|
|
7
|
+
class TextClassificationModelComponentConfig(ClassificationModelComponentConfig):
|
|
8
|
+
task: Literal[ModelTaskType.TEXT_CLASSIFICATION]
|
|
9
|
+
actions: Dict[str, TextClassificationModelActionConfig] = Field(default_factory=dict, description="")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: model-compose
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.12
|
|
4
4
|
Summary: model-compose: Declarative AI Model and Workflow Orchestrator
|
|
5
5
|
Author-email: Hanyeol Cho <hanyeol.cho@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -20,7 +20,7 @@ Requires-Dist: pyngrok
|
|
|
20
20
|
Requires-Dist: ulid
|
|
21
21
|
Requires-Dist: gradio
|
|
22
22
|
Requires-Dist: Pillow
|
|
23
|
-
Requires-Dist: transformers
|
|
23
|
+
Requires-Dist: transformers>=4.21.0
|
|
24
24
|
Requires-Dist: torch
|
|
25
25
|
Requires-Dist: sentencepiece
|
|
26
26
|
Requires-Dist: accelerate
|
|
@@ -21,6 +21,7 @@ src/mindor/core/component/services/model/base.py
|
|
|
21
21
|
src/mindor/core/component/services/model/model.py
|
|
22
22
|
src/mindor/core/component/services/model/tasks/__init__.py
|
|
23
23
|
src/mindor/core/component/services/model/tasks/summarization.py
|
|
24
|
+
src/mindor/core/component/services/model/tasks/text_classification.py
|
|
24
25
|
src/mindor/core/component/services/model/tasks/text_embedding.py
|
|
25
26
|
src/mindor/core/component/services/model/tasks/text_generation.py
|
|
26
27
|
src/mindor/core/component/services/model/tasks/translation.py
|
|
@@ -105,6 +106,7 @@ src/mindor/dsl/schema/action/impl/model/model.py
|
|
|
105
106
|
src/mindor/dsl/schema/action/impl/model/impl/__init__.py
|
|
106
107
|
src/mindor/dsl/schema/action/impl/model/impl/common.py
|
|
107
108
|
src/mindor/dsl/schema/action/impl/model/impl/summarization.py
|
|
109
|
+
src/mindor/dsl/schema/action/impl/model/impl/text_classification.py
|
|
108
110
|
src/mindor/dsl/schema/action/impl/model/impl/text_embedding.py
|
|
109
111
|
src/mindor/dsl/schema/action/impl/model/impl/text_generation.py
|
|
110
112
|
src/mindor/dsl/schema/action/impl/model/impl/translation.py
|
|
@@ -124,6 +126,7 @@ src/mindor/dsl/schema/component/impl/model/model.py
|
|
|
124
126
|
src/mindor/dsl/schema/component/impl/model/impl/__init__.py
|
|
125
127
|
src/mindor/dsl/schema/component/impl/model/impl/common.py
|
|
126
128
|
src/mindor/dsl/schema/component/impl/model/impl/summarization.py
|
|
129
|
+
src/mindor/dsl/schema/component/impl/model/impl/text_classification.py
|
|
127
130
|
src/mindor/dsl/schema/component/impl/model/impl/text_embedding.py
|
|
128
131
|
src/mindor/dsl/schema/component/impl/model/impl/text_generation.py
|
|
129
132
|
src/mindor/dsl/schema/component/impl/model/impl/translation.py
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
-
from pydantic import BaseModel, Field
|
|
3
|
-
from pydantic import model_validator
|
|
4
|
-
from .common import CommonModelActionConfig
|
|
5
|
-
|
|
6
|
-
class SummarizationParamsConfig(BaseModel):
|
|
7
|
-
max_input_length: int = Field(default=1024, description="Maximum number of tokens per input text.")
|
|
8
|
-
max_output_length: int = Field(default=256, description="The maximum number of tokens to generate.")
|
|
9
|
-
min_output_length: int = Field(default=30, description="The minimum number of tokens to generate.")
|
|
10
|
-
num_beams: int = Field(default=4, description="")
|
|
11
|
-
length_penalty: float = Field(default=2.0, description="")
|
|
12
|
-
early_stopping: bool = Field(default=True, description="")
|
|
13
|
-
do_sample: bool = Field(default=True, description="Whether to use sampling.")
|
|
14
|
-
|
|
15
|
-
class SummarizationModelActionConfig(CommonModelActionConfig):
|
|
16
|
-
text: str = Field(..., description="")
|
|
17
|
-
params: SummarizationParamsConfig = Field(default_factory=SummarizationParamsConfig, description="Summarization configuration parameters.")
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
-
from pydantic import BaseModel, Field
|
|
3
|
-
from pydantic import model_validator
|
|
4
|
-
from .common import CommonModelActionConfig
|
|
5
|
-
|
|
6
|
-
class TextGenerationParamsConfig(BaseModel):
|
|
7
|
-
max_output_length: int = Field(default=1024, description="The maximum number of tokens to generate.")
|
|
8
|
-
num_return_sequences: int = Field(default=1, description="The number of generated sequences to return.")
|
|
9
|
-
temperature: float = Field(default=1.0, description="Sampling temperature; higher values produce more random results.")
|
|
10
|
-
top_k: int = Field(default=50, description="Top-K sampling; restricts sampling to the top K tokens.")
|
|
11
|
-
top_p: float = Field(default=1.0, description="Top-p (nucleus) sampling; restricts sampling to tokens with cumulative probability >= top_p.")
|
|
12
|
-
|
|
13
|
-
class TextGenerationModelActionConfig(CommonModelActionConfig):
|
|
14
|
-
prompt: str = Field(..., description="")
|
|
15
|
-
params: TextGenerationParamsConfig = Field(default_factory=TextGenerationParamsConfig, description="Text generation configuration parameters.")
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from typing import Type, Union, Literal, Optional, Dict, List, Tuple, Set, Annotated, Any
|
|
2
|
-
from pydantic import BaseModel, Field
|
|
3
|
-
from pydantic import model_validator
|
|
4
|
-
from .common import CommonModelActionConfig
|
|
5
|
-
|
|
6
|
-
class TranslationParamsConfig(BaseModel):
|
|
7
|
-
max_input_length: int = Field(default=1024, description="Maximum number of tokens per input text.")
|
|
8
|
-
max_output_length: int = Field(default=256, description="The maximum number of tokens to generate.")
|
|
9
|
-
min_output_length: int = Field(default=10, description="The minimum number of tokens to generate.")
|
|
10
|
-
num_beams: int = Field(default=4, description="")
|
|
11
|
-
length_penalty: float = Field(default=1.0, description="")
|
|
12
|
-
|
|
13
|
-
class TranslationModelActionConfig(CommonModelActionConfig):
|
|
14
|
-
text: str = Field(..., description="")
|
|
15
|
-
params: TranslationParamsConfig = Field(default_factory=TranslationParamsConfig, description="Translation configuration parameters.")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|