tracebloc 1.2.85__tar.gz → 1.2.86__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 (169) hide show
  1. {tracebloc-1.2.85 → tracebloc-1.2.86}/PKG-INFO +1 -1
  2. {tracebloc-1.2.85 → tracebloc-1.2.86}/pyproject.toml +1 -1
  3. tracebloc-1.2.86/tracebloc/upload/torch_handler.py +74 -0
  4. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_image_classifier.py +2 -52
  5. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_semantic_segmentation.py +2 -52
  6. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_tabular_classifier.py +3 -53
  7. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_tabular_regression.py +3 -53
  8. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_text_classifier.py +2 -2
  9. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_time_to_event.py +3 -53
  10. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_token_classifier.py +2 -2
  11. tracebloc-1.2.86/tracebloc/utils/declared_classes.py +6 -0
  12. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/detection_utils.py +2 -2
  13. tracebloc-1.2.86/tracebloc/validation/estimator_checks.py +16 -0
  14. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/validation/lifelines_checks.py +2 -10
  15. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/validation/scikit_survival_checks.py +2 -10
  16. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/validation/sklearn_checks.py +4 -10
  17. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc.egg-info/PKG-INFO +1 -1
  18. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc.egg-info/SOURCES.txt +3 -0
  19. {tracebloc-1.2.85 → tracebloc-1.2.86}/MANIFEST.in +0 -0
  20. {tracebloc-1.2.85 → tracebloc-1.2.86}/README.md +0 -0
  21. {tracebloc-1.2.85 → tracebloc-1.2.86}/license.txt +0 -0
  22. {tracebloc-1.2.85 → tracebloc-1.2.86}/setup.cfg +0 -0
  23. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/__init__.py +0 -0
  24. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_deprecation.py +0 -0
  25. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_framework_utils.py +0 -0
  26. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_http_utils.py +0 -0
  27. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_link_answer.py +0 -0
  28. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_link_regeneration.py +0 -0
  29. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_linking.py +0 -0
  30. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_raw_width_note.py +0 -0
  31. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_stored_link.py +0 -0
  32. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/_upload_conversion.py +0 -0
  33. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/checks.py +0 -0
  34. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/client.py +0 -0
  35. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/config.py +0 -0
  36. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/contracts/stage_urls.v1.json +0 -0
  37. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/contracts/stage_urls.v1.source.json +0 -0
  38. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/contracts/survival_payload.py +0 -0
  39. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/contracts/training_requirements.source.json +0 -0
  40. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/contracts/training_requirements.txt +0 -0
  41. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/__init__.py +0 -0
  42. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/acceptance.py +0 -0
  43. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/families/__init__.py +0 -0
  44. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/families/hf/__init__.py +0 -0
  45. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/families/hf/_build.py +0 -0
  46. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/families/hf/_model_type.py +0 -0
  47. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/families/tabular.py +0 -0
  48. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/families/vision/__init__.py +0 -0
  49. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/families/vision/_matching.py +0 -0
  50. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/gate.py +0 -0
  51. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/heads.py +0 -0
  52. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/interfaces.py +0 -0
  53. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/licence/__init__.py +0 -0
  54. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/licence/spdx.py +0 -0
  55. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/outputs.py +0 -0
  56. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/__init__.py +0 -0
  57. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/arguments.py +0 -0
  58. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/assemble.py +0 -0
  59. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/checkpoint.py +0 -0
  60. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/gate_rules.py +0 -0
  61. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/generate.py +0 -0
  62. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/head.py +0 -0
  63. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/import_check.py +0 -0
  64. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/layer0.py +0 -0
  65. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/live.py +0 -0
  66. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/model_class.py +0 -0
  67. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/remote.py +0 -0
  68. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/repo.py +0 -0
  69. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/shake.py +0 -0
  70. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/owncode/source_tree.py +0 -0
  71. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/package.py +0 -0
  72. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/report.py +0 -0
  73. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/tokenizers.py +0 -0
  74. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/convert/training_versions.py +0 -0
  75. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/env_login.py +0 -0
  76. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/exceptions.py +0 -0
  77. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/fetch.py +0 -0
  78. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/inference.py +0 -0
  79. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/library_fetch.py +0 -0
  80. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/lifelines_weights.py +0 -0
  81. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/link_model_dataset.py +0 -0
  82. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/notebook/__init__.py +0 -0
  83. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/notebook/templates/_partials.tpl +0 -0
  84. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/notebook/templates/embeddings.tpl +0 -0
  85. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/notebook/templates/nlp_finetune.tpl +0 -0
  86. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/notebook/templates/nlp_generative.tpl +0 -0
  87. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/notebook/templates/survival.tpl +0 -0
  88. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/notebook/templates/tabular_timeseries.tpl +0 -0
  89. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/notebook/templates/vision_from_scratch.tpl +0 -0
  90. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/raw_mode.py +0 -0
  91. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/raw_mode_frame.py +0 -0
  92. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/raw_mode_seed.py +0 -0
  93. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/raw_mode_survival.py +0 -0
  94. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/raw_mode_torch.py +0 -0
  95. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/seed_weights.py +0 -0
  96. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/__init__.py +0 -0
  97. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/augmentation.py +0 -0
  98. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/callbacks.py +0 -0
  99. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/converted.py +0 -0
  100. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/features.py +0 -0
  101. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/image_channels.py +0 -0
  102. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/image_size.py +0 -0
  103. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/lora.py +0 -0
  104. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/lora_validation.py +0 -0
  105. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/loss.py +0 -0
  106. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/memory_estimate.py +0 -0
  107. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/plan.py +0 -0
  108. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/preprocessing.py +0 -0
  109. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/shape.py +0 -0
  110. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/subdataset.py +0 -0
  111. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/submitter.py +0 -0
  112. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/training/summary.py +0 -0
  113. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/__init__.py +0 -0
  114. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/lifelines_time_to_event.py +0 -0
  115. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/model_upload.py +0 -0
  116. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/scikit_survival_time_to_event.py +0 -0
  117. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/sequence_length.py +0 -0
  118. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/skl_tabular_base.py +0 -0
  119. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/skl_tabular_classifier.py +0 -0
  120. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/skl_tabular_regression.py +0 -0
  121. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/statistical_base.py +0 -0
  122. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/survival_base.py +0 -0
  123. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_causal_language_modeler.py +0 -0
  124. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_embeddings.py +0 -0
  125. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_key_point_detector.py +0 -0
  126. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_masked_language_modeler.py +0 -0
  127. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_multi_label_text_classifier.py +0 -0
  128. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_nlp_base.py +0 -0
  129. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_object_detector.py +0 -0
  130. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_sentence_pair_classifier.py +0 -0
  131. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_seq2seq_modeler.py +0 -0
  132. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_time_series_classifier.py +0 -0
  133. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/torch_time_series_forecaster.py +0 -0
  134. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/weight_loaders.py +0 -0
  135. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/upload/weights_parts.py +0 -0
  136. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/user.py +0 -0
  137. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/__init__.py +0 -0
  138. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/class_order.py +0 -0
  139. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/constants.py +0 -0
  140. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/custom_loss_probe.py +0 -0
  141. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/data_probes.py +0 -0
  142. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/device.py +0 -0
  143. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/entry_point.py +0 -0
  144. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/errors.py +0 -0
  145. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/feature_dict.py +0 -0
  146. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/general_utils.py +0 -0
  147. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/key_point_detection_utils.py +0 -0
  148. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/model_loading.py +0 -0
  149. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/model_params.py +0 -0
  150. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/registry.py +0 -0
  151. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/resources.py +0 -0
  152. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/safetensors_io.py +0 -0
  153. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/semantic_segmentation_utils.py +0 -0
  154. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/tabular_classification_utils.py +0 -0
  155. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/tabular_custom_loss_utils.py +0 -0
  156. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/tabular_regression_utils.py +0 -0
  157. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/text_classification_utils.py +0 -0
  158. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/time_series_utils.py +0 -0
  159. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/time_to_event_utils.py +0 -0
  160. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/utils/warnings_once.py +0 -0
  161. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/validation/__init__.py +0 -0
  162. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/validation/checker.py +0 -0
  163. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/validation/header_rules.py +0 -0
  164. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/validation/pytorch_checks.py +0 -0
  165. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc/validation/rewriter.py +0 -0
  166. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc.egg-info/dependency_links.txt +0 -0
  167. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc.egg-info/requires.txt +0 -0
  168. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc.egg-info/top_level.txt +0 -0
  169. {tracebloc-1.2.85 → tracebloc-1.2.86}/tracebloc_package/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebloc
