tracebloc 6.0.2__tar.gz → 6.0.3__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 (217) hide show
  1. {tracebloc-6.0.2 → tracebloc-6.0.3}/PKG-INFO +1 -1
  2. {tracebloc-6.0.2 → tracebloc-6.0.3}/pyproject.toml +1 -1
  3. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/gate.py +2 -1
  4. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/licence/__init__.py +2 -1
  5. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/inference.py +21 -10
  6. tracebloc-6.0.3/tracebloc/upload/torch_image_classifier.py +73 -0
  7. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_semantic_segmentation.py +44 -77
  8. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_smoke_loop.py +10 -1
  9. tracebloc-6.0.3/tracebloc/upload/torch_time_series_classifier.py +145 -0
  10. tracebloc-6.0.3/tracebloc/upload/torch_time_series_forecaster.py +138 -0
  11. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc.egg-info/PKG-INFO +1 -1
  12. tracebloc-6.0.2/tracebloc/upload/torch_image_classifier.py +0 -104
  13. tracebloc-6.0.2/tracebloc/upload/torch_time_series_classifier.py +0 -198
  14. tracebloc-6.0.2/tracebloc/upload/torch_time_series_forecaster.py +0 -194
  15. {tracebloc-6.0.2 → tracebloc-6.0.3}/MANIFEST.in +0 -0
  16. {tracebloc-6.0.2 → tracebloc-6.0.3}/README.md +0 -0
  17. {tracebloc-6.0.2 → tracebloc-6.0.3}/license.txt +0 -0
  18. {tracebloc-6.0.2 → tracebloc-6.0.3}/setup.cfg +0 -0
  19. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/__init__.py +0 -0
  20. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/api/__init__.py +0 -0
  21. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/api/experiment_status.py +0 -0
  22. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/api/responses.py +0 -0
  23. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/auth/__init__.py +0 -0
  24. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/auth/env_login.py +0 -0
  25. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/checks.py +0 -0
  26. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/client.py +0 -0
  27. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/compat/__init__.py +0 -0
  28. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/compat/deprecation.py +0 -0
  29. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/compat/frameworks.py +0 -0
  30. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/config.py +0 -0
  31. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/console/__init__.py +0 -0
  32. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/console/logger.py +0 -0
  33. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/contracts/stage_urls.v1.json +0 -0
  34. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/contracts/stage_urls.v1.source.json +0 -0
  35. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/contracts/survival_payload.py +0 -0
  36. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/contracts/training_requirements.source.json +0 -0
  37. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/contracts/training_requirements.txt +0 -0
  38. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/__init__.py +0 -0
  39. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/acceptance.py +0 -0
  40. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/families/__init__.py +0 -0
  41. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/families/hf/__init__.py +0 -0
  42. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/families/hf/_build.py +0 -0
  43. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/families/hf/_model_type.py +0 -0
  44. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/families/tabular.py +0 -0
  45. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/families/vision/__init__.py +0 -0
  46. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/families/vision/_matching.py +0 -0
  47. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/heads.py +0 -0
  48. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/interfaces.py +0 -0
  49. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/licence/spdx.py +0 -0
  50. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/outputs.py +0 -0
  51. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/__init__.py +0 -0
  52. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/arguments.py +0 -0
  53. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/assemble.py +0 -0
  54. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/checkpoint.py +0 -0
  55. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/gate_rules.py +0 -0
  56. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/generate.py +0 -0
  57. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/head.py +0 -0
  58. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/import_check.py +0 -0
  59. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/layer0.py +0 -0
  60. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/live.py +0 -0
  61. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/model_class.py +0 -0
  62. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/remote.py +0 -0
  63. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/repo.py +0 -0
  64. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/shake.py +0 -0
  65. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/owncode/source_tree.py +0 -0
  66. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/package.py +0 -0
  67. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/padding.py +0 -0
  68. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/report.py +0 -0
  69. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/tokenizers.py +0 -0
  70. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/convert/training_versions.py +0 -0
  71. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/__init__.py +0 -0
  72. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/base.py +0 -0
  73. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/detection.py +0 -0
  74. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/keypoint_detection.py +0 -0
  75. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/semantic_segmentation.py +0 -0
  76. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/tabular.py +0 -0
  77. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/text.py +0 -0
  78. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/time_series.py +0 -0
  79. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/datasets/time_to_event.py +0 -0
  80. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/downloads/lifelines_weights.py +0 -0
  81. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/downloads/seed_weights.py +0 -0
  82. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/exceptions.py +0 -0
  83. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/fetch.py +0 -0
  84. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/__init__.py +0 -0
  85. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/answer.py +0 -0
  86. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/augmentation_methods.py +0 -0
  87. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/check_model.py +0 -0
  88. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/conversion.py +0 -0
  89. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/data_methods.py +0 -0
  90. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/library.py +0 -0
  91. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/link_checks.py +0 -0
  92. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/model_dataset.py +0 -0
  93. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/regeneration.py +0 -0
  94. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/response.py +0 -0
  95. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/stored.py +0 -0
  96. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/training_methods.py +0 -0
  97. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/linking/user_methods.py +0 -0
  98. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/notebook/__init__.py +0 -0
  99. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/notebook/templates/_partials.tpl +0 -0
  100. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/notebook/templates/embeddings.tpl +0 -0
  101. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/notebook/templates/nlp_finetune.tpl +0 -0
  102. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/notebook/templates/nlp_generative.tpl +0 -0
  103. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/notebook/templates/survival.tpl +0 -0
  104. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/notebook/templates/tabular_timeseries.tpl +0 -0
  105. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/notebook/templates/vision_from_scratch.tpl +0 -0
  106. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/__init__.py +0 -0
  107. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/classes.py +0 -0
  108. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/declaration.py +0 -0
  109. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/fitted_model.py +0 -0
  110. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/frame_recording.py +0 -0
  111. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/link_check.py +0 -0
  112. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/pairs.py +0 -0
  113. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/schema.py +0 -0
  114. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/seed_prefixes.py +0 -0
  115. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/sklearn_check.py +0 -0
  116. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/survival.py +0 -0
  117. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/torch_checks.py +0 -0
  118. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/raw_mode/width_note.py +0 -0
  119. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/__init__.py +0 -0
  120. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/augmentation.py +0 -0
  121. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/callbacks.py +0 -0
  122. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/converted.py +0 -0
  123. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/features.py +0 -0
  124. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/image_channels.py +0 -0
  125. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/image_size.py +0 -0
  126. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/link_total.py +0 -0
  127. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/lora.py +0 -0
  128. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/lora_validation.py +0 -0
  129. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/loss.py +0 -0
  130. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/loss_policy.py +0 -0
  131. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/loss_source.py +0 -0
  132. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/memory_estimate.py +0 -0
  133. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/memory_sizing.py +0 -0
  134. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/plan.py +0 -0
  135. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/preprocessing.py +0 -0
  136. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/shape.py +0 -0
  137. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/subdataset.py +0 -0
  138. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/submitter.py +0 -0
  139. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/training/summary.py +0 -0
  140. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/__init__.py +0 -0
  141. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/lifelines_time_to_event.py +0 -0
  142. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/loss_config.py +0 -0
  143. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/model_params.py +0 -0
  144. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/model_upload.py +0 -0
  145. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/nlp_probes.py +0 -0
  146. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/scikit_survival_time_to_event.py +0 -0
  147. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/sequence_length.py +0 -0
  148. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/skl_tabular_base.py +0 -0
  149. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/skl_tabular_classifier.py +0 -0
  150. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/skl_tabular_regression.py +0 -0
  151. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/statistical_base.py +0 -0
  152. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/survival_base.py +0 -0
  153. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_causal_language_modeler.py +0 -0
  154. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_embeddings.py +0 -0
  155. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_handler.py +0 -0
  156. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_key_point_detector.py +0 -0
  157. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_masked_language_modeler.py +0 -0
  158. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_multi_label_text_classifier.py +0 -0
  159. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_nlp_base.py +0 -0
  160. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_object_detector.py +0 -0
  161. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_sentence_pair_classifier.py +0 -0
  162. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_seq2seq_modeler.py +0 -0
  163. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_tabular_classifier.py +0 -0
  164. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_tabular_regression.py +0 -0
  165. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_text_classifier.py +0 -0
  166. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_text_regressor.py +0 -0
  167. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_time_to_event.py +0 -0
  168. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/torch_token_classifier.py +0 -0
  169. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/user_methods.py +0 -0
  170. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/weight_loaders.py +0 -0
  171. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/weights_averaging.py +0 -0
  172. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/weights_check.py +0 -0
  173. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/upload/weights_parts.py +0 -0
  174. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/user.py +0 -0
  175. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/__init__.py +0 -0
  176. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/class_order.py +0 -0
  177. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/constants.py +0 -0
  178. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/custom_loss_probe.py +0 -0
  179. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/data_probes.py +0 -0
  180. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/declared_classes.py +0 -0
  181. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/declared_cls.py +0 -0
  182. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/detection_utils.py +0 -0
  183. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/device.py +0 -0
  184. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/entry_point.py +0 -0
  185. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/errors.py +0 -0
  186. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/feature_dict.py +0 -0
  187. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/loss_shape.py +0 -0
  188. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/model_loading.py +0 -0
  189. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/model_params.py +0 -0
  190. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/nlp_model_probes.py +0 -0
  191. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/registry.py +0 -0
  192. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/resources.py +0 -0
  193. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/safetensors_io.py +0 -0
  194. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/staging.py +0 -0
  195. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/synthetic_self_supervised.py +0 -0
  196. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/synthetic_text.py +0 -0
  197. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/tabular_classification_utils.py +0 -0
  198. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/tabular_custom_loss_utils.py +0 -0
  199. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/tabular_regression_utils.py +0 -0
  200. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/text_classification_utils.py +0 -0
  201. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/time_series_utils.py +0 -0
  202. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/time_to_event_utils.py +0 -0
  203. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/tokenizer_checks.py +0 -0
  204. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/utils/warnings_once.py +0 -0
  205. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/__init__.py +0 -0
  206. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/checker.py +0 -0
  207. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/estimator_checks.py +0 -0
  208. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/header_rules.py +0 -0
  209. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/lifelines_checks.py +0 -0
  210. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/pytorch_checks.py +0 -0
  211. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/rewriter.py +0 -0
  212. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/scikit_survival_checks.py +0 -0
  213. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc/validation/sklearn_checks.py +0 -0
  214. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc.egg-info/SOURCES.txt +0 -0
  215. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc.egg-info/dependency_links.txt +0 -0
  216. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc.egg-info/requires.txt +0 -0
  217. {tracebloc-6.0.2 → tracebloc-6.0.3}/tracebloc.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebloc
