code-loader 1.0.74__tar.gz → 1.0.76__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 code-loader might be problematic. Click here for more details.

Files changed (31) hide show
  1. {code_loader-1.0.74 → code_loader-1.0.76}/PKG-INFO +1 -1
  2. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/inner_leap_binder/leapbinder_decorators.py +21 -17
  3. {code_loader-1.0.74 → code_loader-1.0.76}/pyproject.toml +1 -1
  4. {code_loader-1.0.74 → code_loader-1.0.76}/LICENSE +0 -0
  5. {code_loader-1.0.74 → code_loader-1.0.76}/README.md +0 -0
  6. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/__init__.py +0 -0
  7. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/contract/__init__.py +0 -0
  8. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/contract/datasetclasses.py +0 -0
  9. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/contract/enums.py +0 -0
  10. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/contract/exceptions.py +0 -0
  11. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/contract/responsedataclasses.py +0 -0
  12. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/contract/visualizer_classes.py +0 -0
  13. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/default_losses.py +0 -0
  14. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/default_metrics.py +0 -0
  15. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/__init__.py +0 -0
  16. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/api.py +0 -0
  17. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/cli_config_utils.py +0 -0
  18. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/client.py +0 -0
  19. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/epoch.py +0 -0
  20. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/experiment.py +0 -0
  21. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/experiment_context.py +0 -0
  22. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/types.py +0 -0
  23. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/utils.py +0 -0
  24. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/experiment_api/workingspace_config_utils.py +0 -0
  25. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/inner_leap_binder/__init__.py +0 -0
  26. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/inner_leap_binder/leapbinder.py +0 -0
  27. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/leaploader.py +0 -0
  28. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/leaploaderbase.py +0 -0
  29. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/utils.py +0 -0
  30. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/visualizers/__init__.py +0 -0
  31. {code_loader-1.0.74 → code_loader-1.0.76}/code_loader/visualizers/default_visualizers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.74
3
+ Version: 1.0.76
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -8,7 +8,7 @@ import numpy.typing as npt
8
8
  from code_loader.contract.datasetclasses import CustomCallableInterfaceMultiArgs, \
9
9
  CustomMultipleReturnCallableInterfaceMultiArgs, ConfusionMatrixCallableInterfaceMultiArgs, CustomCallableInterface, \
10
10
  VisualizerCallableInterface, MetadataSectionCallableInterface, PreprocessResponse, SectionCallableInterface, \
11
- ConfusionMatrixElement
11
+ ConfusionMatrixElement, SamplePreprocessResponse
12
12
  from code_loader.contract.enums import MetricDirection, LeapDataType
13
13
  from code_loader import leap_binder
14
14
  from code_loader.contract.visualizer_classes import LeapImage, LeapImageMask, LeapTextMask, LeapText, LeapGraph, \
@@ -30,18 +30,20 @@ def tensorleap_custom_metric(name: str,
30
30
 
31
31
  def _validate_input_args(*args, **kwargs) -> None:
32
32
  for i, arg in enumerate(args):
33
- assert isinstance(arg, np.ndarray), (f'tensorleap_custom_metric validation failed: '
34
- f'Argument #{i} should be a numpy array. Got {type(arg)}.')
35
- if leap_binder.batch_size_to_validate:
33
+ assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
34
+ f'tensorleap_custom_metric validation failed: '
35
+ f'Argument #{i} should be a numpy array. Got {type(arg)}.')
36
+ if leap_binder.batch_size_to_validate and isinstance(arg, np.ndarray):
36
37
  assert arg.shape[0] == leap_binder.batch_size_to_validate, \
37
38
  (f'tensorleap_custom_metric validation failed: Argument #{i} '
38
39
  f'first dim should be as the batch size. Got {arg.shape[0]} '
39
40
  f'instead of {leap_binder.batch_size_to_validate}')
40
41
 
41
42
  for _arg_name, arg in kwargs.items():
