code-loader 1.0.189__py3-none-any.whl → 1.0.190.dev0__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.
- code_loader/inner_leap_binder/leapbinder_decorators.py +23 -5
- code_loader/leaploader.py +0 -20
- {code_loader-1.0.189.dist-info → code_loader-1.0.190.dev0.dist-info}/METADATA +3 -3
- {code_loader-1.0.189.dist-info → code_loader-1.0.190.dev0.dist-info}/RECORD +6 -7
- {code_loader-1.0.189.dist-info → code_loader-1.0.190.dev0.dist-info}/WHEEL +1 -1
- code_loader-1.0.189.dist-info/LICENSE +0 -21
- /LICENSE → /code_loader-1.0.190.dev0.dist-info/LICENSE +0 -0
|
@@ -197,11 +197,11 @@ def validate_output_structure(result, func_name: str, expected_type_name="np.nda
|
|
|
197
197
|
def batch_warning(result, func_name):
|
|
198
198
|
if len(result.shape) > 0 and result.shape[0] == 1:
|
|
199
199
|
warnings.warn(
|
|
200
|
-
f"{func_name} warning: Tensorleap will add a batch dimension at axis 0
|
|
201
|
-
f"
|
|
202
|
-
f"
|
|
203
|
-
f"
|
|
204
|
-
f"
|
|
200
|
+
f"{func_name} warning: Tensorleap will add a batch dimension at axis 0 of "
|
|
201
|
+
f"{func_name}'s output, but axis 0 is already size 1 — this can produce a "
|
|
202
|
+
f"doubly-batched shape (e.g. (1, 1, ...)). If axis 0 is a real dimension "
|
|
203
|
+
f"(e.g. a single channel) and not an accidental batch, you can ignore this; "
|
|
204
|
+
f"only fix it if you pre-batched the output."
|
|
205
205
|
)
|
|
206
206
|
|
|
207
207
|
|
|
@@ -349,6 +349,14 @@ def _safe_get_item(key):
|
|
|
349
349
|
|
|
350
350
|
|
|
351
351
|
def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]] = _UNSET):
|
|
352
|
+
"""Register the model-loading function.
|
|
353
|
+
|
|
354
|
+
``prediction_types``: declare one ``PredictionTypeHandler`` per model output, in
|
|
355
|
+
output order. Multi-output models must declare an entry for EVERY output — the
|
|
356
|
+
count is validated against the model's outputs — so for an output you don't consume
|
|
357
|
+
as a prediction, pass a throwaway handler to satisfy the count. Omit the argument
|
|
358
|
+
only when the model has a single prediction output.
|
|
359
|
+
"""
|
|
352
360
|
prediction_types_was_provided = prediction_types is not _UNSET
|
|
353
361
|
|
|
354
362
|
if not prediction_types_was_provided:
|
|
@@ -567,6 +575,9 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
567
575
|
def get_inputs(self):
|
|
568
576
|
return self.model.get_inputs()
|
|
569
577
|
|
|
578
|
+
def get_outputs(self):
|
|
579
|
+
return self.model.get_outputs()
|
|
580
|
+
|
|
570
581
|
model_placeholder = ModelPlaceholder(prediction_types)
|
|
571
582
|
if not _call_from_tl_platform:
|
|
572
583
|
update_env_params_func("tensorleap_load_model", "v")
|
|
@@ -631,6 +642,13 @@ def tensorleap_load_model(prediction_types: Optional[List[PredictionTypeHandler]
|
|
|
631
642
|
|
|
632
643
|
return FollowInputIndex()
|
|
633
644
|
|
|
645
|
+
def get_outputs(self):
|
|
646
|
+
# Mapping-mode counterpart of the ONNX-run get_outputs(): in mapping
|
|
647
|
+
# mode outputs are reached by index, and get_outputs()[i] resolves to
|
|
648
|
+
# Prediction{i} — exactly like run()/__call__, which also return a
|
|
649
|
+
# ModelOutputPlaceholder. Reusing it keeps the mapping unchanged.
|
|
650
|
+
return ModelOutputPlaceholder()
|
|
651
|
+
|
|
634
652
|
return ModelPlaceholder()
|
|
635
653
|
|
|
636
654
|
def final_inner(*args, **kwargs):
|
code_loader/leaploader.py
CHANGED
|
@@ -320,9 +320,6 @@ class LeapLoader(LeapLoaderBase):
|
|
|
320
320
|
try:
|
|
321
321
|
self.exec_script()
|
|
322
322
|
|
|
323
|
-
integration_test_test_payload = self._check_integration_test_exists()
|
|
324
|
-
test_payloads.append(integration_test_test_payload)
|
|
325
|
-
|
|
326
323
|
preprocess_test_payload = self._check_preprocess()
|
|
327
324
|
test_payloads.append(preprocess_test_payload)
|
|
328
325
|
handlers_test_payloads = self._check_handlers()
|
|
@@ -359,23 +356,6 @@ class LeapLoader(LeapLoaderBase):
|
|
|
359
356
|
engine_file_contract=EngineFileContract(global_leap_binder.mapping_connections,
|
|
360
357
|
global_leap_binder.leap_analysis_configuration))
|
|
361
358
|
|
|
362
|
-
def _check_integration_test_exists(self) -> DatasetTestResultPayload:
|
|
363
|
-
test_result = DatasetTestResultPayload('integration_test')
|
|
364
|
-
# Only enforced on the Tensorleap platform (i.e. during a push / inspection,
|
|
365
|
-
# where IS_TENSORLEAP_PLATFORM=true). Running code-loader locally or in unit
|
|
366
|
-
# tests must not require the decorator, so pre-decorator integrations and
|
|
367
|
-
# local check runs keep working unchanged.
|
|
368
|
-
is_on_platform = os.environ.get('IS_TENSORLEAP_PLATFORM') == 'true'
|
|
369
|
-
if is_on_platform and global_leap_binder.integration_test_func is None:
|
|
370
|
-
test_result.is_passed = False
|
|
371
|
-
test_result.display[TestingSectionEnum.Errors.name] = (
|
|
372
|
-
"No integration test was found in your integration file. A valid Tensorleap "
|
|
373
|
-
"integration file must define an integration test function decorated with "
|
|
374
|
-
"@tensorleap_integration_test. Without it the integration cannot be validated "
|
|
375
|
-
"and the push is aborted. See the mnist leap_integration.py for a valid example."
|
|
376
|
-
)
|
|
377
|
-
return test_result
|
|
378
|
-
|
|
379
359
|
def _check_preprocess(self) -> DatasetTestResultPayload:
|
|
380
360
|
test_result = DatasetTestResultPayload('preprocess')
|
|
381
361
|
try:
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: code-loader
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.190.dev0
|
|
4
4
|
Summary:
|
|
5
|
-
Home-page: https://github.com/tensorleap/code-loader
|
|
6
5
|
License: MIT
|
|
7
6
|
Author: dorhar
|
|
8
7
|
Author-email: doron.harnoy@tensorleap.ai
|
|
@@ -20,6 +19,7 @@ Requires-Dist: numpy (>=2.3.2,<3.0.0) ; python_version >= "3.11" and python_vers
|
|
|
20
19
|
Requires-Dist: psutil (>=5.9.5,<6.0.0)
|
|
21
20
|
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
22
21
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
22
|
+
Project-URL: Homepage, https://github.com/tensorleap/code-loader
|
|
23
23
|
Project-URL: Repository, https://github.com/tensorleap/code-loader
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
2
1
|
code_loader/__init__.py,sha256=outxRQ0M-zMfV0QGVJmAed5qWfRmyD0TV6-goEGAzBw,406
|
|
3
2
|
code_loader/contract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
3
|
code_loader/contract/datasetclasses.py,sha256=RYZcnX7vLMYhyQtCbX2PscVFNAYULxgAA9U4DRRfLqA,10456
|
|
@@ -22,8 +21,8 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
|
|
|
22
21
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
|
23
22
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
|
24
23
|
code_loader/inner_leap_binder/leapbinder.py,sha256=PAX9cmT1QQV7PWsbY9rMRWktpM7KryfFlwBiSwSskzg,42654
|
|
25
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
|
26
|
-
code_loader/leaploader.py,sha256=
|
|
24
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=lgKJ9cJDuDABscDqLvnqRt7ViU6YeZFcm9996EUosGA,123107
|
|
25
|
+
code_loader/leaploader.py,sha256=K9Q5kiCZ_A2GkS5qOEantAMvWGaz3bmO1X8buXDSpgg,44682
|
|
27
26
|
code_loader/leaploaderbase.py,sha256=l36qDA00GhZEG5NLKpEtAXgWJA-UQQIhNFGxywK7mUA,6530
|
|
28
27
|
code_loader/mixpanel_tracker.py,sha256=rNwRmFifNbdUoqLQvvhhgpKczWpWiEmd8MfyJe27sxw,9131
|
|
29
28
|
code_loader/plot_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -32,7 +31,7 @@ code_loader/plot_functions/visualize.py,sha256=gsBAYYkwMh7jIpJeDMPS8G4CW-pxwx6Lz
|
|
|
32
31
|
code_loader/utils.py,sha256=YecipkdTA-VcE9F0RQcY9cFnY8P3AksPnHM2Db7xUSk,3972
|
|
33
32
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
33
|
code_loader/visualizers/default_visualizers.py,sha256=onRnLE_TXfgLN4o52hQIOOhUcFexGlqJ3xSpQDVLuZM,2604
|
|
35
|
-
code_loader-1.0.
|
|
36
|
-
code_loader-1.0.
|
|
37
|
-
code_loader-1.0.
|
|
38
|
-
code_loader-1.0.
|
|
34
|
+
code_loader-1.0.190.dev0.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
|
35
|
+
code_loader-1.0.190.dev0.dist-info/METADATA,sha256=2Tqb-fK_hBKdjefZN31fYytgQdg3VS9rgcPiwqLsLkc,1107
|
|
36
|
+
code_loader-1.0.190.dev0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
37
|
+
code_loader-1.0.190.dev0.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 TensorLeap
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
File without changes
|