3
- Version: 6.0.2
3
+ Version: 6.0.3
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 = "6.0.2"
7
+ version = "6.0.3"
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"]
@@ -26,6 +26,7 @@ from dataclasses import dataclass, replace
26
26
  from pathlib import Path
27
27
  from typing import Any, Sequence
28
28
 
29
+ from tracebloc.console.logger import say
29
30
  from tracebloc.convert.interfaces import (
30
31
  CheckFinding,
31
32
  ConversionInput,
@@ -495,5 +496,5 @@ def upload_file_for(model_path: str, conversion: ConversionOutcome | None) -> st
495
496
  )
496
497
  if conversion.converted:
497
498
  require_confirmation(conversion.licence, conversion.report)
498
- print(licence_line(conversion.licence))
499
+ say(licence_line(conversion.licence))
499
500
  return model_path
@@ -20,6 +20,7 @@ from datetime import datetime, timezone
20
20
  from pathlib import Path
21
21
  from typing import Any, Callable, Mapping
22
22
 
23
+ from tracebloc.console.logger import say
23
24
  from tracebloc.convert.interfaces import (
24
25
  ConversionInput,
25
26
  ConversionRefusedError,
@@ -477,7 +478,7 @@ def ask_to_confirm(licence: Licence, ask: Callable[[str], str] = input) -> bool:
477
478
  return False
478
479
  if get_ipython() is None:
479
480
  return False
480
- print(licence_line(licence))
481
+ say(licence_line(licence))
481
482
  answer = ask(f"{statement(licence)} Confirm? [y/N] ")
482
483
  return answer.strip().lower() in ("y", "yes")
483
484
 
@@ -373,6 +373,22 @@ def user_run_inference(
373
373
  the platform (a gateway 502/504, a 5xx without its reason): the
374
374
  run may have started, so check My Submissions before retrying.
375
375
  """
376
+ _check_run_arguments(model, template, name, data_type)
377
+ client = self._User__session_client()
378
+ plan = _linked_plan(self, dataset_id, model, template, data_type)
379
+ return run_inference(
380
+ client,
381
+ dataset_id,
382
+ model_name=self._User__model_id,
383
+ name=name if name is not None else default_run_name(model or template),
384
+ framework=self._User__framework,
385
+ template=template,
386
+ fields=experiment_fields(plan),
387
+ )
388
+
389
+
390
+ def _check_run_arguments(model, template, name, data_type) -> None:
391
+ """Refuse a run's arguments before anything is fetched or linked."""
376
392
  if (model is None) == (template is None):
377
393
  raise ValueError(
378
394
  "Pass exactly one of model= (your Run tab upload) or template= "
@@ -389,7 +405,10 @@ def user_run_inference(
389
405
  raise ValueError(
390
406
  f"data_type must be one of {list(IMAGE_DATA_TYPES)}, not {data_type!r}."
391
407
  )
392
- client = self._User__session_client()
408
+
409
+
410
+ def _linked_plan(self, dataset_id, model, template, data_type):
411
+ """Link the model to the dataset and set its image mode; refuse an ineligible plan."""
393
412
  with _without_training_prompt(data_type_given=data_type is not None):
394
413
  plan = self.link_model_dataset(dataset_id, model=model, template=template)
395
414
  if data_type is not None:
@@ -406,12 +425,4 @@ def user_run_inference(
406
425
  "reported above before calling run_inference() (an image model's "
407
426
  "input channels are matched with data_type=)."
408
427
  )
409
- return run_inference(
410
- client,
411
- dataset_id,
412
- model_name=self._User__model_id,
413
- name=name if name is not None else default_run_name(model or template),
414
- framework=self._User__framework,
415
- template=template,
416
- fields=experiment_fields(plan),
417
- )
428
+ return plan
@@ -0,0 +1,73 @@
1
+ import torch
2
+ from torch import optim
3
+ from torch.utils.data import DataLoader
4
+
5
+ from tracebloc.upload.torch_handler import TorchUploadHandler
6
+ from tracebloc.utils.device import light_validation_setup, define_device
7
+ from tracebloc.utils.data_probes import dummy_dataset_pytorch, detect_input_channels
8
+ from tracebloc.utils.custom_loss_probe import (
9
+ assert_finite_scalar_loss,
10
+ assert_custom_loss_robust,
11
+ classification_loss_contract,
12
+ )
13
+
14
+
15
+ class TorchImageClassifier(TorchUploadHandler):
16
+ def _smoke_train(self, custom_loss, criterion):
17
+ # Use the model's NATIVE input-channel count so a grayscale
18
+ # (1-channel) model is validated with 1-channel dummy data
19
+ # instead of being false-rejected by hardcoded 3-channel data.
20
+ num_channels = detect_input_channels(self.model)
21
+ train_dataset = dummy_dataset_pytorch(
22
+ data_shape=self.data_shape,
23
+ num_classes=self.classes,
24
+ num_channels=num_channels,
25
+ category=self.category,
26
+ model_type=self.model_type,
27
+ tmp_path=self.tmp_dir_path,
28
+ )
29
+
30
+ train_loader = DataLoader(
31
+ train_dataset, batch_size=self.batch_size, shuffle=True
32
+ )
33
+
34
+ self.loss = self.configure_loss(
35
+ custom_loss=custom_loss, category=self.category
36
+ )
37
+
38
+ # A custom loss runs in the loop below, so one that RAISES or returns
39
+ # a non-scalar is already caught (by the call / by backward). But a
40
+ # loss that returns NaN/Inf trains silently — backward() on a
41
+ # non-finite loss does not raise — so it would pass upload, ship to
42
+ # the backend, and train the model to garbage on every site. Reject
43
+ # it here, on the custom-loss path only.
44
+ self.classification_training(
45
+ train_loader=train_loader, enforce_finite_loss=custom_loss
46
+ )
47
+
48
+ if custom_loss:
49
+ assert_custom_loss_robust(
50
+ classification_loss_contract(self.loss, self.classes)
51
+ )
52
+
53
+ def classification_training(self, train_loader, enforce_finite_loss=False):
54
+ self.model, _lopt = light_validation_setup(
55
+ self.model, getattr(self, "lora_enable", False), use_bf16=False
56
+ )
57
+ optimizer = _lopt or optim.SGD(self.model.parameters(), lr=0.001, momentum=0.9)
58
+ device = define_device()
59
+ self.model.to(device)
60
+
61
+ def step(data):
62
+ inputs, labels = data
63
+ inputs, labels = inputs.to(device), labels.to(device)
64
+ outputs = self.model(inputs)
65
+ labels = torch.as_tensor(labels, dtype=torch.long)
66
+ loss = self.loss(outputs, labels)
67
+ if enforce_finite_loss:
68
+ # reject NaN/Inf/non-scalar on the custom-loss path; same
69
+ # shared guard the other vision handlers use
70
+ assert_finite_scalar_loss(loss)
71
+ return loss
72
+
73
+ self._smoke_epoch(train_loader, optimizer, step)
@@ -3,15 +3,8 @@ from torch import optim
3
3
  from torch.utils.data import DataLoader
4
4
 
5
5
  from tracebloc.upload.torch_handler import TorchUploadHandler
6
- from tracebloc.utils.errors import format_exception
7
6
  from tracebloc.utils.device import light_validation_setup
8
- from tracebloc.utils.model_params import get_model_parameters
9
7
  from tracebloc.utils.data_probes import dummy_dataset_pytorch, detect_input_channels
10
- from tracebloc.utils.constants import (
11
- TRAINED_WEIGHTS_FILENAME,
12
- SEMANTIC_SEGMENTATION,
13
- )
14
- from tracebloc.utils.constants import PYTORCH_FRAMEWORK
15
8
  from tracebloc.utils.custom_loss_probe import (
16
9
  assert_finite_scalar_loss,
17
10
  assert_custom_loss_robust,
@@ -120,52 +113,36 @@ def _align_mask_to_output(outputs, masks):
120
113
 
121
114
 
122
115
  class TorchSemanticSegmentation(TorchUploadHandler):
123
- def small_training_loop(self, weight_filename, custom_loss=False):
124
- try:
125
- # Create fake semantic segmentation data
126
- # Match the model's native input-channel count (1 for
127
- # grayscale, 3 for RGB) so grayscale seg models aren't
128
- # false-rejected by hardcoded 3-channel dummy data.
129
- num_channels = detect_input_channels(self.model)
130
- train_dataset = dummy_dataset_pytorch(
131
- data_shape=self.data_shape,
132
- num_classes=self.classes,
133
- num_channels=num_channels,
134
- category=self.category,
135
- model_type=self.model_type,
136
- tmp_path=self.tmp_dir_path,
137
- )
116
+ def _smoke_train(self, custom_loss, criterion):
117
+ # Match the model's native input-channel count (1 for
118
+ # grayscale, 3 for RGB) so grayscale seg models aren't
119
+ # false-rejected by hardcoded 3-channel dummy data.
120
+ num_channels = detect_input_channels(self.model)
121
+ train_dataset = dummy_dataset_pytorch(
122
+ data_shape=self.data_shape,
123
+ num_classes=self.classes,
124
+ num_channels=num_channels,
125
+ category=self.category,
126
+ model_type=self.model_type,
127
+ tmp_path=self.tmp_dir_path,
128
+ )
138
129
 
139
- train_loader = DataLoader(
140
- train_dataset, batch_size=self.batch_size, shuffle=True
141
- )
130
+ train_loader = DataLoader(
131
+ train_dataset, batch_size=self.batch_size, shuffle=True
132
+ )
142
133
 
143
- self.loss = self.configure_loss(
144
- custom_loss=custom_loss, category=self.category
145
- )
134
+ self.loss = self.configure_loss(
135
+ custom_loss=custom_loss, category=self.category
136
+ )
146
137
 
147
- self.semantic_segmentation_training(
148
- train_loader=train_loader, enforce_finite_loss=custom_loss
149
- )
138
+ self.semantic_segmentation_training(
139
+ train_loader=train_loader, enforce_finite_loss=custom_loss
140
+ )
150
141
 
151
- if custom_loss:
152
- assert_custom_loss_robust(
153
- segmentation_loss_contract(self.loss, self.classes)
154
- )
155
-
156
- # dump weights from trained model will be used in averaging check
157
- get_model_parameters(
158
- model=self.model,
159
- weight_file_path=self.tmp_dir_path,
160
- weights_file_name=TRAINED_WEIGHTS_FILENAME,
161
- framework=PYTORCH_FRAMEWORK,
162
- preweights=False,
142
+ if custom_loss:
143
+ assert_custom_loss_robust(
144
+ segmentation_loss_contract(self.loss, self.classes)
163
145
  )
164
- if self.progress_bar is not None:
165
- self.progress_bar.update(1)
166
- except Exception as e: # pragma: no cover
167
- self.message = f"\nModel not support training on {self.category} dataset as there is error {format_exception(e)} "
168
- raise
169
146
 
170
147
  def semantic_segmentation_training(self, train_loader, enforce_finite_loss=False):
171
148
  self.model, _lopt = light_validation_setup(
@@ -175,32 +152,22 @@ class TorchSemanticSegmentation(TorchUploadHandler):
175
152
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
176
153
  self.model.to(device)
177
154
 
178
- for epoch in range(1): # loop over the dataset multiple times
179
- running_loss = 0.0
180
- for i, data in enumerate(train_loader, 0):
181
- # get the inputs; data is a list of [inputs, masks]
182
- inputs, masks = data
183
- inputs, masks = inputs.to(device), masks.to(device)
184
-
185
- # zero the parameter gradients
186
- optimizer.zero_grad()
187
-
188
- # forward + backward + optimize
189
- outputs = _unwrap_segmentation_output(self.model(inputs))
190
- masks = _align_mask_to_output(outputs, masks)
191
-
192
- # For semantic segmentation, outputs should be [B, C, H, W] and masks [B, H, W]
193
- # CrossEntropyLoss expects targets to be class indices, not one-hot encoded
194
- loss = self.loss(outputs, masks)
195
- # A custom loss runs here, so one that RAISES or returns a
196
- # non-scalar is already caught — but a NaN/Inf loss trains
197
- # silently (backward() does not raise) and would pass upload,
198
- # ship to the backend, and train to garbage. Reject it on the
199
- # custom-loss path only; the built-in CrossEntropy is unaffected.
200
- if enforce_finite_loss:
201
- assert_finite_scalar_loss(loss)
202
- loss.backward()
203
- optimizer.step()
204
-
205
- # print statistics
206
- running_loss += loss.item()
155
+ def step(data):
156
+ inputs, masks = data
157
+ inputs, masks = inputs.to(device), masks.to(device)
158
+ outputs = _unwrap_segmentation_output(self.model(inputs))
159
+ masks = _align_mask_to_output(outputs, masks)
160
+
161
+ # For semantic segmentation, outputs should be [B, C, H, W] and masks [B, H, W]
162
+ # CrossEntropyLoss expects targets to be class indices, not one-hot encoded
163
+ loss = self.loss(outputs, masks)
164
+ # A custom loss runs here, so one that RAISES or returns a
165
+ # non-scalar is already caught — but a NaN/Inf loss trains
166
+ # silently (backward() does not raise) and would pass upload,
167
+ # ship to the backend, and train to garbage. Reject it on the
168
+ # custom-loss path only; the built-in CrossEntropy is unaffected.
169
+ if enforce_finite_loss:
170
+ assert_finite_scalar_loss(loss)
171
+ return loss
172
+
173
+ self._smoke_epoch(train_loader, optimizer, step)
@@ -9,7 +9,8 @@ supplies only its hooks:
9
9
  block, so a failure there leaves ``self.message`` unset. Returns the criterion.
10
10
  - ``_smoke_data(custom_loss, criterion)``: returns ``(batches, criterion)``.
11
11
  - ``_smoke_step(batch, criterion, custom_loss)``: forward + loss for one batch.
12
- - ``_smoke_optimizer()``: ``model.train()``, the light-validation setup, Adam.
12
+ - ``_smoke_optimizer()``: ``model.train()``, ``model.to(self.device)`` when
13
+ ``_smoke_to_device`` is set, the light-validation setup, Adam.
13
14
 
14
15
  A handler whose training differs in kind overrides ``_smoke_train`` and can
15
16
  still run its batches through ``_smoke_epoch``.
@@ -28,6 +29,9 @@ from tracebloc.utils.model_params import get_model_parameters
28
29
  NOT_SUPPORTED_TEMPLATE = (
29
30
  "\nModel not support training on {category} dataset as there is error {error} "
30
31
  )
32
+ DOES_NOT_SUPPORT_TEMPLATE = (
33
+ "\nModel does not support training on {category} dataset. Error: {error}"
34
+ )
31
35
 
32
36
 
33
37
  class TorchSmokeLoop:
@@ -39,9 +43,12 @@ class TorchSmokeLoop:
39
43
  progress_bar: Any
40
44
  category: Any
41
45
  message: str
46
+ device: Any
42
47
 
43
48
  #: Stored on ``self.message`` when the guarded block raises.
44
49
  _smoke_failure_template = NOT_SUPPORTED_TEMPLATE
50
+ #: ``_smoke_optimizer`` moves the model to ``self.device`` before setup.
51
+ _smoke_to_device = False
45
52
 
46
53
  def small_training_loop(self, weight_filename, custom_loss=False, criterion=None):
47
54
  criterion = self._unguarded_smoke_setup(custom_loss, criterion)
@@ -80,6 +87,8 @@ class TorchSmokeLoop:
80
87
 
81
88
  def _smoke_optimizer(self):
82
89
  self.model.train()
90
+ if self._smoke_to_device:
91
+ self.model.to(self.device)
83
92
  self.model, light_optimizer = light_validation_setup(
84
93
  self.model, getattr(self, "lora_enable", False), use_bf16=False
85
94
  )
@@ -0,0 +1,145 @@
1
+ import torch
2
+ from torch import nn
3
+
4
+ from tracebloc.validation.pytorch_checks import TorchChecks
5
+ from tracebloc.upload.model_upload import Model
6
+ from tracebloc.upload.torch_smoke_loop import DOES_NOT_SUPPORT_TEMPLATE, TorchSmokeLoop
7
+ from tracebloc.utils.device import define_device
8
+ from tracebloc.utils.constants import TS_DEFAULT_SEQUENCE_LENGTH
9
+ from tracebloc.utils.time_series_utils import (
10
+ get_time_series_classification_dataloader,
11
+ )
12
+ from tracebloc.utils.custom_loss_probe import assert_custom_loss_robust
13
+
14
+
15
+ class TorchTimeSeriesClassifier(TorchSmokeLoop, Model, TorchChecks):
16
+ """
17
+ Model upload handler for PyTorch time series classification models.
18
+
19
+ Validates and uploads models that assign one class label per
20
+ sequence. Contract: inputs are ``(B, sequence_length, num_features)``
21
+ float32, scaled first and zero post-padded; the model emits
22
+ ``(B, output_classes)`` logits and derives any padding mask internally
23
+ via ``(x.abs().sum(-1) > 0)``.
24
+ Unlike forecasting there is no ``forecast_horizon``.
25
+ """
26
+ # #267 delta: these handlers landed (#281) with the plural success
27
+ # message; their tests and user-facing output pin it.
28
+ _success_message = "all checks passed"
29
+ _smoke_failure_template = DOES_NOT_SUPPORT_TEMPLATE
30
+ _smoke_to_device = True
31
+
32
+ def __init__(
33
+ self,
34
+ model_name,
35
+ client,
36
+ weights,
37
+ model_path,
38
+ tmp_model_file_path,
39
+ tmp_dir_path,
40
+ progress_bar_1,
41
+ classes,
42
+ weights_path,
43
+ model,
44
+ category,
45
+ progress_bar,
46
+ message,
47
+ framework,
48
+ data_shape,
49
+ batch_size,
50
+ model_type,
51
+ num_feature_points,
52
+ sequence_length=None,
53
+ ):
54
+ super().__init__(
55
+ model_name=model_name,
56
+ client=client,
57
+ weights=weights,
58
+ model_path=model_path,
59
+ tmp_model_file_path=tmp_model_file_path,
60
+ tmp_dir_path=tmp_dir_path,
61
+ progress_bar_1=progress_bar_1,
62
+ classes=classes,
63
+ weights_path=weights_path,
64
+ framework=framework,
65
+ data_shape=data_shape,
66
+ batch_size=batch_size,
67
+ model_type=model_type,
68
+ num_feature_points=num_feature_points,
69
+ )
70
+ TorchChecks.__init__(
71
+ self,
72
+ model=model,
73
+ category=category,
74
+ progress_bar=progress_bar,
75
+ message=message,
76
+ classes=classes,
77
+ )
78
+ self.__weights_path = weights_path
79
+ self.tmp_file_path = ""
80
+ self.device = define_device()
81
+ self.loss = None
82
+ # Time series specific parameters. The link-time custom-loss path
83
+ # constructs handlers WITHOUT the explicit ``sequence_length`` kwarg
84
+ # (link_model_dataset passes ``data_shape`` only) — and for sequence
85
+ # categories ``data_shape`` IS the plan's sequence length (user.py
86
+ # shape ladder). Derive it so the smoke-train always exercises the
87
+ # declared input width instead of a hardcoded fallback. The last
88
+ # resort (direct construction with neither value) mirrors the
89
+ # backend-canonical default so the model is validated at the same
90
+ # width it will train with (was 24).
91
+ if not sequence_length and isinstance(data_shape, int) and data_shape > 0:
92
+ sequence_length = data_shape
93
+ self.sequence_length = sequence_length or TS_DEFAULT_SEQUENCE_LENGTH
94
+ self.num_feature_points = num_feature_points
95
+
96
+ def _smoke_data(self, custom_loss, criterion):
97
+ # A custom loss.py runs in the smoke train and is probed first:
98
+ # (rows, output_classes) float logits against integer class targets
99
+ # at two row counts, exactly what the loop feeds the criterion.
100
+ if criterion is None and custom_loss:
101
+ criterion = self.configure_loss(
102
+ custom_loss=True, category=self.category
103
+ )
104
+ num_classes = int(self.classes)
105
+
106
+ def _run_at_rows(n, _crit=criterion, _c=num_classes):
107
+ outputs = torch.randn(n, _c, requires_grad=True)
108
+ targets = torch.randint(0, _c, (n,))
109
+ return _crit(outputs, targets)
110
+
111
+ assert_custom_loss_robust(_run_at_rows)
112
+ elif criterion is None:
113
+ # CrossEntropy is the default for sequence classification
114
+ criterion = nn.CrossEntropyLoss()
115
+
116
+ # Fake (B, sequence_length, F) float32 batches with variable
117
+ # valid lengths + zero post-padding, so a model's internal
118
+ # masked pooling is genuinely exercised; integer class targets.
119
+ dataloader = get_time_series_classification_dataloader(
120
+ num_samples=50,
121
+ sequence_length=self.sequence_length,
122
+ num_features=self.num_feature_points,
123
+ num_classes=int(self.classes),
124
+ batch_size=self.batch_size,
125
+ )
126
+ return dataloader, criterion
127
+
128
+ def _smoke_step(self, batch, criterion, custom_loss):
129
+ sequences, targets = batch
130
+ sequences = sequences.to(self.device)
131
+ outputs = self.model(sequences)
132
+
133
+ # Contract: logits of shape (B, output_classes). A regression head
134
+ # (e.g. a forecaster's horizon-wide output) or a mismatched class
135
+ # count must fail here with a readable message, not deep inside the
136
+ # loss.
137
+ expected = (sequences.size(0), int(self.classes))
138
+ if outputs.dim() != 2 or tuple(outputs.shape) != expected:
139
+ raise ValueError(
140
+ f"model output shape {tuple(outputs.shape)} does "
141
+ f"not match the expected logits shape {expected} "
142
+ f"(batch_size, output_classes) for time series "
143
+ f"classification"
144
+ )
145
+ return criterion(outputs, targets.to(self.device))
@@ -0,0 +1,138 @@
1
+ import torch
2
+ from torch import nn
3
+
4
+ from tracebloc.validation.pytorch_checks import TorchChecks
5
+ from tracebloc.upload.model_upload import Model
6
+ from tracebloc.upload.torch_smoke_loop import DOES_NOT_SUPPORT_TEMPLATE, TorchSmokeLoop
7
+ from tracebloc.utils.device import define_device
8
+ from tracebloc.utils.constants import (
9
+ TS_DEFAULT_SEQUENCE_LENGTH,
10
+ TS_DEFAULT_FORECAST_HORIZON,
11
+ )
12
+ from tracebloc.utils.time_series_utils import get_time_series_dataloader
13
+ from tracebloc.utils.custom_loss_probe import assert_custom_loss_robust
14
+
15
+
16
+ class TorchTimeSeriesForecaster(TorchSmokeLoop, Model, TorchChecks):
17
+ """
18
+ Model upload handler for PyTorch time series forecasting models.
19
+
20
+ Validates and uploads time series forecasting models that predict
21
+ future values based on historical sequences.
22
+ """
23
+ # #267 delta: these handlers landed (#281) with the plural success
24
+ # message; their tests and user-facing output pin it.
25
+ _success_message = "all checks passed"
26
+ _smoke_failure_template = DOES_NOT_SUPPORT_TEMPLATE
27
+ _smoke_to_device = True
28
+
29
+ def __init__(
30
+ self,
31
+ model_name,
32
+ client,
33
+ weights,
34
+ model_path,
35
+ tmp_model_file_path,
36
+ tmp_dir_path,
37
+ progress_bar_1,
38
+ classes,
39
+ weights_path,
40
+ model,
41
+ category,
42
+ progress_bar,
43
+ message,
44
+ framework,
45
+ data_shape,
46
+ batch_size,
47
+ model_type,
48
+ num_feature_points,
49
+ sequence_length=None,
50
+ forecast_horizon=None,
51
+ ):
52
+ super().__init__(
53
+ model_name=model_name,
54
+ client=client,
55
+ weights=weights,
56
+ model_path=model_path,
57
+ tmp_model_file_path=tmp_model_file_path,
58
+ tmp_dir_path=tmp_dir_path,
59
+ progress_bar_1=progress_bar_1,
60
+ classes=classes,
61
+ weights_path=weights_path,
62
+ framework=framework,
63
+ data_shape=data_shape,
64
+ batch_size=batch_size,
65
+ model_type=model_type,
66
+ num_feature_points=num_feature_points,
67
+ )
68
+ TorchChecks.__init__(
69
+ self,
70
+ model=model,
71
+ category=category,
72
+ progress_bar=progress_bar,
73
+ message=message,
74
+ classes=classes,
75
+ )
76
+ self.__weights_path = weights_path
77
+ self.tmp_file_path = ""
78
+ self.device = define_device()
79
+ self.loss = None
80
+ # Time series specific parameters. The link-time custom-loss path
81
+ # constructs handlers WITHOUT the explicit ``sequence_length`` kwarg
82
+ # (link_model_dataset passes ``data_shape`` only) — and for sequence
83
+ # categories ``data_shape`` IS the plan's sequence length (user.py
84
+ # shape ladder). Derive it so the smoke-train always exercises the
85
+ # declared lookback window instead of a hardcoded fallback (#282,
86
+ # mirrors the TSC fix #281). ``forecast_horizon`` has no carrier in
87
+ # ``data_shape`` (it holds only the lookback), so the link sites
88
+ # thread it explicitly. Both last-resort fallbacks (direct
89
+ # construction with neither value) mirror the backend-canonical
90
+ # defaults so the model is validated at the same shape it will train
91
+ # with (were 24/12).
92
+ if not sequence_length and isinstance(data_shape, int) and data_shape > 0:
93
+ sequence_length = data_shape
94
+ self.sequence_length = sequence_length or TS_DEFAULT_SEQUENCE_LENGTH
95
+ self.forecast_horizon = forecast_horizon or TS_DEFAULT_FORECAST_HORIZON
96
+ self.num_feature_points = num_feature_points
97
+
98
+ def _smoke_data(self, custom_loss, criterion):
99
+ # A custom loss.py ships to the engine, which uses it as Custom_loss, so
100
+ # it runs in the smoke train and is probed first: (rows,
101
+ # forecast_horizon) float tensors at two row counts, exactly what the
102
+ # loop feeds the criterion.
103
+ if criterion is None and custom_loss:
104
+ criterion = self.configure_loss(
105
+ custom_loss=True, category=self.category
106
+ )
107
+ horizon = self.forecast_horizon or 1
108
+
109
+ def _run_at_rows(n, _crit=criterion, _h=horizon):
110
+ outputs = torch.randn(n, _h, requires_grad=True)
111
+ targets = torch.randn(n, _h)
112
+ # mirror the loop: outputs are squeezed when the last dim
113
+ # is 1 (forecast_horizon == 1) before reaching the criterion
114
+ if outputs.dim() > 1 and outputs.size(-1) == 1:
115
+ outputs = outputs.squeeze(-1)
116
+ return _crit(outputs, targets)
117
+
118
+ assert_custom_loss_robust(_run_at_rows)
119
+ elif criterion is None:
120
+ # Use MSE loss by default for time series forecasting
121
+ criterion = nn.MSELoss()
122
+
123
+ # Create fake time series data for validation
124
+ dataloader = get_time_series_dataloader(
125
+ num_samples=50,
126
+ sequence_length=self.sequence_length,
127
+ forecast_horizon=self.forecast_horizon,
128
+ num_features=self.num_feature_points,
129
+ batch_size=self.batch_size,
130
+ )
131
+ return dataloader, criterion
132
+
133
+ def _smoke_step(self, batch, criterion, custom_loss):
134
+ sequences, targets = batch
135
+ outputs = self.model(sequences.to(self.device))
136
+ if outputs.dim() > 1 and outputs.size(-1) == 1:
137
+ outputs = outputs.squeeze(-1)
138
+ return criterion(outputs, targets.to(self.device))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebloc
3
- Version: 6.0.2
3
+ Version: 6.0.3
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