tracebloc 1.2.78__tar.gz → 1.2.79__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.
Files changed (158) hide show
  1. {tracebloc-1.2.78 → tracebloc-1.2.79}/PKG-INFO +1 -1
  2. {tracebloc-1.2.78 → tracebloc-1.2.79}/pyproject.toml +1 -1
  3. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/families/tabular.py +34 -34
  4. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc.egg-info/PKG-INFO +1 -1
  5. {tracebloc-1.2.78 → tracebloc-1.2.79}/MANIFEST.in +0 -0
  6. {tracebloc-1.2.78 → tracebloc-1.2.79}/README.md +0 -0
  7. {tracebloc-1.2.78 → tracebloc-1.2.79}/license.txt +0 -0
  8. {tracebloc-1.2.78 → tracebloc-1.2.79}/setup.cfg +0 -0
  9. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/__init__.py +0 -0
  10. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_deprecation.py +0 -0
  11. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_framework_utils.py +0 -0
  12. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_http_utils.py +0 -0
  13. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_link_answer.py +0 -0
  14. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_link_regeneration.py +0 -0
  15. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_linking.py +0 -0
  16. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_raw_width_note.py +0 -0
  17. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_stored_link.py +0 -0
  18. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/_upload_conversion.py +0 -0
  19. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/checks.py +0 -0
  20. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/client.py +0 -0
  21. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/config.py +0 -0
  22. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/contracts/stage_urls.v1.json +0 -0
  23. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/contracts/stage_urls.v1.source.json +0 -0
  24. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/contracts/survival_payload.py +0 -0
  25. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/contracts/training_requirements.source.json +0 -0
  26. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/contracts/training_requirements.txt +0 -0
  27. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/__init__.py +0 -0
  28. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/acceptance.py +0 -0
  29. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/families/__init__.py +0 -0
  30. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/families/hf/__init__.py +0 -0
  31. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/families/hf/_build.py +0 -0
  32. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/families/hf/_model_type.py +0 -0
  33. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/families/vision/__init__.py +0 -0
  34. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/families/vision/_matching.py +0 -0
  35. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/gate.py +0 -0
  36. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/heads.py +0 -0
  37. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/interfaces.py +0 -0
  38. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/licence/__init__.py +0 -0
  39. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/licence/spdx.py +0 -0
  40. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/outputs.py +0 -0
  41. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/__init__.py +0 -0
  42. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/arguments.py +0 -0
  43. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/assemble.py +0 -0
  44. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/checkpoint.py +0 -0
  45. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/gate_rules.py +0 -0
  46. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/generate.py +0 -0
  47. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/head.py +0 -0
  48. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/import_check.py +0 -0
  49. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/layer0.py +0 -0
  50. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/live.py +0 -0
  51. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/model_class.py +0 -0
  52. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/remote.py +0 -0
  53. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/repo.py +0 -0
  54. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/shake.py +0 -0
  55. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/owncode/source_tree.py +0 -0
  56. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/package.py +0 -0
  57. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/report.py +0 -0
  58. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/tokenizers.py +0 -0
  59. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/convert/training_versions.py +0 -0
  60. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/env_login.py +0 -0
  61. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/exceptions.py +0 -0
  62. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/fetch.py +0 -0
  63. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/inference.py +0 -0
  64. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/library_fetch.py +0 -0
  65. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/lifelines_weights.py +0 -0
  66. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/link_model_dataset.py +0 -0
  67. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/notebook/__init__.py +0 -0
  68. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/notebook/templates/_partials.tpl +0 -0
  69. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/notebook/templates/embeddings.tpl +0 -0
  70. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/notebook/templates/nlp_finetune.tpl +0 -0
  71. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/notebook/templates/nlp_generative.tpl +0 -0
  72. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/notebook/templates/survival.tpl +0 -0
  73. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/notebook/templates/tabular_timeseries.tpl +0 -0
  74. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/notebook/templates/vision_from_scratch.tpl +0 -0
  75. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/raw_mode.py +0 -0
  76. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/raw_mode_frame.py +0 -0
  77. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/raw_mode_seed.py +0 -0
  78. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/raw_mode_survival.py +0 -0
  79. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/raw_mode_torch.py +0 -0
  80. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/seed_weights.py +0 -0
  81. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/__init__.py +0 -0
  82. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/augmentation.py +0 -0
  83. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/callbacks.py +0 -0
  84. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/converted.py +0 -0
  85. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/features.py +0 -0
  86. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/image_size.py +0 -0
  87. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/lora.py +0 -0
  88. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/lora_validation.py +0 -0
  89. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/loss.py +0 -0
  90. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/memory_estimate.py +0 -0
  91. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/plan.py +0 -0
  92. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/preprocessing.py +0 -0
  93. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/shape.py +0 -0
  94. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/subdataset.py +0 -0
  95. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/submitter.py +0 -0
  96. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/training/summary.py +0 -0
  97. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/__init__.py +0 -0
  98. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/lifelines_time_to_event.py +0 -0
  99. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/model_upload.py +0 -0
  100. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/scikit_survival_time_to_event.py +0 -0
  101. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/sequence_length.py +0 -0
  102. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/skl_tabular_base.py +0 -0
  103. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/skl_tabular_classifier.py +0 -0
  104. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/skl_tabular_regression.py +0 -0
  105. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/statistical_base.py +0 -0
  106. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/survival_base.py +0 -0
  107. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_causal_language_modeler.py +0 -0
  108. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_embeddings.py +0 -0
  109. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_image_classifier.py +0 -0
  110. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_key_point_detector.py +0 -0
  111. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_masked_language_modeler.py +0 -0
  112. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_nlp_base.py +0 -0
  113. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_object_detector.py +0 -0
  114. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_semantic_segmentation.py +0 -0
  115. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_sentence_pair_classifier.py +0 -0
  116. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_seq2seq_modeler.py +0 -0
  117. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_tabular_classifier.py +0 -0
  118. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_tabular_regression.py +0 -0
  119. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_text_classifier.py +0 -0
  120. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_time_series_classifier.py +0 -0
  121. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_time_series_forecaster.py +0 -0
  122. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_time_to_event.py +0 -0
  123. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/torch_token_classifier.py +0 -0
  124. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/weight_loaders.py +0 -0
  125. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/upload/weights_parts.py +0 -0
  126. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/user.py +0 -0
  127. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/__init__.py +0 -0
  128. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/class_order.py +0 -0
  129. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/constants.py +0 -0
  130. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/custom_loss_probe.py +0 -0
  131. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/detection_utils.py +0 -0
  132. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/entry_point.py +0 -0
  133. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/feature_dict.py +0 -0
  134. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/general_utils.py +0 -0
  135. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/key_point_detection_utils.py +0 -0
  136. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/registry.py +0 -0
  137. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/safetensors_io.py +0 -0
  138. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/semantic_segmentation_utils.py +0 -0
  139. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/tabular_classification_utils.py +0 -0
  140. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/tabular_custom_loss_utils.py +0 -0
  141. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/tabular_regression_utils.py +0 -0
  142. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/text_classification_utils.py +0 -0
  143. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/time_series_utils.py +0 -0
  144. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/time_to_event_utils.py +0 -0
  145. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/utils/warnings_once.py +0 -0
  146. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/validation/__init__.py +0 -0
  147. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/validation/checker.py +0 -0
  148. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/validation/header_rules.py +0 -0
  149. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/validation/lifelines_checks.py +0 -0
  150. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/validation/pytorch_checks.py +0 -0
  151. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/validation/rewriter.py +0 -0
  152. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/validation/scikit_survival_checks.py +0 -0
  153. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc/validation/sklearn_checks.py +0 -0
  154. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc.egg-info/SOURCES.txt +0 -0
  155. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc.egg-info/dependency_links.txt +0 -0
  156. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc.egg-info/requires.txt +0 -0
  157. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc.egg-info/top_level.txt +0 -0
  158. {tracebloc-1.2.78 → tracebloc-1.2.79}/tracebloc_package/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebloc
