synapse-sdk 1.0.0a21__tar.gz → 1.0.0a23__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.
Potentially problematic release.
This version of synapse-sdk might be problematic. Click here for more details.
- {synapse_sdk-1.0.0a21/synapse_sdk.egg-info → synapse_sdk-1.0.0a23}/PKG-INFO +2 -1
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/pyproject.toml +1 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/requirements.txt +1 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/backend/__init__.py +8 -1
- synapse_sdk-1.0.0a23/synapse_sdk/clients/backend/core.py +32 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/backend/ml.py +3 -2
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/base.py +3 -1
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/actions/deployment.py +10 -2
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/actions/inference.py +13 -1
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/actions/train.py +2 -2
- synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/neural_net/base/inference.py +37 -0
- synapse_sdk-1.0.0a23/synapse_sdk/utils/pydantic/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23/synapse_sdk.egg-info}/PKG-INFO +2 -1
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk.egg-info/SOURCES.txt +3 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk.egg-info/requires.txt +1 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/.github/workflows/lint.yml +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/.github/workflows/pypi-publish.yml +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/.gitignore +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/.pre-commit-config.yaml +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/LICENSE +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/README.md +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/locale/en/LC_MESSAGES/messages.mo +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/locale/en/LC_MESSAGES/messages.po +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/locale/ko/LC_MESSAGES/messages.mo +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/locale/ko/LC_MESSAGES/messages.po +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/setup.cfg +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/cli/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/cli/create_plugin.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/agent/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/agent/core.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/agent/ray.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/agent/service.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/backend/annotation.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/backend/dataset.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/backend/integration.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/exceptions.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/ray/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/ray/core.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/ray/serve.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/clients/utils.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/i18n.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/loggers.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/base.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/data_validation/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/data_validation/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/data_validation/actions/validation.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/data_validation/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/data_validation/templates/plugin/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/decorators.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/export/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/export/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/export/actions/export.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/import/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/import/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/import/actions/import.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/actions/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/actions/test.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/neural_net/templates/plugin → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/neural_net/base}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/post_annotation → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/neural_net/templates/plugin}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/templates/plugin/test.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/templates/plugin/train.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/post_annotation/actions → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/post_annotation}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/post_annotation/templates/plugin → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/post_annotation/actions}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/post_annotation/actions/post_annotation.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/post_annotation/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/pre_annotation → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/post_annotation/templates/plugin}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/post_annotation/templates/plugin/post_annotation.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/pre_annotation/actions → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/pre_annotation}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/pre_annotation/templates/plugin → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/pre_annotation/actions}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/pre_annotation/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/smart_tool → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/pre_annotation/templates/plugin}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/pre_annotation/templates/plugin/pre_annotation.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/registry.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/smart_tool/actions → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/smart_tool}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/categories/smart_tool/templates/plugin → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/smart_tool/actions}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/smart_tool/actions/auto_label.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/smart_tool/templates/config.yaml +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin → synapse_sdk-1.0.0a23/synapse_sdk/plugins/categories/smart_tool/templates}/plugin/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/smart_tool/templates/plugin/auto_label.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/templates.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/cli/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/cli/publish.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/cli/run.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/enums.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/exceptions.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/models.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/cookiecutter.json +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/hooks/post_gen_project.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/hooks/pre_prompt.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env.dist +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.gitignore +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.pre-commit-config.yaml +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/README.md +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/config.yaml +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/main.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/shared → synapse_sdk-1.0.0a23/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/plugin}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/pyproject.toml +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/requirements.txt +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/upload.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/utils.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/utils → synapse_sdk-1.0.0a23/synapse_sdk/shared}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/shared/enums.py +0 -0
- {synapse_sdk-1.0.0a21/synapse_sdk/utils/pydantic → synapse_sdk-1.0.0a23/synapse_sdk/utils}/__init__.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/utils/debug.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/utils/file.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/utils/module_loading.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/utils/pydantic/config.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/utils/pydantic/errors.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/utils/pydantic/validators.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/utils/storage.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/utils/string.py +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk.egg-info/dependency_links.txt +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk.egg-info/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: synapse-sdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0a23
|
|
4
4
|
Summary: synapse sdk
|
|
5
5
|
Author-email: datamaker <developer@datamaker.io>
|
|
6
6
|
License: MIT
|
|
@@ -16,6 +16,7 @@ Requires-Dist: tqdm
|
|
|
16
16
|
Requires-Dist: python-dotenv
|
|
17
17
|
Requires-Dist: pyyaml
|
|
18
18
|
Requires-Dist: pydantic
|
|
19
|
+
Requires-Dist: pyjwt
|
|
19
20
|
Provides-Extra: all
|
|
20
21
|
Requires-Dist: ray[all]; extra == "all"
|
|
21
22
|
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
from synapse_sdk.clients.backend.annotation import AnnotationClientMixin
|
|
2
|
+
from synapse_sdk.clients.backend.core import CoreClientMixin
|
|
2
3
|
from synapse_sdk.clients.backend.dataset import DatasetClientMixin
|
|
3
4
|
from synapse_sdk.clients.backend.integration import IntegrationClientMixin
|
|
4
5
|
from synapse_sdk.clients.backend.ml import MLClientMixin
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
class BackendClient(
|
|
8
|
+
class BackendClient(
|
|
9
|
+
AnnotationClientMixin,
|
|
10
|
+
CoreClientMixin,
|
|
11
|
+
DatasetClientMixin,
|
|
12
|
+
IntegrationClientMixin,
|
|
13
|
+
MLClientMixin,
|
|
14
|
+
):
|
|
8
15
|
name = 'Backend'
|
|
9
16
|
token = None
|
|
10
17
|
tenant = None
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
import os
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from synapse_sdk.clients.base import BaseClient
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CoreClientMixin(BaseClient):
|
|
9
|
+
def create_chunked_upload(self, file_path):
|
|
10
|
+
def read_file_in_chunks(file_path, chunk_size=1024 * 1024 * 50):
|
|
11
|
+
with open(file_path, 'rb') as file:
|
|
12
|
+
while chunk := file.read(chunk_size):
|
|
13
|
+
yield chunk
|
|
14
|
+
|
|
15
|
+
file_path = Path(file_path)
|
|
16
|
+
size = os.path.getsize(file_path)
|
|
17
|
+
hash_md5 = hashlib.md5()
|
|
18
|
+
|
|
19
|
+
url = 'chunked_upload/'
|
|
20
|
+
offset = 0
|
|
21
|
+
for chunk in read_file_in_chunks(file_path):
|
|
22
|
+
hash_md5.update(chunk)
|
|
23
|
+
data = self._put(
|
|
24
|
+
url,
|
|
25
|
+
data={'filename': file_path.name},
|
|
26
|
+
files={'file': chunk},
|
|
27
|
+
headers={'Content-Range': f'bytes {offset}-{offset + len(chunk) - 1}/{size}'},
|
|
28
|
+
)
|
|
29
|
+
offset = data['offset']
|
|
30
|
+
url = data['url']
|
|
31
|
+
|
|
32
|
+
return self._post(url, data={'md5': hash_md5.hexdigest()})
|
|
@@ -14,8 +14,9 @@ class MLClientMixin(BaseClient):
|
|
|
14
14
|
|
|
15
15
|
def create_model(self, data):
|
|
16
16
|
path = 'models/'
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
file = data.pop('file')
|
|
18
|
+
data['chunked_upload'] = self.create_chunked_upload(file)['id']
|
|
19
|
+
return self._post(path, data=data)
|
|
19
20
|
|
|
20
21
|
def list_ground_truth_events(self, params=None, url_conversion=None, list_all=False):
|
|
21
22
|
path = 'ground_truth_events/'
|
|
@@ -28,11 +28,13 @@ class BaseClient:
|
|
|
28
28
|
def _request(self, method, path, **kwargs):
|
|
29
29
|
url = self._get_url(path)
|
|
30
30
|
headers = self._get_headers()
|
|
31
|
+
headers.update(kwargs.pop('headers', {}))
|
|
31
32
|
|
|
32
33
|
if method in ['post', 'put', 'patch']:
|
|
33
34
|
if kwargs.get('files') is not None:
|
|
34
35
|
for name, file in kwargs['files'].items():
|
|
35
|
-
|
|
36
|
+
if isinstance(file, (str, Path)):
|
|
37
|
+
kwargs['files'][name] = Path(str(file)).open(mode='rb')
|
|
36
38
|
for name, value in kwargs['data'].items():
|
|
37
39
|
if isinstance(value, dict):
|
|
38
40
|
kwargs['data'][name] = json.dumps(value)
|
|
@@ -21,11 +21,19 @@ class DeploymentAction(Action):
|
|
|
21
21
|
def start(self):
|
|
22
22
|
from ray import serve
|
|
23
23
|
|
|
24
|
+
from synapse_sdk.plugins.categories.neural_net.base.inference import app
|
|
25
|
+
|
|
24
26
|
self.ray_init()
|
|
25
|
-
|
|
27
|
+
|
|
28
|
+
deployment = serve.deployment(ray_actor_options=self.get_actor_options())(serve.ingress(app)(self.entrypoint))
|
|
26
29
|
serve.delete(self.plugin_release.code)
|
|
30
|
+
|
|
27
31
|
# TODO add run object
|
|
28
|
-
serve.run(
|
|
32
|
+
serve.run(
|
|
33
|
+
deployment.bind(self.envs['SYNAPSE_PLUGIN_RUN_HOST']),
|
|
34
|
+
name=self.plugin_release.code,
|
|
35
|
+
route_prefix=f'/{self.plugin_release.checksum}',
|
|
36
|
+
)
|
|
29
37
|
|
|
30
38
|
# 백엔드에 ServeApplication 추가
|
|
31
39
|
serve_application = self.create_serve_application()
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import jwt
|
|
2
|
+
|
|
1
3
|
from synapse_sdk.plugins.categories.base import Action
|
|
2
4
|
from synapse_sdk.plugins.categories.decorators import register_action
|
|
3
5
|
from synapse_sdk.plugins.enums import PluginCategory, RunMethod
|
|
@@ -11,8 +13,18 @@ class InferenceAction(Action):
|
|
|
11
13
|
|
|
12
14
|
def __init__(self, *args, **kwargs):
|
|
13
15
|
super().__init__(*args, **kwargs)
|
|
14
|
-
headers = {'serve_multiplexed_model_id':
|
|
16
|
+
headers = {'serve_multiplexed_model_id': self.get_serve_multiplexed_model_id()}
|
|
15
17
|
if 'headers' in self.params:
|
|
16
18
|
self.params['headers'].update(headers)
|
|
17
19
|
else:
|
|
18
20
|
self.params['headers'] = headers
|
|
21
|
+
|
|
22
|
+
def get_serve_multiplexed_model_id(self):
|
|
23
|
+
return jwt.encode(
|
|
24
|
+
{
|
|
25
|
+
'model': str(self.params.pop('model')),
|
|
26
|
+
'token': self.envs['SYNAPSE_PLUGIN_RUN_USER_TOKEN'],
|
|
27
|
+
'tenant': self.envs['SYNAPSE_PLUGIN_RUN_TENANT'],
|
|
28
|
+
},
|
|
29
|
+
self.envs['SYNAPSE_PLUGIN_RUN_HOST'],
|
|
30
|
+
)
|
|
@@ -17,8 +17,8 @@ from synapse_sdk.utils.pydantic.validators import non_blank
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class TrainRun(Run):
|
|
20
|
-
def log_metric(self, key, value, **metrics):
|
|
21
|
-
self.log('metric', {'key': key, 'value': value, 'metrics': metrics})
|
|
20
|
+
def log_metric(self, category, key, value, **metrics):
|
|
21
|
+
self.log('metric', {'category': category, 'key': key, 'value': value, 'metrics': metrics})
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class Hyperparameter(BaseModel):
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import tempfile
|
|
2
|
+
|
|
3
|
+
import jwt
|
|
4
|
+
from clients.backend import BackendClient
|
|
5
|
+
from fastapi import FastAPI
|
|
6
|
+
from ray import serve
|
|
7
|
+
|
|
8
|
+
from synapse_sdk.utils.file import unarchive
|
|
9
|
+
|
|
10
|
+
app = FastAPI()
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BaseInference:
|
|
14
|
+
backend_url = None
|
|
15
|
+
client = None
|
|
16
|
+
|
|
17
|
+
def __init__(self, backend_url):
|
|
18
|
+
self.backend_url = backend_url
|
|
19
|
+
|
|
20
|
+
@serve.multiplexed()
|
|
21
|
+
async def _load_model(self, model_id: str):
|
|
22
|
+
model_info = jwt.decode(model_id, self.backend_url, algorithms='HS256')
|
|
23
|
+
client = BackendClient(self.backend_url, token=model_info['token'], tenant=model_info['tenant'])
|
|
24
|
+
model = client.get_model(model_info['model'])
|
|
25
|
+
with tempfile.TemporaryDirectory() as temp_path:
|
|
26
|
+
unarchive(model['file'], temp_path)
|
|
27
|
+
model['path'] = temp_path
|
|
28
|
+
return await self._get_model(model)
|
|
29
|
+
|
|
30
|
+
async def get_model(self):
|
|
31
|
+
return await self._load_model(serve.get_multiplexed_model_id())
|
|
32
|
+
|
|
33
|
+
async def _get_model(self, model):
|
|
34
|
+
raise NotImplementedError
|
|
35
|
+
|
|
36
|
+
async def infer(self, *args, **kwargs):
|
|
37
|
+
raise NotImplementedError
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: synapse-sdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0a23
|
|
4
4
|
Summary: synapse sdk
|
|
5
5
|
Author-email: datamaker <developer@datamaker.io>
|
|
6
6
|
License: MIT
|
|
@@ -16,6 +16,7 @@ Requires-Dist: tqdm
|
|
|
16
16
|
Requires-Dist: python-dotenv
|
|
17
17
|
Requires-Dist: pyyaml
|
|
18
18
|
Requires-Dist: pydantic
|
|
19
|
+
Requires-Dist: pyjwt
|
|
19
20
|
Provides-Extra: all
|
|
20
21
|
Requires-Dist: ray[all]; extra == "all"
|
|
21
22
|
|
|
@@ -33,6 +33,7 @@ synapse_sdk/clients/agent/ray.py
|
|
|
33
33
|
synapse_sdk/clients/agent/service.py
|
|
34
34
|
synapse_sdk/clients/backend/__init__.py
|
|
35
35
|
synapse_sdk/clients/backend/annotation.py
|
|
36
|
+
synapse_sdk/clients/backend/core.py
|
|
36
37
|
synapse_sdk/clients/backend/dataset.py
|
|
37
38
|
synapse_sdk/clients/backend/integration.py
|
|
38
39
|
synapse_sdk/clients/backend/ml.py
|
|
@@ -68,6 +69,8 @@ synapse_sdk/plugins/categories/neural_net/actions/deployment.py
|
|
|
68
69
|
synapse_sdk/plugins/categories/neural_net/actions/inference.py
|
|
69
70
|
synapse_sdk/plugins/categories/neural_net/actions/test.py
|
|
70
71
|
synapse_sdk/plugins/categories/neural_net/actions/train.py
|
|
72
|
+
synapse_sdk/plugins/categories/neural_net/base/__init__.py
|
|
73
|
+
synapse_sdk/plugins/categories/neural_net/base/inference.py
|
|
71
74
|
synapse_sdk/plugins/categories/neural_net/templates/config.yaml
|
|
72
75
|
synapse_sdk/plugins/categories/neural_net/templates/plugin/__init__.py
|
|
73
76
|
synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/export/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/import/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/categories/neural_net/__init__.py
RENAMED
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
{synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/cookiecutter.json
RENAMED
|
File without changes
|
|
File without changes
|
{synapse_sdk-1.0.0a21 → synapse_sdk-1.0.0a23}/synapse_sdk/plugins/templates/hooks/pre_prompt.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
{synapse_sdk-1.0.0a21/synapse_sdk/utils → synapse_sdk-1.0.0a23/synapse_sdk/shared}/__init__.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|