code-loader 1.0.208.dev2__py3-none-any.whl → 1.0.208.dev4__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
@@ -1937,6 +1937,9 @@ def _decorate_model_latent_space(user_function, ls_name, use_ls_for_analysis, re
1937
1937
  arg_names = _model_latent_space_arg_names(user_function)
1938
1938
 
1939
1939
  def _validate_input_args(*args, **kwargs):
1940
+ # Every bound argument must be an array: a ground truth is never passed as None, so a
1941
+ # model-computed LS cannot fall back from ground truth to predictions on unlabeled rows.
1942
+ # The engine skips the LS for those rows instead (see leaploader._check_model_latent_spaces).
1940
1943
  assert len(args) + len(kwargs) > 0, (
1941
1944
  f"tensorleap_custom_latent_space validation failed: '{user_function.__name__}' is "
1942
1945
  f"model-computed and expects at least one np.ndarray argument, but received none.")
code_loader/leaploader.py CHANGED
@@ -18,6 +18,7 @@ from code_loader.contract.datasetclasses import DatasetSample, DatasetBaseHandle
18
18
  MetricCallableReturnType, CustomLossHandlerData, CustomLossHandler, RawInputsForHeatmap, SamplePreprocessResponse, \
19
19
  ElementInstance, custom_latent_space_attribute, DatasetIntegrationSetup, InstanceMetricHandler, _simulation_context
20
20
  from code_loader.contract.enums import DataStateEnum, TestingSectionEnum, DataStateType, DatasetMetadataType
21
+ from code_loader.contract.mapping import NodeMappingType
21
22
  from code_loader.contract.exceptions import DatasetScriptException
22
23
  from code_loader.contract.responsedataclasses import DatasetIntegParseResult, DatasetTestResultPayload, \
23
24
  DatasetPreprocess, DatasetSetup, DatasetInputInstance, DatasetOutputInstance, DatasetMetadataInstance, \
@@ -450,6 +451,19 @@ class LeapLoader(LeapLoaderBase):
450
451
  f"grouped preprocess response (grouped: {grouped_states}). Use the "
451
452
  f"(sample_id, preprocess: PreprocessResponse) form instead."
452
453
  )
454
+ if global_leap_binder.setup_container.unlabeled_data_preprocess is not None:
455
+ gt_bound_names = [
456
+ connection.node.name for connection in global_leap_binder.latent_space_connections
457
+ if any(node_input.type == NodeMappingType.GroundTruth
458
+ for node_input in (connection.node_inputs or {}).values())
459
+ ]
460
+ if gt_bound_names:
461
+ test_result.display[TestingSectionEnum.Warnings.name] = (
462
+ f"Model-computed custom latent space(s) {gt_bound_names} read a ground truth, so "
463
+ f"they are skipped for unlabeled samples, which will have no vector in them. A "
464
+ f"latent space cannot fall back from ground truth to predictions; to cover "
465
+ f"unlabeled samples, add one bound only to model predictions."
466
+ )
453
467
  return test_result
454
468
 
455
469
  def _check_instance_custom_latent_spaces(self) -> Optional[DatasetTestResultPayload]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: code-loader
3
- Version: 1.0.208.dev2
3
+ Version: 1.0.208.dev4
4
4
  Summary:
5
5
  Home-page: https://github.com/tensorleap/code-loader
6
6
  License: MIT
@@ -21,9 +21,9 @@ 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
25
- code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=fAoXt1N9zUI6wqCk5NyuPQJBhO0ZtOFIyM36OiA5XJ8,206593
26
- code_loader/leaploader.py,sha256=xC7oT_2VV2VhhCzBb1J27nQrRAGcJwq04eypatENOz8,96115
24
+ code_loader/inner_leap_binder/leapbinder.py,sha256=j6oa6oyM04scUCmyFKB80E0MTYDBDUcF9cwiyJTj5oQ,63134
25
+ code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=F3O6OhbMQmoa_xqNq1kjhDgKiztMr7qoclbS0jzCWp8,206886
26
+ code_loader/leaploader.py,sha256=TiO5SrRtO6SevydmYlEZFHnU-88GDSG9m7TJyeIIXjI,97060
27
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
@@ -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.dev2.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
36
- code_loader-1.0.208.dev2.dist-info/METADATA,sha256=ulblLxbtI_9XysKt7SoceD1jVjbigogLaz6bwsOXE88,1095
37
- code_loader-1.0.208.dev2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
- code_loader-1.0.208.dev2.dist-info/RECORD,,
35
+ code_loader-1.0.208.dev4.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
36
+ code_loader-1.0.208.dev4.dist-info/METADATA,sha256=_-4N2MXSRMXO72SbEk1kwM9UvIgKurn6cnweyPrKmCU,1095
37
+ code_loader-1.0.208.dev4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
+ code_loader-1.0.208.dev4.dist-info/RECORD,,