synapse-sdk 1.0.0a48__py3-none-any.whl → 1.0.0a49__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.

@@ -22,11 +22,18 @@ class TuneRun(TrainRun):
22
22
  checkpoint_output = None
23
23
 
24
24
 
25
+ class SearchAlgo(BaseModel):
26
+ name: str
27
+ points_to_evaluate: Optional[dict] = None
28
+
29
+
25
30
  class TuneConfig(BaseModel):
26
31
  mode: Optional[str] = None
27
32
  metric: Optional[str] = None
28
33
  num_samples: int = 1
29
34
  max_concurrent_trials: Optional[int] = None
35
+ search_alg: Optional[SearchAlgo] = None
36
+ scheduler: Optional[str] = None
30
37
 
31
38
 
32
39
  class TuneParams(BaseModel):
@@ -170,7 +177,7 @@ class TuneAction(TrainAction):
170
177
  entrypoint = _tune
171
178
 
172
179
  trainable = tune.with_parameters(entrypoint, run=self.run, dataset=input_dataset, checkpoint=checkpoint)
173
- tune_config = self.params['tune_config']
180
+ tune_config = self.convert_tune_search_algo(self.params['tune_config'])
174
181
 
175
182
  hyperparameter = self.params['hyperparameter']
176
183
  param_space = self.convert_tune_params(hyperparameter)
@@ -230,6 +237,42 @@ class TuneAction(TrainAction):
230
237
  **params,
231
238
  })
232
239
 
240
+ @staticmethod
241
+ def convert_tune_search_algo(tune_config):
242
+ """
243
+ Convert YAML hyperparameter configuration to Ray Tune search algorithm and scheduler.
244
+
245
+ Args:
246
+ tune_config (dict): Hyperparameter configuration.
247
+
248
+ Returns:
249
+ dict: Ray Tune search algorithm and scheduler
250
+ """
251
+ from ray import tune
252
+
253
+ if tune_config['search_alg'] is None:
254
+ return tune_config
255
+
256
+ search_alg = tune_config['search_alg']['name']
257
+ metric = tune_config['metric']
258
+ mode = tune_config['mode']
259
+ points_to_evaluate = tune_config['search_alg'].get('points_to_evaluate', None)
260
+
261
+ if search_alg == 'AxSearch':
262
+ tune_config['search_alg'] = tune.search.ax.AxSearch(metric=metric, mode=mode)
263
+ elif search_alg == 'BayesOptSearch':
264
+ tune_config['search_alg'] = tune.search.bayesopt.BayesOptSearch(metric=metric, mode=mode)
265
+ elif search_alg == 'HyperOptSearch':
266
+ tune_config['search_alg'] = tune.search.hyperopt.HyperOptSearch(metric=metric, mode=mode)
267
+ elif search_alg == 'OptunaSearch':
268
+ tune_config['search_alg'] = tune.search.optuna.OptunaSearch(metric=metric, mode=mode)
269
+ elif search_alg == 'BasicVariantGenerator':
270
+ tune_config['search_alg'] = tune.search.basic_variant.BasicVariantGenerator(
271
+ points_to_evaluate=points_to_evaluate
272
+ )
273
+
274
+ return tune_config
275
+
233
276
  @staticmethod
234
277
  def convert_tune_params(param_list):
235
278
  """
@@ -243,19 +286,31 @@ class TuneAction(TrainAction):
243
286
  """
244
287
  from ray import tune
245
288
 
289
+ param_handlers = {
290
+ 'uniform': lambda p: tune.uniform(p['min'], p['max']),
291
+ 'quniform': lambda p: tune.quniform(p['min'], p['max']),
292
+ 'loguniform': lambda p: tune.loguniform(p['min'], p['max'], p['base']),
293
+ 'qloguniform': lambda p: tune.qloguniform(p['min'], p['max'], p['base']),
294
+ 'randn': lambda p: tune.randn(p['mean'], p['sd']),
295
+ 'qrandn': lambda p: tune.qrandn(p['mean'], p['sd']),
296
+ 'randint': lambda p: tune.randint(p['min'], p['max']),
297
+ 'qrandint': lambda p: tune.qrandint(p['min'], p['max']),
298
+ 'lograndint': lambda p: tune.lograndint(p['min'], p['max'], p['base']),
299
+ 'qlograndint': lambda p: tune.qlograndint(p['min'], p['max'], p['base']),
300
+ 'choice': lambda p: tune.choice(p['options']),
301
+ 'grid_search': lambda p: tune.grid_search(p['options']),
302
+ }
303
+
246
304
  param_space = {}
247
305
 
248
306
  for param in param_list:
249
307
  name = param['name']
250
308
  param_type = param['type']
251
309
 
252
- if param_type == 'loguniform':
253
- param_space[name] = tune.loguniform(param['min'], param['max'])
254
- elif param_type == 'choice':
255
- param_space[name] = tune.choice(param['options'])
256
- elif param_type == 'randint':
257
- param_space[name] = tune.randint(param['min'], param['max'])
258
- # Add more type handlers as needed
310
+ if param_type in param_handlers:
311
+ param_space[name] = param_handlers[param_type](param)
312
+ else:
313
+ raise ValueError(f'Unknown parameter type: {param_type}')
259
314
 
260
315
  return param_space
261
316
 
@@ -5,7 +5,7 @@ readme: README.md
5
5
  description: This is plugin_name plugin
6
6
  category: neural_net
7
7
  tasks:
8
- - object_detection
8
+ - image.object_detection
9
9
  data_type: image
10
10
  package_manager: uv
11
11
  actions:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: synapse-sdk
3
- Version: 1.0.0a48
3
+ Version: 1.0.0a49
4
4
  Summary: synapse sdk
5
5
  Author-email: datamaker <developer@datamaker.io>
6
6
  License: MIT
@@ -22,6 +22,8 @@ Requires-Dist: fsspec[gcs,s3,sftp]
22
22
  Provides-Extra: all
23
23
  Requires-Dist: ray[all]; extra == "all"
24
24
  Requires-Dist: python-nmap; extra == "all"
25
+ Requires-Dist: hyperopt; extra == "all"
26
+ Requires-Dist: bayesian-optimization==1.4.3; extra == "all"
25
27
  Dynamic: license-file
26
28
 
27
29
  This is the SDK to develop synapse plugins
@@ -72,10 +72,10 @@ synapse_sdk/plugins/categories/neural_net/actions/gradio.py,sha256=jBkonh0JHRIKF
72
72
  synapse_sdk/plugins/categories/neural_net/actions/inference.py,sha256=0a655ELqNVjPFZTJDiw4EUdcMCPGveUEKyoYqpwMFBU,1019
73
73
  synapse_sdk/plugins/categories/neural_net/actions/test.py,sha256=JY25eg-Fo6WbgtMkGoo_qNqoaZkp3AQNEypJmeGzEog,320
74
74
  synapse_sdk/plugins/categories/neural_net/actions/train.py,sha256=kve6iTCg2kUeavMQTR2JFuoYDu-QWZFFlB58ZICQtdM,5406
75
- synapse_sdk/plugins/categories/neural_net/actions/tune.py,sha256=XJczlLDF8FOJXA-7TXNZa3npWhMsT0wGqQwYW3w5TDo,9475
75
+ synapse_sdk/plugins/categories/neural_net/actions/tune.py,sha256=wDJMZ1vPdALsY9T9D9kDe9klCnqcfpcl0e2q7kef5XA,11855
76
76
  synapse_sdk/plugins/categories/neural_net/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  synapse_sdk/plugins/categories/neural_net/base/inference.py,sha256=R5DASI6-5vzsjDOYxqeGGMBjnav5qHF4hNJT8zNUR3I,1097
78
- synapse_sdk/plugins/categories/neural_net/templates/config.yaml,sha256=uZVuXjIfsd_pTaSKptHeHn1TN2FIiLrvvpkClToc6po,596
78
+ synapse_sdk/plugins/categories/neural_net/templates/config.yaml,sha256=ZDw6X2GLfwIywpgEXFwFkUOQwSMDGvBTwc_qW7bw8H4,602
79
79
  synapse_sdk/plugins/categories/neural_net/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
80
  synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py,sha256=InfqKWJYi6sqiUnfPKHC5KYGhxckDaWZNQ202u-uVP4,366
81
81
  synapse_sdk/plugins/categories/neural_net/templates/plugin/test.py,sha256=kYyk7l4UtcDUAH4nkdVUGrHHHjxI4p1U13HSLnmGPyE,53
@@ -134,9 +134,9 @@ synapse_sdk/utils/storage/providers/__init__.py,sha256=x7RGwZryT2FpVxS7fGWryRVpq
134
134
  synapse_sdk/utils/storage/providers/gcp.py,sha256=i2BQCu1Kej1If9SuNr2_lEyTcr5M_ncGITZrL0u5wEA,363
135
135
  synapse_sdk/utils/storage/providers/s3.py,sha256=W94rQvhGRXti3R4mYP7gmU5pcyCQpGFIBLvxxqLVdRM,2231
136
136
  synapse_sdk/utils/storage/providers/sftp.py,sha256=_8s9hf0JXIO21gvm-JVS00FbLsbtvly4c-ETLRax68A,1426
137
- synapse_sdk-1.0.0a48.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
138
- synapse_sdk-1.0.0a48.dist-info/METADATA,sha256=d3PEB2-ivG8oy4s1Kbm78h_KPA-kP_5YM3PtqV8vRW0,1203
139
- synapse_sdk-1.0.0a48.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
140
- synapse_sdk-1.0.0a48.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
141
- synapse_sdk-1.0.0a48.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
142
- synapse_sdk-1.0.0a48.dist-info/RECORD,,
137
+ synapse_sdk-1.0.0a49.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
138
+ synapse_sdk-1.0.0a49.dist-info/METADATA,sha256=0TLX25pKAV_0955eqiN1100FtQTgEst7h797J8vDR2A,1303
139
+ synapse_sdk-1.0.0a49.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
140
+ synapse_sdk-1.0.0a49.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
141
+ synapse_sdk-1.0.0a49.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
142
+ synapse_sdk-1.0.0a49.dist-info/RECORD,,