code-loader 1.0.139.dev5__py3-none-any.whl → 1.0.153.dev3__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 code-loader might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  import warnings
2
2
  from dataclasses import dataclass, field
3
- from typing import Any, Callable, List, Optional, Dict, Union, Type
3
+ from typing import Any, Callable, List, Optional, Dict, Union, Type, Literal
4
4
  import re
5
5
  import numpy as np
6
6
  import numpy.typing as npt
@@ -60,9 +60,14 @@ class PreprocessResponse:
60
60
  raise Exception("length is deprecated, please use sample_ids instead.")
61
61
 
62
62
  if self.state is None:
63
- warnings.warn(
64
- "PreprocessResponse.state is not set. For best practice, assign a unique `state` value to each PreprocessResponse instance."
63
+ from code_loader.inner_leap_binder.leapbinder_decorators import store_warning_by_param
64
+ store_warning_by_param(
65
+ param_name="PreprocessResponse.state",
66
+ user_func_name="tensorleap_preprocess",
67
+ default_value=str("specific order"),
68
+ link_to_docs="https://docs.tensorleap.ai/tensorleap-integration/writing-integration-code/preprocess-function",
65
69
  )
70
+
66
71
  else:
67
72
  assert isinstance(self.state, DataStateType), f"PreprocessResponse.state must be of type {DataStateType.__name__} but got {type(self.state)}"
68
73
 
@@ -77,6 +82,8 @@ class PreprocessResponse:
77
82
  class ElementInstance:
78
83
  name: str
79
84
  mask: npt.NDArray[np.float32]
85
+ # instance_metadata: Dict[str, Union[Optional[str], int, bool, Optional[float]]]
86
+
80
87
 
81
88
  SectionCallableInterface = Callable[[Union[int, str], PreprocessResponse], npt.NDArray[np.float32]]
82
89
  InstanceCallableInterface = Callable[[Union[int, str], PreprocessResponse, int], Optional[ElementInstance]]
@@ -229,7 +236,8 @@ class CustomLatentSpaceHandler:
229
236
  class PredictionTypeHandler:
230
237
  name: str
231
238
  labels: List[str]
232
- channel_dim: int = -1
239
+ channel_dim: Union[int, Literal["tl_default_value"]]= "tl_default_value"
240
+
233
241
 
234
242
 
235
243
  @dataclass