42
- assert isinstance(arg, np.ndarray), (f'tensorleap_custom_metric validation failed: '
43
- f'Argument {_arg_name} should be a numpy array. Got {type(arg)}.')
44
- if leap_binder.batch_size_to_validate:
43
+ assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
44
+ f'tensorleap_custom_metric validation failed: '
45
+ f'Argument {_arg_name} should be a numpy array. Got {type(arg)}.')
46
+ if leap_binder.batch_size_to_validate and isinstance(arg, np.ndarray):
45
47
  assert arg.shape[0] == leap_binder.batch_size_to_validate, \
46
48
  (f'tensorleap_custom_metric validation failed: Argument {_arg_name} '
47
49
  f'first dim should be as the batch size. Got {arg.shape[0]} '
@@ -58,8 +60,8 @@ def tensorleap_custom_metric(name: str,
58
60
  assert isinstance(single_metric_result[0][0], ConfusionMatrixElement), \
59
61
  f'{supported_types_message}Got List[List[{type(single_metric_result[0][0])}]].'
60
62
  else:
61
- assert isinstance(single_metric_result[0],
62
- float), f'{supported_types_message}Got List[{type(single_metric_result[0])}].'
63
+ assert isinstance(single_metric_result[0], (
64
+ float, int, type(None))), f'{supported_types_message}Got List[{type(single_metric_result[0])}].'
63
65
  else:
64
66
  assert isinstance(single_metric_result,
65
67
  np.ndarray), f'{supported_types_message}Got {type(single_metric_result)}.'
@@ -115,17 +117,19 @@ def tensorleap_custom_visualizer(name: str, visualizer_type: LeapDataType,
115
117
 
116
118
  def _validate_input_args(*args, **kwargs):
117
119
  for i, arg in enumerate(args):
118
- assert isinstance(arg, np.ndarray), (f'tensorleap_custom_visualizer validation failed: '
119
- f'Argument #{i} should be a numpy array. Got {type(arg)}.')
120
- if leap_binder.batch_size_to_validate:
120
+ assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
121
+ f'tensorleap_custom_visualizer validation failed: '
122
+ f'Argument #{i} should be a numpy array. Got {type(arg)}.')
123
+ if leap_binder.batch_size_to_validate and isinstance(arg, np.ndarray):
121
124
  assert arg.shape[0] != leap_binder.batch_size_to_validate, \
122
125
  (f'tensorleap_custom_visualizer validation failed: '
123
126
  f'Argument #{i} should be without batch dimension. ')
124
127
 
125
128
  for _arg_name, arg in kwargs.items():
126
- assert isinstance(arg, np.ndarray), (f'tensorleap_custom_visualizer validation failed: '
127
- f'Argument {_arg_name} should be a numpy array. Got {type(arg)}.')
128
- if leap_binder.batch_size_to_validate:
129
+ assert isinstance(arg, (np.ndarray, SamplePreprocessResponse)), (
130
+ f'tensorleap_custom_visualizer validation failed: '
131
+ f'Argument {_arg_name} should be a numpy array. Got {type(arg)}.')
132
+ if leap_binder.batch_size_to_validate and isinstance(arg, np.ndarray):
129
133
  assert arg.shape[0] != leap_binder.batch_size_to_validate, \
130
134
  (f'tensorleap_custom_visualizer validation failed: Argument {_arg_name} '
131
135
  f'should be without batch dimension. ')
@@ -353,10 +357,10 @@ def tensorleap_custom_loss(name: str):
353
357
 
354
358
  leap_binder.add_custom_loss(user_function, name)
355
359
 
356
- valid_types = np.ndarray
360
+ valid_types = (np.ndarray, SamplePreprocessResponse)
357
361
  try:
358
362
  import tensorflow as tf
359
- valid_types = (np.ndarray, tf.Tensor)
363
+ valid_types = (np.ndarray, SamplePreprocessResponse, tf.Tensor)
360
364
  except ImportError:
361
365
  pass
362
366
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "code-loader"
3
- version = "1.0.74"
3
+ version = "1.0.76"
4
4
  description = ""
5
5
  authors = ["dorhar <doron.harnoy@tensorleap.ai>"]
6
6
  license = "MIT"
File without changes
File without changes