3
- Version: 1.2.85
3
+ Version: 1.2.86
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.85"
7
+ version = "1.2.86"
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"]
@@ -0,0 +1,74 @@
1
+ """Shared constructor for the PyTorch upload handlers that take the plain
2
+ ``Model`` + ``TorchChecks`` keyword set (tabular, time-to-event, image
3
+ classification, semantic segmentation).
4
+
5
+ Registry dispatch and backend's checker fork reference the concrete
6
+ subclass module paths, so every subclass keeps its module and class name;
7
+ only the ``__init__`` chain lives here.
8
+ """
9
+
10
+ from tracebloc.upload.model_upload import Model
11
+ from tracebloc.utils.device import define_device
12
+ from tracebloc.validation.pytorch_checks import TorchChecks
13
+
14
+
15
+ class TorchUploadHandler(Model, TorchChecks):
16
+ """``Model`` then ``TorchChecks`` initialisation for a PyTorch handler.
17
+
18
+ ``_picks_device`` is set by the handlers whose smoke train reads
19
+ ``self.device``; ``define_device`` sets torch's thread count, so the
20
+ others must not call it.
21
+ """
22
+
23
+ _picks_device = False
24
+
25
+ def __init__(
26
+ self,
27
+ model_name,
28
+ client,
29
+ weights,
30
+ model_path,
31
+ tmp_model_file_path,
32
+ tmp_dir_path,
33
+ progress_bar_1,
34
+ classes,
35
+ weights_path,
36
+ model,
37
+ category,
38
+ progress_bar,
39
+ message,
40
+ framework,
41
+ data_shape,
42
+ batch_size,
43
+ model_type,
44
+ num_feature_points,
45
+ ):
46
+ super().__init__(
47
+ model_name=model_name,
48
+ client=client,
49
+ weights=weights,
50
+ model_path=model_path,
51
+ tmp_model_file_path=tmp_model_file_path,
52
+ tmp_dir_path=tmp_dir_path,
53
+ progress_bar_1=progress_bar_1,
54
+ classes=classes,
55
+ weights_path=weights_path,
56
+ framework=framework,
57
+ data_shape=data_shape,
58
+ batch_size=batch_size,
59
+ model_type=model_type,
60
+ num_feature_points=num_feature_points,
61
+ )
62
+ TorchChecks.__init__(
63
+ self,
64
+ model=model,
65
+ category=category,
66
+ progress_bar=progress_bar,
67
+ message=message,
68
+ classes=classes,
69
+ )
70
+ self.__weights_path = weights_path
71
+ self.tmp_file_path = ""
72
+ if self._picks_device:
73
+ self.device = define_device()
74
+ self.loss = None
@@ -2,8 +2,7 @@ import torch
2
2
  from torch import optim
3
3
  from torch.utils.data import DataLoader
4
4
 
5
- from tracebloc.validation.pytorch_checks import TorchChecks
6
- from tracebloc.upload.model_upload import Model
5
+ from tracebloc.upload.torch_handler import TorchUploadHandler
7
6
  from tracebloc.utils.general_utils import (
8
7
  format_exception,
9
8
  light_validation_setup,
@@ -23,56 +22,7 @@ from tracebloc.utils.custom_loss_probe import (
23
22
  )
24
23
 
25
24
 
26
- class TorchImageClassifier(Model, TorchChecks):
27
- def __init__(
28
- self,
29
- model_name,
30
- client,
31
- weights,
32
- model_path,
33
- tmp_model_file_path,
34
- tmp_dir_path,
35
- progress_bar_1,
36
- classes,
37
- weights_path,
38
- model,
39
- category,
40
- progress_bar,
41
- message,
42
- framework,
43
- data_shape,
44
- batch_size,
45
- model_type,
46
- num_feature_points,
47
- ):
48
- super().__init__(
49
- model_name=model_name,
50
- client=client,
51
- weights=weights,
52
- model_path=model_path,
53
- tmp_model_file_path=tmp_model_file_path,
54
- tmp_dir_path=tmp_dir_path,
55
- progress_bar_1=progress_bar_1,
56
- classes=classes,
57
- weights_path=weights_path,
58
- framework=framework,
59
- data_shape=data_shape,
60
- batch_size=batch_size,
61
- model_type=model_type,
62
- num_feature_points=num_feature_points,
63
- )
64
- TorchChecks.__init__(
65
- self,
66
- model=model,
67
- category=category,
68
- progress_bar=progress_bar,
69
- message=message,
70
- classes=classes,
71
- )
72
- self.__weights_path = weights_path
73
- self.tmp_file_path = ""
74
- self.loss = None
75
-
25
+ class TorchImageClassifier(TorchUploadHandler):
76
26
  def small_training_loop(self, weight_filename, custom_loss=False):
77
27
  try:
78
28
  # Define the number of fake images and other properties
@@ -2,8 +2,7 @@ import torch
2
2
  from torch import optim
3
3
  from torch.utils.data import DataLoader
4
4
 
5
- from tracebloc.validation.pytorch_checks import TorchChecks
6
- from tracebloc.upload.model_upload import Model
5
+ from tracebloc.upload.torch_handler import TorchUploadHandler
7
6
  from tracebloc.utils.general_utils import (
8
7
  format_exception,
9
8
  light_validation_setup,
@@ -123,56 +122,7 @@ def _align_mask_to_output(outputs, masks):
123
122
  ).squeeze(1).long()
124
123
 
125
124
 
126
- class TorchSemanticSegmentation(Model, TorchChecks):
127
- def __init__(
128
- self,
129
- model_name,
130
- client,
131
- weights,
132
- model_path,
133
- tmp_model_file_path,
134
- tmp_dir_path,
135
- progress_bar_1,
136
- classes,
137
- weights_path,
138
- model,
139
- category,
140
- progress_bar,
141
- message,
142
- framework,
143
- data_shape,
144
- batch_size,
145
- model_type,
146
- num_feature_points,
147
- ):
148
- super().__init__(
149
- model_name=model_name,
150
- client=client,
151
- weights=weights,
152
- model_path=model_path,
153
- tmp_model_file_path=tmp_model_file_path,
154
- tmp_dir_path=tmp_dir_path,
155
- progress_bar_1=progress_bar_1,
156
- classes=classes,
157
- weights_path=weights_path,
158
- framework=framework,
159
- data_shape=data_shape,
160
- batch_size=batch_size,
161
- model_type=model_type,
162
- num_feature_points=num_feature_points,
163
- )
164
- TorchChecks.__init__(
165
- self,
166
- model=model,
167
- category=category,
168
- progress_bar=progress_bar,
169
- message=message,
170
- classes=classes,
171
- )
172
- self.__weights_path = weights_path
173
- self.tmp_file_path = ""
174
- self.loss = None
175
-
125
+ class TorchSemanticSegmentation(TorchUploadHandler):
176
126
  def small_training_loop(self, weight_filename, custom_loss=False):
177
127
  try:
178
128
  # Create fake semantic segmentation data
@@ -1,11 +1,9 @@
1
1
  from torch import nn, optim
2
- from tracebloc.validation.pytorch_checks import TorchChecks
3
- from tracebloc.upload.model_upload import Model
2
+ from tracebloc.upload.torch_handler import TorchUploadHandler
4
3
  from tracebloc.utils.general_utils import (
5
4
  format_exception,
6
5
  light_validation_setup,
7
6
  get_model_parameters,
8
- define_device,
9
7
  )
10
8
  from tracebloc.utils.constants import (
11
9
  TRAINED_WEIGHTS_FILENAME,
@@ -19,56 +17,8 @@ from tracebloc.utils.tabular_custom_loss_utils import (
19
17
  )
20
18
 
21
19
 
22
- class TorchTabularClassifier(Model, TorchChecks):
23
- def __init__(
24
- self,
25
- model_name,
26
- client,
27
- weights,
28
- model_path,
29
- tmp_model_file_path,
30
- tmp_dir_path,
31
- progress_bar_1,
32
- classes,
33
- weights_path,
34
- model,
35
- category,
36
- progress_bar,
37
- message,
38
- framework,
39
- data_shape,
40
- batch_size,
41
- model_type,
42
- num_feature_points,
43
- ):
44
- super().__init__(
45
- model_name=model_name,
46
- client=client,
47
- weights=weights,
48
- model_path=model_path,
49
- tmp_model_file_path=tmp_model_file_path,
50
- tmp_dir_path=tmp_dir_path,
51
- progress_bar_1=progress_bar_1,
52
- classes=classes,
53
- weights_path=weights_path,
54
- framework=framework,
55
- data_shape=data_shape,
56
- batch_size=batch_size,
57
- model_type=model_type,
58
- num_feature_points=num_feature_points,
59
- )
60
- TorchChecks.__init__(
61
- self,
62
- model=model,
63
- category=category,
64
- progress_bar=progress_bar,
65
- message=message,
66
- classes=classes,
67
- )
68
- self.__weights_path = weights_path
69
- self.tmp_file_path = ""
70
- self.device = define_device()
71
- self.loss = None
20
+ class TorchTabularClassifier(TorchUploadHandler):
21
+ _picks_device = True
72
22
 
73
23
  def small_training_loop(
74
24
  self, weight_filename, custom_loss=False, criterion=None
@@ -1,12 +1,10 @@
1
1
  import torch
2
2
  from torch import nn, optim
3
- from tracebloc.validation.pytorch_checks import TorchChecks
4
- from tracebloc.upload.model_upload import Model
3
+ from tracebloc.upload.torch_handler import TorchUploadHandler
5
4
  from tracebloc.utils.general_utils import (
6
5
  format_exception,
7
6
  light_validation_setup,
8
7
  get_model_parameters,
9
- define_device,
10
8
  )
11
9
  from tracebloc.utils.constants import (
12
10
  TRAINED_WEIGHTS_FILENAME,
@@ -18,56 +16,8 @@ from tracebloc.utils.tabular_custom_loss_utils import (
18
16
  )
19
17
 
20
18
 
21
- class TorchTabularRegression(Model, TorchChecks):
22
- def __init__(
23
- self,
24
- model_name,
25
- client,
26
- weights,
27
- model_path,
28
- tmp_model_file_path,
29
- tmp_dir_path,
30
- progress_bar_1,
31
- classes,
32
- weights_path,
33
- model,
34
- category,
35
- progress_bar,
36
- message,
37
- framework,
38
- data_shape,
39
- batch_size,
40
- model_type,
41
- num_feature_points,
42
- ):
43
- super().__init__(
44
- model_name=model_name,
45
- client=client,
46
- weights=weights,
47
- model_path=model_path,
48
- tmp_model_file_path=tmp_model_file_path,
49
- tmp_dir_path=tmp_dir_path,
50
- progress_bar_1=progress_bar_1,
51
- classes=classes,
52
- weights_path=weights_path,
53
- framework=framework,
54
- data_shape=data_shape,
55
- batch_size=batch_size,
56
- model_type=model_type,
57
- num_feature_points=num_feature_points,
58
- )
59
- TorchChecks.__init__(
60
- self,
61
- model=model,
62
- category=category,
63
- progress_bar=progress_bar,
64
- message=message,
65
- classes=classes,
66
- )
67
- self.__weights_path = weights_path
68
- self.tmp_file_path = ""
69
- self.device = define_device()
70
- self.loss = None
19
+ class TorchTabularRegression(TorchUploadHandler):
20
+ _picks_device = True
71
21
 
72
22
  def small_training_loop(
73
23
  self, weight_filename, custom_loss=False, criterion=None
@@ -7,6 +7,7 @@ from torch.optim import AdamW
7
7
  from tracebloc.upload.torch_nlp_base import TorchNLPModelerBase
8
8
  from tracebloc.validation.pytorch_checks import _MAX_VALIDATION_BATCHES
9
9
  from tracebloc.utils.general_utils import light_validation_setup
10
+ from tracebloc.utils.declared_classes import declared_classes
10
11
  from tracebloc.utils.text_classification_utils import (
11
12
  text_dummy_dataset,
12
13
  CLASSIFICATION_REQUIRED_SPECIAL_TOKENS,
@@ -66,8 +67,7 @@ class TorchTextClassifier(TorchNLPModelerBase):
66
67
  tokenizer_path=getattr(self, "tokenizer_path", None),
67
68
  )
68
69
 
69
- def _custom_loss_probe_size(self):
70
- return self.classes
70
+ _custom_loss_probe_size = declared_classes
71
71
 
72
72
  def _default_smoke_loss(self):
73
73
  return self.configure_loss(custom_loss=False, category=self.category)
@@ -1,12 +1,10 @@
1
1
  import torch
2
2
  from torch import nn, optim
3
- from tracebloc.validation.pytorch_checks import TorchChecks
4
- from tracebloc.upload.model_upload import Model
3
+ from tracebloc.upload.torch_handler import TorchUploadHandler
5
4
  from tracebloc.utils.general_utils import (
6
5
  format_exception,
7
6
  light_validation_setup,
8
7
  get_model_parameters,
9
- define_device,
10
8
  )
11
9
  from tracebloc.utils.constants import (
12
10
  TRAINED_WEIGHTS_FILENAME,
@@ -16,56 +14,8 @@ from tracebloc.utils.time_to_event_utils import get_time_to_event_dataloader
16
14
  from tracebloc.utils.custom_loss_probe import assert_custom_loss_robust
17
15
 
18
16
 
19
- class TorchTimeToEvent(Model, TorchChecks):
20
- def __init__(
21
- self,
22
- model_name,
23
- client,
24
- weights,
25
- model_path,
26
- tmp_model_file_path,
27
- tmp_dir_path,
28
- progress_bar_1,
29
- classes,
30
- weights_path,
31
- model,
32
- category,
33
- progress_bar,
34
- message,
35
- framework,
36
- data_shape,
37
- batch_size,
38
- model_type,
39
- num_feature_points,
40
- ):
41
- super().__init__(
42
- model_name=model_name,
43
- client=client,
44
- weights=weights,
45
- model_path=model_path,
46
- tmp_model_file_path=tmp_model_file_path,
47
- tmp_dir_path=tmp_dir_path,
48
- progress_bar_1=progress_bar_1,
49
- classes=classes,
50
- weights_path=weights_path,
51
- framework=framework,
52
- data_shape=data_shape,
53
- batch_size=batch_size,
54
- model_type=model_type,
55
- num_feature_points=num_feature_points,
56
- )
57
- TorchChecks.__init__(
58
- self,
59
- model=model,
60
- category=category,
61
- progress_bar=progress_bar,
62
- message=message,
63
- classes=classes,
64
- )
65
- self.__weights_path = weights_path
66
- self.tmp_file_path = ""
67
- self.device = define_device()
68
- self.loss = None
17
+ class TorchTimeToEvent(TorchUploadHandler):
18
+ _picks_device = True
69
19
 
70
20
  def small_training_loop(
71
21
  self, weight_filename, custom_loss=False, criterion=None
@@ -1,6 +1,7 @@
1
1
  import torch
2
2
 
3
3
  from tracebloc.upload.torch_nlp_base import TorchNLPModelerBase
4
+ from tracebloc.utils.declared_classes import declared_classes
4
5
  from tracebloc.utils.text_classification_utils import (
5
6
  token_dummy_dataset,
6
7
  call_model_with_optional_mask,
@@ -49,8 +50,7 @@ class TorchTokenClassifier(TorchNLPModelerBase):
49
50
  tokenizer_path=getattr(self, "tokenizer_path", None),
50
51
  )
51
52
 
52
- def _custom_loss_probe_size(self):
53
- return self.classes
53
+ _custom_loss_probe_size = declared_classes
54
54
 
55
55
  def _assert_probe_logits(self, outputs, logits):
56
56
  """Token-classification models must produce
@@ -0,0 +1,6 @@
1
+ """The declared class count, as a method body shared by classes that expose it."""
2
+
3
+
4
+ def declared_classes(self):
5
+ """Return the class count the caller declared (``self.classes``)."""
6
+ return self.classes
@@ -3,6 +3,7 @@ import random
3
3
  import torch
4
4
  from torch.utils.data import Dataset, DataLoader
5
5
  from torchvision import transforms as transforms
6
+ from tracebloc.utils.declared_classes import declared_classes
6
7
 
7
8
  device = torch.device("cpu")
8
9
 
@@ -249,8 +250,7 @@ class FakeObjectDetectionDataset(Dataset):
249
250
  def __iter__(self):
250
251
  return iter(self.data)
251
252
 
252
- def get_classes(self):
253
- return self.classes
253
+ get_classes = declared_classes
254
254
 
255
255
 
256
256
  def create_yolo_dataset(dataset, classes, image_size, S, B):
@@ -0,0 +1,16 @@
1
+ """Shared state for the non-torch framework checks mixins (sklearn,
2
+ lifelines, scikit-survival); each mixin keeps its own support rules."""
3
+
4
+
5
+ class EstimatorChecks:
6
+ """The attributes every estimator checks mixin reads; the signature is the
7
+ one ``StatisticalModelerBase`` calls through ``_checks_class``."""
8
+
9
+ def __init__(self, model, category, message, classes, model_type, progress_bar):
10
+ self.message = message
11
+ self.model = model
12
+ self.category = category
13
+ self.progress_bar = progress_bar
14
+ self.utilisation_category = "low"
15
+ self.classes = classes
16
+ self.model_type = model_type
@@ -1,4 +1,5 @@
1
1
  from tracebloc.utils.constants import LIFELINES_FRAMEWORK
2
+ from tracebloc.validation.estimator_checks import EstimatorChecks
2
3
  from tracebloc.validation.sklearn_checks import final_estimator
3
4
 
4
5
 
@@ -58,16 +59,7 @@ def non_averageable_lifelines_estimator_reason(model):
58
59
  )
59
60
 
60
61
 
61
- class LifelinesChecks:
62
- def __init__(self, model, category, message, classes, model_type, progress_bar):
63
- self.message = message
64
- self.model = model
65
- self.category = category
66
- self.progress_bar = progress_bar
67
- self.utilisation_category = "low"
68
- self.classes = classes
69
- self.model_type = model_type
70
-
62
+ class LifelinesChecks(EstimatorChecks):
71
63
  def is_model_supported(self):
72
64
  """
73
65
  Check if the model is a supported lifelines model.
@@ -1,4 +1,5 @@
1
1
  from tracebloc.utils.constants import SCIKIT_SURVIVAL_FRAMEWORK
2
+ from tracebloc.validation.estimator_checks import EstimatorChecks
2
3
  from tracebloc.validation.sklearn_checks import final_estimator
3
4
 
4
5
 
@@ -73,16 +74,7 @@ def non_averageable_survival_estimator_reason(model):
73
74
  )
74
75
 
75
76
 
76
- class ScikitSurvivalChecks:
77
- def __init__(self, model, category, message, classes, model_type, progress_bar):
78
- self.message = message
79
- self.model = model
80
- self.category = category
81
- self.progress_bar = progress_bar
82
- self.utilisation_category = "low"
83
- self.classes = classes
84
- self.model_type = model_type
85
-
77
+ class ScikitSurvivalChecks(EstimatorChecks):
86
78
  def is_model_supported(self):
87
79
  """
88
80
  Check if the model is a supported scikit_survival model.
@@ -1,3 +1,6 @@
1
+ from tracebloc.validation.estimator_checks import EstimatorChecks
2
+
3
+
1
4
  def _transparent_wrapper_types():
2
5
  """Meta-estimator classes that delegate ``fit``/``predict`` to exactly one
3
6
  inner estimator, so the inner estimator is what actually gets federated.
@@ -391,16 +394,7 @@ def non_averageable_estimator_reason(model):
391
394
  return None
392
395
 
393
396
 
394
- class SklearnChecks:
395
- def __init__(self, model, category, message, classes, model_type, progress_bar):
396
- self.message = message
397
- self.model = model
398
- self.category = category
399
- self.progress_bar = progress_bar
400
- self.utilisation_category = "low"
401
- self.classes = classes
402
- self.model_type = model_type
403
-
397
+ class SklearnChecks(EstimatorChecks):
404
398
  def is_model_supported(self):
405
399
  from sklearn.base import is_classifier, is_regressor
406
400
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebloc
3
- Version: 1.2.85
3
+ Version: 1.2.86
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
@@ -110,6 +110,7 @@ tracebloc/upload/statistical_base.py
110
110
  tracebloc/upload/survival_base.py
111
111
  tracebloc/upload/torch_causal_language_modeler.py
112
112
  tracebloc/upload/torch_embeddings.py
113
+ tracebloc/upload/torch_handler.py
113
114
  tracebloc/upload/torch_image_classifier.py
114
115
  tracebloc/upload/torch_key_point_detector.py
115
116
  tracebloc/upload/torch_masked_language_modeler.py
@@ -133,6 +134,7 @@ tracebloc/utils/class_order.py
133
134
  tracebloc/utils/constants.py
134
135
  tracebloc/utils/custom_loss_probe.py
135
136
  tracebloc/utils/data_probes.py
137
+ tracebloc/utils/declared_classes.py
136
138
  tracebloc/utils/detection_utils.py
137
139
  tracebloc/utils/device.py
138
140
  tracebloc/utils/entry_point.py
@@ -155,6 +157,7 @@ tracebloc/utils/time_to_event_utils.py
155
157
  tracebloc/utils/warnings_once.py
156
158
  tracebloc/validation/__init__.py
157
159
  tracebloc/validation/checker.py
160
+ tracebloc/validation/estimator_checks.py
158
161
  tracebloc/validation/header_rules.py
159
162
  tracebloc/validation/lifelines_checks.py
160
163
  tracebloc/validation/pytorch_checks.py
File without changes
File without changes
File without changes
File without changes