synapse-sdk 1.0.0a13__py3-none-any.whl → 2025.11.7__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.
Potentially problematic release.
This version of synapse-sdk might be problematic. Click here for more details.
- synapse_sdk/__init__.py +24 -0
- synapse_sdk/cli/__init__.py +310 -5
- synapse_sdk/cli/alias/__init__.py +22 -0
- synapse_sdk/cli/alias/create.py +36 -0
- synapse_sdk/cli/alias/dataclass.py +31 -0
- synapse_sdk/cli/alias/default.py +16 -0
- synapse_sdk/cli/alias/delete.py +15 -0
- synapse_sdk/cli/alias/list.py +19 -0
- synapse_sdk/cli/alias/read.py +15 -0
- synapse_sdk/cli/alias/update.py +17 -0
- synapse_sdk/cli/alias/utils.py +61 -0
- synapse_sdk/cli/code_server.py +687 -0
- synapse_sdk/cli/config.py +440 -0
- synapse_sdk/cli/devtools.py +90 -0
- synapse_sdk/cli/plugin/__init__.py +33 -0
- synapse_sdk/cli/{create_plugin.py → plugin/create.py} +2 -2
- synapse_sdk/cli/plugin/publish.py +45 -0
- synapse_sdk/{plugins/cli → cli/plugin}/run.py +12 -5
- synapse_sdk/clients/agent/__init__.py +9 -3
- synapse_sdk/clients/agent/container.py +133 -0
- synapse_sdk/clients/agent/core.py +19 -0
- synapse_sdk/clients/agent/ray.py +298 -9
- synapse_sdk/clients/backend/__init__.py +41 -12
- synapse_sdk/clients/backend/annotation.py +13 -5
- synapse_sdk/clients/backend/core.py +59 -0
- synapse_sdk/clients/backend/data_collection.py +186 -0
- synapse_sdk/clients/backend/hitl.py +17 -0
- synapse_sdk/clients/backend/integration.py +19 -4
- synapse_sdk/clients/backend/ml.py +10 -7
- synapse_sdk/clients/backend/models.py +78 -0
- synapse_sdk/clients/base.py +381 -34
- synapse_sdk/clients/ray/serve.py +2 -0
- synapse_sdk/clients/validators/collections.py +31 -0
- synapse_sdk/devtools/config.py +94 -0
- synapse_sdk/devtools/docs/.gitignore +20 -0
- synapse_sdk/devtools/docs/README.md +41 -0
- synapse_sdk/devtools/docs/blog/2019-05-28-first-blog-post.md +12 -0
- synapse_sdk/devtools/docs/blog/2019-05-29-long-blog-post.md +44 -0
- synapse_sdk/devtools/docs/blog/2021-08-01-mdx-blog-post.mdx +24 -0
- synapse_sdk/devtools/docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
- synapse_sdk/devtools/docs/blog/2021-08-26-welcome/index.md +29 -0
- synapse_sdk/devtools/docs/blog/authors.yml +25 -0
- synapse_sdk/devtools/docs/blog/tags.yml +19 -0
- synapse_sdk/devtools/docs/docs/api/clients/agent.md +43 -0
- synapse_sdk/devtools/docs/docs/api/clients/annotation-mixin.md +378 -0
- synapse_sdk/devtools/docs/docs/api/clients/backend.md +420 -0
- synapse_sdk/devtools/docs/docs/api/clients/base.md +257 -0
- synapse_sdk/devtools/docs/docs/api/clients/core-mixin.md +477 -0
- synapse_sdk/devtools/docs/docs/api/clients/data-collection-mixin.md +422 -0
- synapse_sdk/devtools/docs/docs/api/clients/hitl-mixin.md +554 -0
- synapse_sdk/devtools/docs/docs/api/clients/index.md +391 -0
- synapse_sdk/devtools/docs/docs/api/clients/integration-mixin.md +571 -0
- synapse_sdk/devtools/docs/docs/api/clients/ml-mixin.md +578 -0
- synapse_sdk/devtools/docs/docs/api/clients/ray.md +342 -0
- synapse_sdk/devtools/docs/docs/api/index.md +52 -0
- synapse_sdk/devtools/docs/docs/api/plugins/categories.md +43 -0
- synapse_sdk/devtools/docs/docs/api/plugins/models.md +114 -0
- synapse_sdk/devtools/docs/docs/api/plugins/utils.md +328 -0
- synapse_sdk/devtools/docs/docs/categories.md +0 -0
- synapse_sdk/devtools/docs/docs/cli-usage.md +280 -0
- synapse_sdk/devtools/docs/docs/concepts/index.md +38 -0
- synapse_sdk/devtools/docs/docs/configuration.md +83 -0
- synapse_sdk/devtools/docs/docs/contributing.md +306 -0
- synapse_sdk/devtools/docs/docs/examples/index.md +29 -0
- synapse_sdk/devtools/docs/docs/faq.md +179 -0
- synapse_sdk/devtools/docs/docs/features/converters/index.md +455 -0
- synapse_sdk/devtools/docs/docs/features/index.md +24 -0
- synapse_sdk/devtools/docs/docs/features/utils/file.md +415 -0
- synapse_sdk/devtools/docs/docs/features/utils/network.md +378 -0
- synapse_sdk/devtools/docs/docs/features/utils/storage.md +57 -0
- synapse_sdk/devtools/docs/docs/features/utils/types.md +51 -0
- synapse_sdk/devtools/docs/docs/installation.md +94 -0
- synapse_sdk/devtools/docs/docs/introduction.md +47 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/neural-net-plugins/train-action-overview.md +814 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-action.md +948 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-overview.md +544 -0
- synapse_sdk/devtools/docs/docs/plugins/categories/upload-plugins/upload-plugin-template.md +766 -0
- synapse_sdk/devtools/docs/docs/plugins/export-plugins.md +1092 -0
- synapse_sdk/devtools/docs/docs/plugins/plugins.md +852 -0
- synapse_sdk/devtools/docs/docs/quickstart.md +78 -0
- synapse_sdk/devtools/docs/docs/troubleshooting.md +519 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/_category_.json +8 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/congratulations.md +23 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-blog-post.md +34 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-document.md +57 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/create-a-page.md +43 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/deploy-your-site.md +31 -0
- synapse_sdk/devtools/docs/docs/tutorial-basics/markdown-features.mdx +152 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/_category_.json +7 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/img/docsVersionDropdown.png +0 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/img/localeDropdown.png +0 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/manage-docs-versions.md +55 -0
- synapse_sdk/devtools/docs/docs/tutorial-extras/translate-your-site.md +88 -0
- synapse_sdk/devtools/docs/docusaurus.config.ts +148 -0
- synapse_sdk/devtools/docs/i18n/ko/code.json +325 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/agent.md +43 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/annotation-mixin.md +289 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/backend.md +420 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/base.md +257 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/core-mixin.md +417 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/data-collection-mixin.md +356 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/hitl-mixin.md +192 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/index.md +391 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/integration-mixin.md +479 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ml-mixin.md +284 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ray.md +342 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/index.md +52 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/plugins/models.md +114 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/categories.md +0 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/cli-usage.md +280 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/concepts/index.md +38 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/configuration.md +83 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/contributing.md +306 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/examples/index.md +29 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/faq.md +179 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/converters/index.md +30 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/index.md +24 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/file.md +415 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/network.md +378 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/storage.md +60 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/features/utils/types.md +51 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/installation.md +94 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/introduction.md +47 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/neural-net-plugins/train-action-overview.md +815 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/pre-annotation-plugin-overview.md +198 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-action-development.md +1645 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-overview.md +717 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/pre-annotation-plugins/to-task-template-development.md +1380 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-action.md +948 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-overview.md +544 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/categories/upload-plugins/upload-plugin-template.md +766 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/export-plugins.md +1092 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/plugins.md +117 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/quickstart.md +78 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/troubleshooting.md +519 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current.json +34 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-theme-classic/footer.json +42 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-theme-classic/navbar.json +18 -0
- synapse_sdk/devtools/docs/package-lock.json +18784 -0
- synapse_sdk/devtools/docs/package.json +48 -0
- synapse_sdk/devtools/docs/sidebars.ts +122 -0
- synapse_sdk/devtools/docs/src/components/HomepageFeatures/index.tsx +71 -0
- synapse_sdk/devtools/docs/src/components/HomepageFeatures/styles.module.css +11 -0
- synapse_sdk/devtools/docs/src/css/custom.css +30 -0
- synapse_sdk/devtools/docs/src/pages/index.module.css +23 -0
- synapse_sdk/devtools/docs/src/pages/index.tsx +21 -0
- synapse_sdk/devtools/docs/src/pages/markdown-page.md +7 -0
- synapse_sdk/devtools/docs/static/.nojekyll +0 -0
- synapse_sdk/devtools/docs/static/img/docusaurus-social-card.jpg +0 -0
- synapse_sdk/devtools/docs/static/img/docusaurus.png +0 -0
- synapse_sdk/devtools/docs/static/img/favicon.ico +0 -0
- synapse_sdk/devtools/docs/static/img/logo.png +0 -0
- synapse_sdk/devtools/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
- synapse_sdk/devtools/docs/static/img/undraw_docusaurus_react.svg +170 -0
- synapse_sdk/devtools/docs/static/img/undraw_docusaurus_tree.svg +40 -0
- synapse_sdk/devtools/docs/tsconfig.json +8 -0
- synapse_sdk/devtools/server.py +41 -0
- synapse_sdk/devtools/streamlit_app/__init__.py +5 -0
- synapse_sdk/devtools/streamlit_app/app.py +128 -0
- synapse_sdk/devtools/streamlit_app/services/__init__.py +11 -0
- synapse_sdk/devtools/streamlit_app/services/job_service.py +233 -0
- synapse_sdk/devtools/streamlit_app/services/plugin_service.py +236 -0
- synapse_sdk/devtools/streamlit_app/services/serve_service.py +95 -0
- synapse_sdk/devtools/streamlit_app/ui/__init__.py +15 -0
- synapse_sdk/devtools/streamlit_app/ui/config_tab.py +76 -0
- synapse_sdk/devtools/streamlit_app/ui/deployment_tab.py +66 -0
- synapse_sdk/devtools/streamlit_app/ui/http_tab.py +125 -0
- synapse_sdk/devtools/streamlit_app/ui/jobs_tab.py +573 -0
- synapse_sdk/devtools/streamlit_app/ui/serve_tab.py +346 -0
- synapse_sdk/devtools/streamlit_app/ui/status_bar.py +118 -0
- synapse_sdk/devtools/streamlit_app/utils/__init__.py +40 -0
- synapse_sdk/devtools/streamlit_app/utils/json_viewer.py +197 -0
- synapse_sdk/devtools/streamlit_app/utils/log_formatter.py +38 -0
- synapse_sdk/devtools/streamlit_app/utils/styles.py +241 -0
- synapse_sdk/devtools/streamlit_app/utils/ui_components.py +289 -0
- synapse_sdk/devtools/streamlit_app.py +10 -0
- synapse_sdk/loggers.py +74 -9
- synapse_sdk/plugins/README.md +1340 -0
- synapse_sdk/plugins/__init__.py +0 -13
- synapse_sdk/plugins/categories/base.py +145 -30
- synapse_sdk/plugins/categories/data_validation/actions/validation.py +72 -0
- synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py +33 -5
- synapse_sdk/plugins/categories/export/actions/__init__.py +3 -0
- synapse_sdk/plugins/categories/export/actions/export/__init__.py +28 -0
- synapse_sdk/plugins/categories/export/actions/export/action.py +165 -0
- synapse_sdk/plugins/categories/export/actions/export/enums.py +113 -0
- synapse_sdk/plugins/categories/export/actions/export/exceptions.py +53 -0
- synapse_sdk/plugins/categories/export/actions/export/models.py +74 -0
- synapse_sdk/plugins/categories/export/actions/export/run.py +195 -0
- synapse_sdk/plugins/categories/export/actions/export/utils.py +187 -0
- synapse_sdk/plugins/categories/export/templates/config.yaml +21 -0
- synapse_sdk/plugins/categories/export/templates/plugin/__init__.py +390 -0
- synapse_sdk/plugins/categories/export/templates/plugin/export.py +160 -0
- synapse_sdk/plugins/categories/neural_net/actions/deployment.py +29 -14
- synapse_sdk/plugins/categories/neural_net/actions/inference.py +13 -1
- synapse_sdk/plugins/categories/neural_net/actions/train.py +1084 -38
- synapse_sdk/plugins/categories/neural_net/actions/tune.py +534 -0
- synapse_sdk/plugins/categories/neural_net/base/__init__.py +0 -0
- synapse_sdk/plugins/categories/neural_net/base/inference.py +37 -0
- synapse_sdk/plugins/categories/neural_net/templates/config.yaml +30 -5
- synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py +26 -10
- synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py +4 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/__init__.py +3 -0
- synapse_sdk/plugins/categories/{export/actions/export.py → pre_annotation/actions/pre_annotation/action.py} +4 -4
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/__init__.py +28 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/action.py +145 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/enums.py +269 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/exceptions.py +14 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/factory.py +76 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/models.py +97 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/orchestrator.py +250 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/run.py +64 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/__init__.py +17 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/annotation.py +287 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/base.py +170 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/extraction.py +83 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/metrics.py +87 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/preprocessor.py +127 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/validation.py +143 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task.py +966 -0
- synapse_sdk/plugins/categories/pre_annotation/templates/config.yaml +19 -0
- synapse_sdk/plugins/categories/pre_annotation/templates/plugin/to_task.py +40 -0
- synapse_sdk/plugins/categories/smart_tool/templates/config.yaml +5 -2
- synapse_sdk/plugins/categories/upload/__init__.py +0 -0
- synapse_sdk/plugins/categories/upload/actions/__init__.py +0 -0
- synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +19 -0
- synapse_sdk/plugins/categories/upload/actions/upload/action.py +232 -0
- synapse_sdk/plugins/categories/upload/actions/upload/context.py +185 -0
- synapse_sdk/plugins/categories/upload/actions/upload/enums.py +471 -0
- synapse_sdk/plugins/categories/upload/actions/upload/exceptions.py +36 -0
- synapse_sdk/plugins/categories/upload/actions/upload/factory.py +138 -0
- synapse_sdk/plugins/categories/upload/actions/upload/models.py +203 -0
- synapse_sdk/plugins/categories/upload/actions/upload/orchestrator.py +183 -0
- synapse_sdk/plugins/categories/upload/actions/upload/registry.py +113 -0
- synapse_sdk/plugins/categories/upload/actions/upload/run.py +179 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/base.py +107 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +62 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/collection.py +63 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/generate.py +84 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/initialize.py +82 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +235 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +203 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/upload.py +97 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/validate.py +71 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/base.py +82 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/batch.py +39 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/single.py +29 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/flat.py +258 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/recursive.py +281 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/excel.py +174 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/none.py +16 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/sync.py +84 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/default.py +60 -0
- synapse_sdk/plugins/categories/upload/actions/upload/utils.py +250 -0
- synapse_sdk/plugins/categories/upload/templates/README.md +470 -0
- synapse_sdk/plugins/categories/upload/templates/config.yaml +33 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/__init__.py +294 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/upload.py +102 -0
- synapse_sdk/plugins/enums.py +3 -1
- synapse_sdk/plugins/models.py +140 -16
- synapse_sdk/plugins/templates/plugin-config-schema.json +406 -0
- synapse_sdk/plugins/templates/schema.json +491 -0
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/config.yaml +1 -0
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/requirements.txt +1 -1
- synapse_sdk/plugins/utils/__init__.py +46 -0
- synapse_sdk/plugins/utils/actions.py +119 -0
- synapse_sdk/plugins/utils/config.py +203 -0
- synapse_sdk/plugins/utils/legacy.py +95 -0
- synapse_sdk/plugins/utils/ray_gcs.py +66 -0
- synapse_sdk/plugins/utils/registry.py +58 -0
- synapse_sdk/shared/__init__.py +25 -0
- synapse_sdk/shared/enums.py +93 -0
- synapse_sdk/types.py +19 -0
- synapse_sdk/utils/converters/__init__.py +240 -0
- synapse_sdk/utils/converters/coco/__init__.py +0 -0
- synapse_sdk/utils/converters/coco/from_dm.py +322 -0
- synapse_sdk/utils/converters/coco/to_dm.py +215 -0
- synapse_sdk/utils/converters/dm/__init__.py +56 -0
- synapse_sdk/utils/converters/dm/from_v1.py +627 -0
- synapse_sdk/utils/converters/dm/to_v1.py +367 -0
- synapse_sdk/utils/converters/pascal/__init__.py +0 -0
- synapse_sdk/utils/converters/pascal/from_dm.py +244 -0
- synapse_sdk/utils/converters/pascal/to_dm.py +214 -0
- synapse_sdk/utils/converters/yolo/__init__.py +0 -0
- synapse_sdk/utils/converters/yolo/from_dm.py +384 -0
- synapse_sdk/utils/converters/yolo/to_dm.py +267 -0
- synapse_sdk/utils/dataset.py +46 -0
- synapse_sdk/utils/encryption.py +158 -0
- synapse_sdk/utils/file/__init__.py +39 -0
- synapse_sdk/utils/file/archive.py +32 -0
- synapse_sdk/utils/file/checksum.py +56 -0
- synapse_sdk/utils/file/chunking.py +31 -0
- synapse_sdk/utils/file/download.py +385 -0
- synapse_sdk/utils/file/encoding.py +40 -0
- synapse_sdk/utils/file/io.py +22 -0
- synapse_sdk/utils/file/video/__init__.py +29 -0
- synapse_sdk/utils/file/video/transcode.py +307 -0
- synapse_sdk/utils/file.py.backup +301 -0
- synapse_sdk/utils/http.py +138 -0
- synapse_sdk/utils/network.py +309 -0
- synapse_sdk/utils/storage/__init__.py +72 -0
- synapse_sdk/utils/storage/providers/__init__.py +183 -0
- synapse_sdk/utils/storage/providers/file_system.py +134 -0
- synapse_sdk/utils/storage/providers/gcp.py +13 -0
- synapse_sdk/utils/storage/providers/http.py +190 -0
- synapse_sdk/utils/storage/providers/s3.py +91 -0
- synapse_sdk/utils/storage/providers/sftp.py +47 -0
- synapse_sdk/utils/storage/registry.py +17 -0
- synapse_sdk-2025.11.7.dist-info/METADATA +122 -0
- synapse_sdk-2025.11.7.dist-info/RECORD +386 -0
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-2025.11.7.dist-info}/WHEEL +1 -1
- synapse_sdk/clients/backend/dataset.py +0 -51
- synapse_sdk/plugins/categories/import/actions/import.py +0 -10
- synapse_sdk/plugins/cli/__init__.py +0 -21
- synapse_sdk/plugins/cli/publish.py +0 -37
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env +0 -24
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env.dist +0 -24
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/main.py +0 -4
- synapse_sdk/plugins/utils.py +0 -50
- synapse_sdk/utils/file.py +0 -87
- synapse_sdk/utils/storage.py +0 -91
- synapse_sdk-1.0.0a13.dist-info/METADATA +0 -43
- synapse_sdk-1.0.0a13.dist-info/RECORD +0 -111
- /synapse_sdk/{plugins/categories/import → clients/validators}/__init__.py +0 -0
- /synapse_sdk/{plugins/categories/import/actions → devtools}/__init__.py +0 -0
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-2025.11.7.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-2025.11.7.dist-info/licenses}/LICENSE +0 -0
- {synapse_sdk-1.0.0a13.dist-info → synapse_sdk-2025.11.7.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: plugins
|
|
3
|
+
title: Plugin System
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plugin System
|
|
8
|
+
|
|
9
|
+
The Synapse SDK provides a comprehensive plugin system for building and managing ML plugins across different categories and execution methods. The plugin system enables modular, reusable components that can be distributed and executed in various environments.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
The plugin system is built around the concept of **actions** - discrete operations that can be packaged, distributed, and executed in different contexts. Each plugin belongs to a specific category and can support multiple actions.
|
|
14
|
+
|
|
15
|
+
### Key Features
|
|
16
|
+
|
|
17
|
+
- **🔌 Modular Architecture**: Plugins are self-contained with their own dependencies and configuration
|
|
18
|
+
- **⚡ Multiple Execution Methods**: Support for Jobs, Tasks, and REST API endpoints
|
|
19
|
+
- **📦 Distributed Execution**: Built for scalable, distributed computing
|
|
20
|
+
- **🛠️ Template System**: Cookiecutter-based scaffolding for rapid plugin development
|
|
21
|
+
- **📊 Progress Tracking**: Built-in logging, metrics, and progress monitoring
|
|
22
|
+
- **🔄 Dynamic Loading**: Runtime plugin discovery and registration
|
|
23
|
+
|
|
24
|
+
## Plugin Categories
|
|
25
|
+
|
|
26
|
+
The SDK organizes plugins into specific categories, each designed for different aspects of ML workflows:
|
|
27
|
+
|
|
28
|
+
### 1. Neural Networks (`neural_net`)
|
|
29
|
+
|
|
30
|
+
ML model training, inference, and deployment operations.
|
|
31
|
+
|
|
32
|
+
**Available Actions:**
|
|
33
|
+
|
|
34
|
+
- `deployment` - Deploy models to production environments
|
|
35
|
+
- `gradio` - Create interactive web interfaces for models
|
|
36
|
+
- `inference` - Run model predictions on data
|
|
37
|
+
- `test` - Validate model performance and accuracy
|
|
38
|
+
- `train` - Train ML models with custom datasets
|
|
39
|
+
- `tune` - Hyperparameter optimization and model tuning
|
|
40
|
+
|
|
41
|
+
**Use Cases:**
|
|
42
|
+
|
|
43
|
+
- Training computer vision models
|
|
44
|
+
- Deploying models as web services
|
|
45
|
+
- Running batch inference on datasets
|
|
46
|
+
- Creating interactive model demos
|
|
47
|
+
|
|
48
|
+
### 2. Export (`export`)
|
|
49
|
+
|
|
50
|
+
Data export and transformation operations for exporting annotated data, ground truth datasets, assignments, and tasks from the Synapse platform.
|
|
51
|
+
|
|
52
|
+
**Available Actions:**
|
|
53
|
+
|
|
54
|
+
- `export` - Export data from various sources (assignments, ground truth, tasks) with customizable processing
|
|
55
|
+
|
|
56
|
+
**Use Cases:**
|
|
57
|
+
|
|
58
|
+
- Exporting annotated datasets for training
|
|
59
|
+
- Converting ground truth data to custom formats
|
|
60
|
+
- Creating data packages for distribution
|
|
61
|
+
- Batch processing of assignment results
|
|
62
|
+
- Transforming annotation data for external tools
|
|
63
|
+
|
|
64
|
+
**Supported Export Targets:**
|
|
65
|
+
|
|
66
|
+
- `assignment` - Export assignment data with annotations
|
|
67
|
+
- `ground_truth` - Export ground truth dataset versions
|
|
68
|
+
- `task` - Export task data with associated annotations
|
|
69
|
+
|
|
70
|
+
For detailed information about export plugins, BaseExporter class architecture, implementation examples, and best practices, see the [Export Plugins](./export-plugins) documentation.
|
|
71
|
+
|
|
72
|
+
### 3. Upload (`upload`)
|
|
73
|
+
|
|
74
|
+
File and data upload functionality with support for various storage backends and flexible asset path configuration.
|
|
75
|
+
|
|
76
|
+
**Available Actions:**
|
|
77
|
+
|
|
78
|
+
- `upload` - Upload files to storage providers with multi-path mode support
|
|
79
|
+
|
|
80
|
+
**Use Cases:**
|
|
81
|
+
|
|
82
|
+
- Uploading datasets from multiple locations with individual path settings
|
|
83
|
+
- Organizing complex multi-asset datasets with per-asset recursive discovery
|
|
84
|
+
- Processing datasets with Excel metadata integration
|
|
85
|
+
- Handling large-scale uploads with batch processing and progress tracking
|
|
86
|
+
|
|
87
|
+
**📖 Upload Plugin Documentation:**
|
|
88
|
+
|
|
89
|
+
- **[Upload Plugin Overview](./categories/upload-plugins/upload-plugin-overview.md)** - User guide with configuration examples and usage
|
|
90
|
+
- **[BaseUploader Template Guide](./categories/upload-plugins/upload-plugin-template.md)** - Plugin development guide using BaseUploader template
|
|
91
|
+
- **[Upload Action Development](./categories/upload-plugins/upload-plugin-action.md)** - SDK developer guide for action architecture and internals
|
|
92
|
+
|
|
93
|
+
### 4. Smart Tools (`smart_tool`)
|
|
94
|
+
|
|
95
|
+
Intelligent automation tools powered by AI.
|
|
96
|
+
|
|
97
|
+
**Available Actions:**
|
|
98
|
+
|
|
99
|
+
- `auto_label` - Automated data labeling and annotation
|
|
100
|
+
|
|
101
|
+
**Use Cases:**
|
|
102
|
+
|
|
103
|
+
- Pre-labeling datasets with AI models
|
|
104
|
+
- Quality assurance for manual annotations
|
|
105
|
+
- Accelerating annotation workflows
|
|
106
|
+
|
|
107
|
+
### 5. Pre-annotation (`pre_annotation`)
|
|
108
|
+
|
|
109
|
+
Data preparation and processing before annotation.
|
|
110
|
+
|
|
111
|
+
**Available Actions:**
|
|
112
|
+
|
|
113
|
+
- `pre_annotation` - Prepare data for annotation workflows
|
|
114
|
+
- `to_task` - Convert data to annotation tasks
|
|
115
|
+
|
|
116
|
+
**Use Cases:**
|
|
117
|
+
|
|
118
|
+
- Data preprocessing and filtering
|
|
119
|
+
- Creating annotation tasks from raw data
|
|
120
|
+
- Setting up annotation workflows
|
|
121
|
+
|
|
122
|
+
### 6. Post-annotation (`post_annotation`)
|
|
123
|
+
|
|
124
|
+
Data processing and validation after annotation.
|
|
125
|
+
|
|
126
|
+
**Available Actions:**
|
|
127
|
+
|
|
128
|
+
- `post_annotation` - Process completed annotations
|
|
129
|
+
|
|
130
|
+
**Use Cases:**
|
|
131
|
+
|
|
132
|
+
- Validating annotation quality
|
|
133
|
+
- Post-processing annotated data
|
|
134
|
+
- Generating training datasets from annotations
|
|
135
|
+
|
|
136
|
+
### 7. Data Validation (`data_validation`)
|
|
137
|
+
|
|
138
|
+
Data quality checks and validation operations.
|
|
139
|
+
|
|
140
|
+
**Available Actions:**
|
|
141
|
+
|
|
142
|
+
- `validation` - Perform data quality and integrity checks
|
|
143
|
+
|
|
144
|
+
**Use Cases:**
|
|
145
|
+
|
|
146
|
+
- Validating dataset integrity
|
|
147
|
+
- Checking annotation consistency
|
|
148
|
+
- Quality assurance workflows
|
|
149
|
+
|
|
150
|
+
## Execution Methods
|
|
151
|
+
|
|
152
|
+
Plugins support three different execution methods depending on the use case:
|
|
153
|
+
|
|
154
|
+
### Job Execution
|
|
155
|
+
|
|
156
|
+
**Job-based execution** for long-running, distributed processing tasks.
|
|
157
|
+
|
|
158
|
+
- Best for: Training models, processing large datasets
|
|
159
|
+
- Features: Distributed execution, resource management, fault tolerance
|
|
160
|
+
- Monitoring: Full job lifecycle tracking and logging
|
|
161
|
+
|
|
162
|
+
### Task Execution
|
|
163
|
+
|
|
164
|
+
**Task-based execution** for simple, short-running operations.
|
|
165
|
+
|
|
166
|
+
- Best for: Quick data processing, validation checks
|
|
167
|
+
- Features: Lightweight execution, fast startup
|
|
168
|
+
- Monitoring: Basic progress tracking
|
|
169
|
+
|
|
170
|
+
### REST API Execution
|
|
171
|
+
|
|
172
|
+
**Serve-based execution** for web API endpoints.
|
|
173
|
+
|
|
174
|
+
- Best for: Real-time inference, interactive applications
|
|
175
|
+
- Features: HTTP endpoints, auto-scaling, load balancing
|
|
176
|
+
- Monitoring: Request/response logging, performance metrics
|
|
177
|
+
|
|
178
|
+
## Plugin Architecture
|
|
179
|
+
|
|
180
|
+
### Core Components
|
|
181
|
+
|
|
182
|
+
#### Plugin Models
|
|
183
|
+
|
|
184
|
+
**PluginRelease Class** (`synapse_sdk/plugins/models.py:14`)
|
|
185
|
+
|
|
186
|
+
- Manages plugin metadata and configuration
|
|
187
|
+
- Handles versioning and checksums
|
|
188
|
+
- Provides runtime environment setup
|
|
189
|
+
|
|
190
|
+
**Run Class** (`synapse_sdk/plugins/models.py:98`)
|
|
191
|
+
|
|
192
|
+
- Manages plugin execution instances
|
|
193
|
+
- Provides logging and progress tracking
|
|
194
|
+
- Handles backend communication
|
|
195
|
+
|
|
196
|
+
#### Action Base Class
|
|
197
|
+
|
|
198
|
+
**Action Class** (`synapse_sdk/plugins/categories/base.py:19`)
|
|
199
|
+
|
|
200
|
+
- Unified interface for all plugin actions
|
|
201
|
+
- Parameter validation with Pydantic models
|
|
202
|
+
- Built-in logging and error handling
|
|
203
|
+
- Runtime environment management
|
|
204
|
+
|
|
205
|
+
#### Template System
|
|
206
|
+
|
|
207
|
+
**Cookiecutter Templates** (`synapse_sdk/plugins/templates/`)
|
|
208
|
+
|
|
209
|
+
- Standardized plugin scaffolding
|
|
210
|
+
- Category-specific templates
|
|
211
|
+
- Automated project setup with proper structure
|
|
212
|
+
|
|
213
|
+
### Plugin Structure
|
|
214
|
+
|
|
215
|
+
Each plugin follows a standardized structure:
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
synapse-{plugin-code}-plugin/
|
|
219
|
+
├── config.yaml # Plugin metadata and configuration
|
|
220
|
+
├── plugin/ # Source code directory
|
|
221
|
+
│ ├── __init__.py
|
|
222
|
+
│ ├── {action1}.py # Action implementations
|
|
223
|
+
│ └── {action2}.py
|
|
224
|
+
├── requirements.txt # Python dependencies
|
|
225
|
+
├── pyproject.toml # Package configuration
|
|
226
|
+
└── README.md # Plugin documentation
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Configuration File (`config.yaml`)
|
|
230
|
+
|
|
231
|
+
```yaml
|
|
232
|
+
# Plugin metadata
|
|
233
|
+
code: "my-plugin"
|
|
234
|
+
name: "My Custom Plugin"
|
|
235
|
+
version: "1.0.0"
|
|
236
|
+
category: "neural_net"
|
|
237
|
+
description: "A custom ML plugin"
|
|
238
|
+
|
|
239
|
+
# Package management
|
|
240
|
+
package_manager: "pip" # or "uv"
|
|
241
|
+
|
|
242
|
+
# Package manager options (optional)
|
|
243
|
+
# For uv: defaults to ['--no-cache']
|
|
244
|
+
# For pip: defaults to ['--upgrade'] to ensure requirements.txt versions override pre-installed packages
|
|
245
|
+
package_manager_options: ["--no-cache", "--quiet"]
|
|
246
|
+
|
|
247
|
+
# Action definitions
|
|
248
|
+
actions:
|
|
249
|
+
train:
|
|
250
|
+
entrypoint: "plugin.train.TrainAction"
|
|
251
|
+
method: "job"
|
|
252
|
+
inference:
|
|
253
|
+
entrypoint: "plugin.inference.InferenceAction"
|
|
254
|
+
method: "restapi"
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Creating Plugins
|
|
258
|
+
|
|
259
|
+
### 1. Generate Plugin Template
|
|
260
|
+
|
|
261
|
+
Use the CLI to create a new plugin from templates:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
synapse plugin create
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
This will prompt for:
|
|
268
|
+
|
|
269
|
+
- Plugin code (unique identifier)
|
|
270
|
+
- Plugin name and description
|
|
271
|
+
- Category selection
|
|
272
|
+
- Required actions
|
|
273
|
+
|
|
274
|
+
### 2. Implement Actions
|
|
275
|
+
|
|
276
|
+
Each action inherits from the base `Action` class:
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
# plugin/train.py
|
|
280
|
+
from synapse_sdk.plugins.categories.neural_net import TrainAction as BaseTrainAction
|
|
281
|
+
from pydantic import BaseModel
|
|
282
|
+
|
|
283
|
+
class TrainParams(BaseModel):
|
|
284
|
+
dataset_path: str
|
|
285
|
+
epochs: int = 10
|
|
286
|
+
learning_rate: float = 0.001
|
|
287
|
+
|
|
288
|
+
class TrainAction(BaseTrainAction):
|
|
289
|
+
name = "train"
|
|
290
|
+
params_model = TrainParams
|
|
291
|
+
|
|
292
|
+
def start(self):
|
|
293
|
+
# Access validated parameters
|
|
294
|
+
dataset_path = self.params['dataset_path']
|
|
295
|
+
epochs = self.params['epochs']
|
|
296
|
+
|
|
297
|
+
# Log progress
|
|
298
|
+
self.run.log_message("Starting training...")
|
|
299
|
+
|
|
300
|
+
# Your training logic here
|
|
301
|
+
for epoch in range(epochs):
|
|
302
|
+
# Update progress
|
|
303
|
+
self.run.set_progress(epoch + 1, epochs, "training")
|
|
304
|
+
|
|
305
|
+
# Training step
|
|
306
|
+
loss = train_epoch(dataset_path)
|
|
307
|
+
|
|
308
|
+
# Log metrics
|
|
309
|
+
self.run.set_metrics({"loss": loss}, "training")
|
|
310
|
+
|
|
311
|
+
self.run.log_message("Training completed!")
|
|
312
|
+
return {"status": "success", "final_loss": loss}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### Creating Export Plugins
|
|
316
|
+
|
|
317
|
+
Export plugins now use the BaseExporter class-based approach for better organization and reusability. Here's how to create a custom export plugin:
|
|
318
|
+
|
|
319
|
+
**Step 1: Generate Export Plugin Template**
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
synapse plugin create
|
|
323
|
+
# Select 'export' as category
|
|
324
|
+
# Plugin will be created with export template
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Step 2: Customize Export Parameters**
|
|
328
|
+
|
|
329
|
+
The `ExportParams` model defines the required parameters:
|
|
330
|
+
|
|
331
|
+
```python
|
|
332
|
+
from synapse_sdk.plugins.categories.export.actions.export import ExportParams
|
|
333
|
+
from pydantic import BaseModel
|
|
334
|
+
from typing import Literal
|
|
335
|
+
|
|
336
|
+
class CustomExportParams(ExportParams):
|
|
337
|
+
# Add custom parameters
|
|
338
|
+
output_format: Literal['json', 'csv', 'xml'] = 'json'
|
|
339
|
+
include_metadata: bool = True
|
|
340
|
+
compression: bool = False
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
**Step 3: Implement Data Transformation**
|
|
344
|
+
|
|
345
|
+
Implement the required methods in your `Exporter` class in `plugin/export.py`:
|
|
346
|
+
|
|
347
|
+
```python
|
|
348
|
+
from datetime import datetime
|
|
349
|
+
from synapse_sdk.plugins.categories.export.templates.plugin import BaseExporter
|
|
350
|
+
|
|
351
|
+
class Exporter(BaseExporter):
|
|
352
|
+
"""Custom export plugin with COCO format conversion."""
|
|
353
|
+
|
|
354
|
+
def convert_data(self, data):
|
|
355
|
+
"""Convert annotation data to your desired format."""
|
|
356
|
+
# Example: Convert to COCO format
|
|
357
|
+
if data.get('data_type') == 'image_detection':
|
|
358
|
+
return self.convert_to_coco_format(data)
|
|
359
|
+
elif data.get('data_type') == 'image_classification':
|
|
360
|
+
return self.convert_to_classification_format(data)
|
|
361
|
+
return data
|
|
362
|
+
|
|
363
|
+
def before_convert(self, export_item):
|
|
364
|
+
"""Preprocess data before conversion."""
|
|
365
|
+
# Add validation, filtering, or preprocessing
|
|
366
|
+
if not export_item.get('data'):
|
|
367
|
+
return None # Skip empty items
|
|
368
|
+
|
|
369
|
+
# Add custom metadata
|
|
370
|
+
export_item['processed_at'] = datetime.now().isoformat()
|
|
371
|
+
return export_item
|
|
372
|
+
|
|
373
|
+
def after_convert(self, converted_data):
|
|
374
|
+
"""Post-process converted data."""
|
|
375
|
+
# Add final touches, validation, or formatting
|
|
376
|
+
if 'annotations' in converted_data:
|
|
377
|
+
converted_data['annotation_count'] = len(converted_data['annotations'])
|
|
378
|
+
return converted_data
|
|
379
|
+
|
|
380
|
+
def convert_to_coco_format(self, data):
|
|
381
|
+
"""Example: Convert to COCO detection format."""
|
|
382
|
+
coco_data = {
|
|
383
|
+
"images": [],
|
|
384
|
+
"annotations": [],
|
|
385
|
+
"categories": []
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
# Transform annotation data to COCO format
|
|
389
|
+
for annotation in data.get('annotations', []):
|
|
390
|
+
coco_annotation = {
|
|
391
|
+
"id": annotation['id'],
|
|
392
|
+
"image_id": annotation['image_id'],
|
|
393
|
+
"category_id": annotation['category_id'],
|
|
394
|
+
"bbox": annotation['bbox'],
|
|
395
|
+
"area": annotation.get('area', 0),
|
|
396
|
+
"iscrowd": 0
|
|
397
|
+
}
|
|
398
|
+
coco_data["annotations"].append(coco_annotation)
|
|
399
|
+
|
|
400
|
+
return coco_data
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Step 4: Configure Export Targets**
|
|
404
|
+
|
|
405
|
+
The export action supports different data sources:
|
|
406
|
+
|
|
407
|
+
```python
|
|
408
|
+
# Filter examples for different targets
|
|
409
|
+
filters = {
|
|
410
|
+
# For ground truth export
|
|
411
|
+
"ground_truth": {
|
|
412
|
+
"ground_truth_dataset_version": 123,
|
|
413
|
+
"expand": ["data"]
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
# For assignment export
|
|
417
|
+
"assignment": {
|
|
418
|
+
"project": 456,
|
|
419
|
+
"status": "completed",
|
|
420
|
+
"expand": ["data"]
|
|
421
|
+
},
|
|
422
|
+
|
|
423
|
+
# For task export
|
|
424
|
+
"task": {
|
|
425
|
+
"project": 456,
|
|
426
|
+
"assignment": 789,
|
|
427
|
+
"expand": ["data_unit", "assignment"]
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
**Step 5: Handle File Operations**
|
|
433
|
+
|
|
434
|
+
Customize file saving and organization by overriding BaseExporter methods:
|
|
435
|
+
|
|
436
|
+
```python
|
|
437
|
+
import json
|
|
438
|
+
from pathlib import Path
|
|
439
|
+
from synapse_sdk.plugins.categories.export.enums import ExportStatus
|
|
440
|
+
|
|
441
|
+
class Exporter(BaseExporter):
|
|
442
|
+
"""Custom export plugin with multiple format support."""
|
|
443
|
+
|
|
444
|
+
def save_as_json(self, result, base_path, error_file_list):
|
|
445
|
+
"""Custom JSON saving with different formats."""
|
|
446
|
+
file_name = Path(self.get_original_file_name(result['files'])).stem
|
|
447
|
+
|
|
448
|
+
# Choose output format based on params
|
|
449
|
+
if self.params.get('output_format') == 'csv':
|
|
450
|
+
return self.save_as_csv(result, base_path, error_file_list)
|
|
451
|
+
elif self.params.get('output_format') == 'xml':
|
|
452
|
+
return self.save_as_xml(result, base_path, error_file_list)
|
|
453
|
+
|
|
454
|
+
# Default JSON handling
|
|
455
|
+
json_data = result['data']
|
|
456
|
+
file_info = {'file_name': f'{file_name}.json'}
|
|
457
|
+
|
|
458
|
+
try:
|
|
459
|
+
with (base_path / f'{file_name}.json').open('w', encoding='utf-8') as f:
|
|
460
|
+
json.dump(json_data, f, indent=4, ensure_ascii=False)
|
|
461
|
+
status = ExportStatus.SUCCESS
|
|
462
|
+
except Exception as e:
|
|
463
|
+
error_file_list.append([f'{file_name}.json', str(e)])
|
|
464
|
+
status = ExportStatus.FAILED
|
|
465
|
+
|
|
466
|
+
self.run.export_log_json_file(result['id'], file_info, status)
|
|
467
|
+
return status
|
|
468
|
+
|
|
469
|
+
def setup_output_directories(self, unique_export_path, save_original_file_flag):
|
|
470
|
+
"""Custom directory structure."""
|
|
471
|
+
# Create format-specific directories
|
|
472
|
+
output_paths = super().setup_output_directories(unique_export_path, save_original_file_flag)
|
|
473
|
+
|
|
474
|
+
# Add custom directories based on output format
|
|
475
|
+
format_dir = unique_export_path / self.params.get('output_format', 'json')
|
|
476
|
+
format_dir.mkdir(parents=True, exist_ok=True)
|
|
477
|
+
output_paths['format_output_path'] = format_dir
|
|
478
|
+
|
|
479
|
+
return output_paths
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
**Step 6: Usage Examples**
|
|
483
|
+
|
|
484
|
+
Running export plugins with different configurations:
|
|
485
|
+
|
|
486
|
+
```bash
|
|
487
|
+
# Basic export of ground truth data
|
|
488
|
+
synapse plugin run export '{
|
|
489
|
+
"name": "my_export",
|
|
490
|
+
"storage": 1,
|
|
491
|
+
"target": "ground_truth",
|
|
492
|
+
"filter": {"ground_truth_dataset_version": 123},
|
|
493
|
+
"path": "exports/ground_truth",
|
|
494
|
+
"save_original_file": true
|
|
495
|
+
}' --plugin my-export-plugin
|
|
496
|
+
|
|
497
|
+
# Export assignments with custom parameters
|
|
498
|
+
synapse plugin run export '{
|
|
499
|
+
"name": "assignment_export",
|
|
500
|
+
"storage": 1,
|
|
501
|
+
"target": "assignment",
|
|
502
|
+
"filter": {"project": 456, "status": "completed"},
|
|
503
|
+
"path": "exports/assignments",
|
|
504
|
+
"save_original_file": false,
|
|
505
|
+
"extra_params": {
|
|
506
|
+
"output_format": "coco",
|
|
507
|
+
"include_metadata": true
|
|
508
|
+
}
|
|
509
|
+
}' --plugin custom-coco-export
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**Common Export Patterns:**
|
|
513
|
+
|
|
514
|
+
```python
|
|
515
|
+
# Pattern 1: Format-specific conversion
|
|
516
|
+
class Exporter(BaseExporter):
|
|
517
|
+
def convert_data(self, data):
|
|
518
|
+
"""Convert to YOLO format."""
|
|
519
|
+
if data.get('task_type') == 'object_detection':
|
|
520
|
+
return self.convert_to_yolo_format(data)
|
|
521
|
+
return data
|
|
522
|
+
|
|
523
|
+
# Pattern 2: Conditional file organization
|
|
524
|
+
class Exporter(BaseExporter):
|
|
525
|
+
def setup_output_directories(self, unique_export_path, save_original_file_flag):
|
|
526
|
+
# Call parent method
|
|
527
|
+
output_paths = super().setup_output_directories(unique_export_path, save_original_file_flag)
|
|
528
|
+
|
|
529
|
+
# Create separate folders by category
|
|
530
|
+
for category in ['train', 'val', 'test']:
|
|
531
|
+
category_path = unique_export_path / category
|
|
532
|
+
category_path.mkdir(parents=True, exist_ok=True)
|
|
533
|
+
output_paths[f'{category}_path'] = category_path
|
|
534
|
+
|
|
535
|
+
return output_paths
|
|
536
|
+
|
|
537
|
+
# Pattern 3: Batch processing with validation
|
|
538
|
+
class Exporter(BaseExporter):
|
|
539
|
+
def before_convert(self, export_item):
|
|
540
|
+
# Validate required fields
|
|
541
|
+
required_fields = ['data', 'files', 'id']
|
|
542
|
+
for field in required_fields:
|
|
543
|
+
if field not in export_item:
|
|
544
|
+
raise ValueError(f"Missing required field: {field}")
|
|
545
|
+
return export_item
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### 3. Configure Actions
|
|
549
|
+
|
|
550
|
+
Define actions in `config.yaml`:
|
|
551
|
+
|
|
552
|
+
```yaml
|
|
553
|
+
actions:
|
|
554
|
+
train:
|
|
555
|
+
entrypoint: "plugin.train.TrainAction"
|
|
556
|
+
method: "job"
|
|
557
|
+
description: "Train a neural network model"
|
|
558
|
+
|
|
559
|
+
# Export plugin configuration
|
|
560
|
+
export:
|
|
561
|
+
entrypoint: "plugin.export.Exporter"
|
|
562
|
+
method: "job"
|
|
563
|
+
description: "Export and transform annotation data"
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### 4. Package and Publish
|
|
567
|
+
|
|
568
|
+
```bash
|
|
569
|
+
# Test locally
|
|
570
|
+
synapse plugin run train --debug
|
|
571
|
+
|
|
572
|
+
# Package for distribution
|
|
573
|
+
synapse plugin publish
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
## Running Plugins
|
|
577
|
+
|
|
578
|
+
### Command Line Interface
|
|
579
|
+
|
|
580
|
+
```bash
|
|
581
|
+
# Run a plugin action
|
|
582
|
+
synapse plugin run {action} {params}
|
|
583
|
+
|
|
584
|
+
# With specific plugin
|
|
585
|
+
synapse plugin run train '{"dataset_path": "/data/images", "epochs": 20}' --plugin my-plugin@1.0.0
|
|
586
|
+
|
|
587
|
+
# Debug mode (use local code)
|
|
588
|
+
synapse plugin run train '{"dataset_path": "/data/images"}' --debug
|
|
589
|
+
|
|
590
|
+
# Background job
|
|
591
|
+
synapse plugin run train '{"dataset_path": "/data/images"}' --job-id my-training-job
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Programmatic Usage
|
|
595
|
+
|
|
596
|
+
```python
|
|
597
|
+
from synapse_sdk.plugins.utils import get_action_class
|
|
598
|
+
|
|
599
|
+
# Get action class by category and name
|
|
600
|
+
ActionClass = get_action_class("neural_net", "train")
|
|
601
|
+
|
|
602
|
+
# Create and run action
|
|
603
|
+
action = ActionClass(
|
|
604
|
+
params={"dataset_path": "/data/images", "epochs": 10},
|
|
605
|
+
plugin_config=plugin_config,
|
|
606
|
+
envs=env_vars
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
result = action.run_action()
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
## Development Workflow
|
|
613
|
+
|
|
614
|
+
### 1. Local Development
|
|
615
|
+
|
|
616
|
+
```bash
|
|
617
|
+
# Create plugin
|
|
618
|
+
synapse plugin create
|
|
619
|
+
|
|
620
|
+
# Develop and test locally
|
|
621
|
+
cd synapse-my-plugin-plugin
|
|
622
|
+
synapse plugin run action-name --debug
|
|
623
|
+
|
|
624
|
+
# Use development server for REST APIs
|
|
625
|
+
synapse plugin run serve --debug
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### 2. Testing
|
|
629
|
+
|
|
630
|
+
```bash
|
|
631
|
+
# Run plugin tests
|
|
632
|
+
pytest plugin/test_*.py
|
|
633
|
+
|
|
634
|
+
# Integration testing with distributed computing
|
|
635
|
+
synapse plugin run action-name --debug --job-id test-job
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### 3. Deployment
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
# Package plugin
|
|
642
|
+
synapse plugin publish
|
|
643
|
+
|
|
644
|
+
# Deploy to cluster
|
|
645
|
+
synapse plugin run action-name --job-id production-job
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
## Advanced Features
|
|
649
|
+
|
|
650
|
+
### Custom Progress Categories
|
|
651
|
+
|
|
652
|
+
```python
|
|
653
|
+
class MyAction(Action):
|
|
654
|
+
progress_categories = {
|
|
655
|
+
"preprocessing": "Data preprocessing",
|
|
656
|
+
"training": "Model training",
|
|
657
|
+
"validation": "Model validation"
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
def start(self):
|
|
661
|
+
# Update different progress categories
|
|
662
|
+
self.run.set_progress(50, 100, "preprocessing")
|
|
663
|
+
self.run.set_progress(10, 50, "training")
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
### Custom Metrics
|
|
667
|
+
|
|
668
|
+
```python
|
|
669
|
+
def start(self):
|
|
670
|
+
# Log custom metrics
|
|
671
|
+
self.run.set_metrics({
|
|
672
|
+
"accuracy": 0.95,
|
|
673
|
+
"loss": 0.1,
|
|
674
|
+
"f1_score": 0.92
|
|
675
|
+
}, "validation")
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
### Runtime Environment Customization
|
|
679
|
+
|
|
680
|
+
```python
|
|
681
|
+
def get_runtime_env(self):
|
|
682
|
+
env = super().get_runtime_env()
|
|
683
|
+
|
|
684
|
+
# Add custom environment variables
|
|
685
|
+
env['env_vars']['CUSTOM_VAR'] = 'value'
|
|
686
|
+
|
|
687
|
+
# Add additional packages
|
|
688
|
+
env['pip']['packages'].append('custom-package==1.0.0')
|
|
689
|
+
|
|
690
|
+
return env
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
### Parameter Validation
|
|
694
|
+
|
|
695
|
+
```python
|
|
696
|
+
from pydantic import BaseModel, validator
|
|
697
|
+
from typing import Literal
|
|
698
|
+
|
|
699
|
+
class TrainParams(BaseModel):
|
|
700
|
+
model_type: Literal["cnn", "transformer", "resnet"]
|
|
701
|
+
dataset_path: str
|
|
702
|
+
batch_size: int = 32
|
|
703
|
+
|
|
704
|
+
@validator('batch_size')
|
|
705
|
+
def validate_batch_size(cls, v):
|
|
706
|
+
if v <= 0 or v > 512:
|
|
707
|
+
raise ValueError('Batch size must be between 1 and 512')
|
|
708
|
+
return v
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
## Best Practices
|
|
712
|
+
|
|
713
|
+
### 1. Plugin Design
|
|
714
|
+
|
|
715
|
+
- **Single Responsibility**: Each action should have a clear, focused purpose
|
|
716
|
+
- **Parameterization**: Make actions configurable through parameters
|
|
717
|
+
- **Error Handling**: Implement robust error handling and validation
|
|
718
|
+
- **Documentation**: Provide clear documentation and examples
|
|
719
|
+
|
|
720
|
+
### 2. Performance
|
|
721
|
+
|
|
722
|
+
- **Resource Management**: Use appropriate resource allocation for jobs
|
|
723
|
+
- **Progress Tracking**: Provide meaningful progress updates for long operations
|
|
724
|
+
- **Logging**: Log important events and errors for debugging
|
|
725
|
+
- **Memory Management**: Handle large datasets efficiently
|
|
726
|
+
|
|
727
|
+
### 3. Testing
|
|
728
|
+
|
|
729
|
+
- **Unit Tests**: Test individual action logic
|
|
730
|
+
- **Integration Tests**: Test with distributed execution environment
|
|
731
|
+
- **Parameter Validation**: Test edge cases and error conditions
|
|
732
|
+
- **Performance Tests**: Validate execution time and resource usage
|
|
733
|
+
|
|
734
|
+
### 4. Export Plugin Best Practices
|
|
735
|
+
|
|
736
|
+
#### Data Processing
|
|
737
|
+
|
|
738
|
+
- **Memory Efficiency**: Use generators for processing large datasets
|
|
739
|
+
- **Error Recovery**: Implement graceful error handling for individual items
|
|
740
|
+
- **Progress Reporting**: Update progress regularly for long-running exports
|
|
741
|
+
- **Data Validation**: Validate data structure before conversion
|
|
742
|
+
|
|
743
|
+
```python
|
|
744
|
+
class Exporter(BaseExporter):
|
|
745
|
+
def export(self, export_items=None, results=None, **kwargs):
|
|
746
|
+
"""Override the main export method for custom processing."""
|
|
747
|
+
# Use tee to count items without consuming generator
|
|
748
|
+
items_to_process = export_items if export_items is not None else self.export_items
|
|
749
|
+
export_items_count, export_items_process = tee(items_to_process)
|
|
750
|
+
total = sum(1 for _ in export_items_count)
|
|
751
|
+
|
|
752
|
+
# Custom processing with error handling
|
|
753
|
+
for no, export_item in enumerate(export_items_process, start=1):
|
|
754
|
+
try:
|
|
755
|
+
# Use the built-in data conversion pipeline
|
|
756
|
+
processed_item = self.process_data_conversion(export_item)
|
|
757
|
+
self.run.set_progress(no, total, category='dataset_conversion')
|
|
758
|
+
except Exception as e:
|
|
759
|
+
self.run.log_message(f"Error processing item {no}: {str(e)}", "ERROR")
|
|
760
|
+
continue
|
|
761
|
+
|
|
762
|
+
# Call parent's export method for standard processing
|
|
763
|
+
# or implement your own complete workflow
|
|
764
|
+
return super().export(export_items, results, **kwargs)
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
#### File Management
|
|
768
|
+
|
|
769
|
+
- **Unique Paths**: Prevent file collisions with timestamp or counter suffixes
|
|
770
|
+
- **Directory Structure**: Organize output files logically
|
|
771
|
+
- **Error Logging**: Track failed files for debugging
|
|
772
|
+
- **Cleanup**: Remove temporary files on completion
|
|
773
|
+
|
|
774
|
+
```python
|
|
775
|
+
class Exporter(BaseExporter):
|
|
776
|
+
def setup_output_directories(self, unique_export_path, save_original_file_flag):
|
|
777
|
+
"""Create unique export directory structure."""
|
|
778
|
+
# BaseExporter already handles unique path creation via _create_unique_export_path
|
|
779
|
+
# This method sets up the internal directory structure
|
|
780
|
+
output_paths = super().setup_output_directories(unique_export_path, save_original_file_flag)
|
|
781
|
+
|
|
782
|
+
# Add custom subdirectories as needed
|
|
783
|
+
custom_dir = unique_export_path / 'custom_output'
|
|
784
|
+
custom_dir.mkdir(parents=True, exist_ok=True)
|
|
785
|
+
output_paths['custom_output_path'] = custom_dir
|
|
786
|
+
|
|
787
|
+
return output_paths
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
#### Format Conversion
|
|
791
|
+
|
|
792
|
+
- **Flexible Templates**: Design templates that work with multiple data types
|
|
793
|
+
- **Schema Validation**: Validate output against expected schemas
|
|
794
|
+
- **Metadata Preservation**: Maintain important metadata during conversion
|
|
795
|
+
- **Version Compatibility**: Handle different data schema versions
|
|
796
|
+
|
|
797
|
+
### 5. Security
|
|
798
|
+
|
|
799
|
+
- **Input Validation**: Validate all parameters and inputs
|
|
800
|
+
- **File Access**: Restrict file system access appropriately
|
|
801
|
+
- **Dependencies**: Keep dependencies updated and secure
|
|
802
|
+
- **Secrets**: Never log sensitive information
|
|
803
|
+
|
|
804
|
+
## Monitoring and Debugging
|
|
805
|
+
|
|
806
|
+
### Plugin Execution Logs
|
|
807
|
+
|
|
808
|
+
```python
|
|
809
|
+
# In your action
|
|
810
|
+
self.run.log_message("Processing started", "INFO")
|
|
811
|
+
self.run.log_message("Warning: low memory", "WARNING")
|
|
812
|
+
self.run.log_message("Error occurred", "ERROR")
|
|
813
|
+
|
|
814
|
+
# With structured data
|
|
815
|
+
self.run.log("model_checkpoint", {
|
|
816
|
+
"epoch": 10,
|
|
817
|
+
"accuracy": 0.95,
|
|
818
|
+
"checkpoint_path": "/models/checkpoint_10.pth"
|
|
819
|
+
})
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
### Progress Monitoring
|
|
823
|
+
|
|
824
|
+
```python
|
|
825
|
+
# Simple progress
|
|
826
|
+
self.run.set_progress(current=50, total=100)
|
|
827
|
+
|
|
828
|
+
# Categorized progress
|
|
829
|
+
self.run.set_progress(current=30, total=100, category="training")
|
|
830
|
+
self.run.set_progress(current=20, total=50, category="validation")
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### Metrics Collection
|
|
834
|
+
|
|
835
|
+
```python
|
|
836
|
+
# Training metrics
|
|
837
|
+
self.run.set_metrics({
|
|
838
|
+
"epoch": 10,
|
|
839
|
+
"train_loss": 0.1,
|
|
840
|
+
"train_accuracy": 0.95,
|
|
841
|
+
"learning_rate": 0.001
|
|
842
|
+
}, "training")
|
|
843
|
+
|
|
844
|
+
# Performance metrics
|
|
845
|
+
self.run.set_metrics({
|
|
846
|
+
"inference_time": 0.05,
|
|
847
|
+
"throughput": 200,
|
|
848
|
+
"memory_usage": 1024
|
|
849
|
+
}, "performance")
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
The plugin system provides a powerful foundation for building scalable, distributed ML workflows. By following the established patterns and best practices, you can create robust plugins that integrate seamlessly with the Synapse ecosystem.
|