3
- Version: 1.2.78
3
+ Version: 1.2.79
4
4
  Summary: Build AI with anyone. On data that can't move. SDK for the tracebloc collaborative AI workspace.
5
5
  Author-email: tracebloc <lukas@tracebloc.io>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tracebloc"
7
- version = "1.2.78"
7
+ version = "1.2.79"
8
8
  description = "Build AI with anyone. On data that can't move. SDK for the tracebloc collaborative AI workspace."
9
9
  license = "MIT"
10
10
  license-files = ["license.txt"]
@@ -1,11 +1,8 @@
1
1
  """Fitted scikit-learn, XGBoost, LightGBM, CatBoost, lifelines and scikit-survival models.
2
2
 
3
- A fitted estimator or ``Pipeline``, live or saved, becomes the template the
4
- model zoo writes by hand for its framework: ``MyModel`` builds the estimator
5
- from its own parameters, and the fitted model ships as the weights. A fitted
6
- estimator serves the tabular task of its type (classifier, regressor or
7
- survival model); the use case picks among the tasks that share that type.
8
- """
3
+ A fitted estimator or ``Pipeline`` becomes its framework's zoo template: ``MyModel``
4
+ builds the estimator from its own parameters, and the fitted model ships as the
5
+ weights. It serves the tabular task of its type: classifier, regressor or survival."""
9
6
 
10
7
  from __future__ import annotations
11
8
 
@@ -26,7 +23,9 @@ from tracebloc.convert.interfaces import (
26
23
  GeneratedPackage, Proof, Provenance, Recognition, RefusalCause, SourcedValue,
27
24
  UseCaseTask, ValueSource,
28
25
  )
26
+ from tracebloc._framework_utils import extra_for_module
29
27
  from tracebloc.utils.constants import Framework, TaskCategory
28
+ from tracebloc.utils.general_utils import format_exception
30
29
 
31
30
  #: The libraries whose fitted models this family reads, by top-level module.
32
31
  FRAMEWORK_OF_ROOT = {
@@ -78,6 +77,9 @@ _FUNCTIONS = frozenset(
78
77
 
79
78
  _KNOWN_ROOTS = frozenset(FRAMEWORK_OF_ROOT) | _DATA_ROOTS
80
79
  _PICKLE_SUFFIXES = (".pkl", ".pickle", ".joblib")
80
+ _JOBLIB_LOCK = threading.Lock()
81
+ #: Each library's own error for saved model bytes its loader cannot read.
82
+ _LOAD_ERRORS = (("xgboost.core", "XGBoostError"), ("lightgbm.basic", "LightGBMError"), ("catboost", "CatBoostError"))
81
83
  _FROM_MODEL = Provenance(ValueSource.MODEL, "fitted estimator", verified=True)
82
84
 
83
85
 
@@ -111,11 +113,7 @@ class _Allowlisted:
111
113
  raise _UnloadableError(module, name)
112
114
 
113
115
 
114
- class _Unpickler(_Allowlisted, pickle.Unpickler):
115
- pass
116
-
117
-
118
- _JOBLIB_LOCK = threading.Lock()
116
+ class _Unpickler(_Allowlisted, pickle.Unpickler): ...
119
117
 
120
118
 
121
119
  def _load_pickled(path: Path) -> Any:
@@ -155,8 +153,21 @@ def _load(source: ConversionInput) -> Any:
155
153
  f"{path.name} names {refused} in its saved state, which training does "
156
154
  f"not load; pass the fitted model object itself instead",
157
155
  ) from None
158
- except (pickle.UnpicklingError, EOFError, ValueError, IndexError, ImportError, AttributeError, TypeError):
159
- return None
156
+ except ModuleNotFoundError as missing:
157
+ if missing.name not in _KNOWN_ROOTS:
158
+ return None # a part of an installed library that this version lacks
159
+ install = f"tracebloc[{extra}]" if (extra := extra_for_module(missing.name)) else missing.name
160
+ message = f"{path.name} needs {missing.name}, which is not installed: pip install '{install}'"
161
+ raise ConversionRefusedError(RefusalCause.VERSIONS, message) from None
162
+ except Exception as error:
163
+ loaded = (getattr(sys.modules.get(m), n, None) for m, n in _LOAD_ERRORS)
164
+ if isinstance(error, tuple(c for c in loaded if isinstance(c, type))):
165
+ detail = " ".join(format_exception(error).split())[:120]
166
+ message = f"{path.name} holds model bytes its library cannot read ({detail})"
167
+ raise ConversionRefusedError(RefusalCause.NO_SOURCE, f"{message}; save it again") from None
168
+ if isinstance(error, (pickle.UnpicklingError, EOFError, ValueError, IndexError, ImportError, AttributeError, TypeError)):
169
+ return None
170
+ raise
160
171
 
161
172
 
162
173
  def _root(cls: type) -> str:
@@ -214,9 +225,7 @@ def _kind(model: Any, framework: Framework) -> str | None:
214
225
  return "survival"
215
226
  from sklearn.base import is_classifier, is_regressor
216
227
 
217
- if is_classifier(model):
218
- return "classifier"
219
- return "regressor" if is_regressor(model) else None
228
+ return "classifier" if is_classifier(model) else "regressor" if is_regressor(model) else None
220
229
 
221
230
 
222
231
  def _feature_count(model: Any, framework: Framework) -> int | None:
@@ -374,11 +383,9 @@ class TabularFamily:
374
383
  framework, terminal = recognition.framework, _terminal(model)
375
384
  estimator = recognition.values["entry_point"].value
376
385
  _check_task(estimator, framework, kind, task.category)
377
- category_origin = (
378
- Provenance(ValueSource.DATASET, "use case", verified=True)
379
- if task.from_use_case
380
- else Provenance(ValueSource.MODEL, "estimator type")
381
- )
386
+ category_origin = Provenance(ValueSource.DATASET, "use case", verified=True)
387
+ if not task.from_use_case:
388
+ category_origin = Provenance(ValueSource.MODEL, "estimator type")
382
389
  header = {"framework": SourcedValue(framework, _FROM_MODEL)}
383
390
  header["category"] = SourcedValue(task.category, category_origin)
384
391
  header.update(_counts(recognition, task))
@@ -430,11 +437,8 @@ def _check_task(estimator: str, framework: Framework, kind: str | None, task: Ta
430
437
 
431
438
 
432
439
  def _counts(recognition: Recognition, task: UseCaseTask) -> dict[str, SourcedValue]:
433
- """The counts the header needs: the model's, held to the dataset's.
434
-
435
- A fitted model cannot take another feature or class count, so a dataset
436
- that disagrees is refused; lifelines fits whatever covariates it is given.
437
- """
440
+ """The counts the header needs: the model's, held to the dataset's. A fitted model
441
+ cannot take another count; lifelines fits whatever covariates it is given."""
438
442
  from tracebloc.validation.header_rules import required_values
439
443
 
440
444
  estimator = recognition.values["entry_point"].value
@@ -470,11 +474,9 @@ def _write_weights(model: Any, path: Path, notes: list[str]) -> Path | None:
470
474
  try:
471
475
  _Unpickler(io.BytesIO(data)).load()
472
476
  except _UnloadableError as refused:
473
- notes.append(
474
- f"The fitted {type(_terminal(model)).__name__} is not shipped: its saved "
475
- f"state names {refused}, which training does not load. Training fits it "
476
- f"from the dataset."
477
- )
477
+ name = type(_terminal(model)).__name__
478
+ notes.append(f"The fitted {name} is not shipped: its saved state names {refused}, "
479
+ "which training does not load. Training fits it from the dataset.")
478
480
  return None
479
481
  path.write_bytes(data)
480
482
  return path
@@ -491,9 +493,7 @@ def _averaging_notes(model: Any, framework: Framework) -> list[str]:
491
493
  if framework is Framework.SKLEARN:
492
494
  from tracebloc.validation.sklearn_checks import non_averageable_estimator_reason
493
495
 
494
- reason = non_averageable_estimator_reason(model)
495
- if reason:
496
- notes.append(reason)
496
+ notes.extend(filter(None, [non_averageable_estimator_reason(model)]))
497
497
  return notes
498
498
 
499
499
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebloc
3
- Version: 1.2.78
3
+ Version: 1.2.79
4
4
  Summary: Build AI with anyone. On data that can't move. SDK for the tracebloc collaborative AI workspace.
5
5
  Author-email: tracebloc <lukas@tracebloc.io>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes