code-loader 1.0.208.dev1__py3-none-any.whl → 1.0.208.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.
@@ -586,8 +586,7 @@ class LeapBinder:
586
586
  space for the Out-Of-Distribution and Domain-Gap insights instead of the
587
587
  built-in defaults. At most one registered custom latent space may set this;
588
588
  registering a second one with the flag raises. Not currently supported when
589
- instance_aware=True, or for a model-computed latent space (computed_at='model')
590
- — it is ignored (with a warning) and forced to False.
589
+ instance_aware=True — it is ignored (with a warning) and forced to False.
591
590
  instance_aware (bool): When True, `function` takes a third `instance_id` argument
592
591
  and is called once per element-instance row instead of once per sample.
593
592
  """
@@ -616,16 +615,6 @@ class LeapBinder:
616
615
  f"latent space ('{name}'). Ignoring it; the flag will be set to False."
617
616
  )
618
617
  use_ls_for_analysis = False
619
- # Model-computed latent spaces are fetched via run_model_latent_space, a separate path
620
- # that get_sample's per-sample custom_latent_spaces dict never populates — the engine has
621
- # no consumer for a model-computed analysis latent space yet, so force it off rather than
622
- # silently accepting a flag that has no effect.
623
- if computed_at == 'model' and use_ls_for_analysis:
624
- warnings.warn(
625
- f"use_ls_for_analysis=True is not currently supported for a model-computed custom "
626
- f"latent space ('{name}'). Ignoring it; the flag will be set to False."
627
- )
628
- use_ls_for_analysis = False
629
618
  if use_ls_for_analysis:
630
619
  already_flagged = [
631
620
  existing_name
code_loader/leaploader.py CHANGED
@@ -1470,19 +1470,24 @@ class LeapLoader(LeapLoaderBase):
1470
1470
  if handler.computed_at == 'model')
1471
1471
 
1472
1472
  @lru_cache()
1473
- def get_model_latent_space_specs(self) -> Dict[str, Dict[str, Any]]:
1473
+ def get_custom_latent_space_specs(self) -> Dict[str, Dict[str, Any]]:
1474
1474
  self.exec_script()
1475
1475
  return {
1476
1476
  name: {
1477
+ 'computed_at': handler.computed_at,
1477
1478
  'arg_names': list(handler.arg_names or []),
1478
1479
  'reduce': handler.reduce.value if handler.reduce is not None else None,
1479
1480
  'n_components': handler.n_components,
1480
1481
  'channel_axis': handler.channel_axis,
1481
1482
  }
1482
1483
  for name, handler in global_leap_binder.setup_container.custom_latent_spaces.items()
1483
- if handler.computed_at == 'model'
1484
1484
  }
1485
1485
 
1486
+ @lru_cache()
1487
+ def get_model_latent_space_specs(self) -> Dict[str, Dict[str, Any]]:
1488
+ return {name: spec for name, spec in self.get_custom_latent_space_specs().items()
1489
+ if spec['computed_at'] == 'model'}
1490
+
1486
1491
  def run_model_latent_space(self, ls_name: str, sample_ids: np.array, state: DataStateEnum,
1487
1492
  input_tensors_by_arg_name: Dict[str, npt.NDArray[np.float32]]
1488
1493
  ) -> npt.NDArray[np.float32]:
@@ -239,6 +239,11 @@ class LeapLoaderBase:
239
239
  raise NotImplementedError(f'{type(self).__name__} does not implement '
240
240
  'get_model_custom_latent_space_names.')
241
241
 
242
+ @abstractmethod
243
+ def get_custom_latent_space_specs(self) -> Dict[str, Dict[str, Any]]:
244
+ raise NotImplementedError(f'{type(self).__name__} does not implement '
245
+ 'get_custom_latent_space_specs.')
246
+
242
247
  @abstractmethod
243
248
  def get_model_latent_space_specs(self) -> Dict[str, Dict[str, Any]]:
244
249
  raise NotImplementedError(f'{type(self).__name__} does not implement '
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.208.dev1
3
+ Version: 1.0.208.dev3
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -21,10 +21,10 @@ code_loader/experiment_api/types.py,sha256=MY8xFARHwdVA7p4dxyhD60ShmttgTvb4qdp1o
21
21
  code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZJEqBqc,3304
22
22
  code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
23
23
  code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
24
- code_loader/inner_leap_binder/leapbinder.py,sha256=J5rWu8caFNkH3I4J9jkIoWimV188jhI1XBV6-b1thmc,63883
24
+ code_loader/inner_leap_binder/leapbinder.py,sha256=j6oa6oyM04scUCmyFKB80E0MTYDBDUcF9cwiyJTj5oQ,63134
25
25
  code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=fAoXt1N9zUI6wqCk5NyuPQJBhO0ZtOFIyM36OiA5XJ8,206593
26
- code_loader/leaploader.py,sha256=2KzjvMgXia-yhpOXIg2pwEOs2QgM1ZALXppXcuyP1N8,95876
27
- code_loader/leaploaderbase.py,sha256=ok7-vjbaNX_zeW8UUEUvQJSce5yB7qF4-uNLSxr0dGI,12359
26
+ code_loader/leaploader.py,sha256=xC7oT_2VV2VhhCzBb1J27nQrRAGcJwq04eypatENOz8,96115
27
+ code_loader/leaploaderbase.py,sha256=cQwlJdx_tLJXMxTq8AURsFpyF0s3jpqkWaF5i1r8hSE,12601
28
28
  code_loader/mixpanel_tracker.py,sha256=rNwRmFifNbdUoqLQvvhhgpKczWpWiEmd8MfyJe27sxw,9131
29
29
  code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  code_loader/plot_functions/plot_functions.py,sha256=2DC-zlVaN13P4VNx5d8csgs80C6SisaeP1-Kq2LW7iM,16075
@@ -32,7 +32,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
32
32
  code_loader/utils.py,sha256=Auw39lKpEQ7Ld2q1nj6S18GIDKWcjCxU0TDrur2UEko,11968
33
33
  code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  code_loader/visualizers/default_visualizers.py,sha256=grTPin_lCE9aci8i8CqA7DqQwAyXRB7_EamA3na_pls,5438
35
- code_loader-1.0.208.dev1.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
36
- code_loader-1.0.208.dev1.dist-info/METADATA,sha256=Bkb4Z-t1BOLRLX-GctwTpwfhHi6NHqRAEvXQLuDPu_8,1095
37
- code_loader-1.0.208.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
- code_loader-1.0.208.dev1.dist-info/RECORD,,
35
+ code_loader-1.0.208.dev3.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
36
+ code_loader-1.0.208.dev3.dist-info/METADATA,sha256=_PM6rMpE1DSLWHREFJ-sKGfRAWJWoI_tet4gMNj3rEo,1095
37
+ code_loader-1.0.208.dev3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
+ code_loader-1.0.208.dev3.dist-info/RECORD,,