tracebloc 1.2.91__tar.gz → 2.0.0__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 (229) hide show
  1. {tracebloc-1.2.91 → tracebloc-2.0.0}/PKG-INFO +1 -1
  2. {tracebloc-1.2.91 → tracebloc-2.0.0}/pyproject.toml +8 -8
  3. tracebloc-2.0.0/tracebloc/_deprecation.py +14 -0
  4. tracebloc-2.0.0/tracebloc/_framework_utils.py +26 -0
  5. tracebloc-2.0.0/tracebloc/_http_utils.py +12 -0
  6. tracebloc-2.0.0/tracebloc/_link_answer.py +8 -0
  7. tracebloc-2.0.0/tracebloc/_link_regeneration.py +25 -0
  8. tracebloc-2.0.0/tracebloc/_linking.py +15 -0
  9. tracebloc-2.0.0/tracebloc/_raw_width_note.py +12 -0
  10. tracebloc-2.0.0/tracebloc/_stored_link.py +21 -0
  11. tracebloc-2.0.0/tracebloc/_upload_conversion.py +17 -0
  12. tracebloc-2.0.0/tracebloc/api/__init__.py +6 -0
  13. tracebloc-2.0.0/tracebloc/api/experiment_status.py +40 -0
  14. tracebloc-2.0.0/tracebloc/auth/__init__.py +5 -0
  15. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/checks.py +4 -3
  16. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/client.py +4 -3
  17. tracebloc-2.0.0/tracebloc/compat/__init__.py +6 -0
  18. tracebloc-1.2.91/tracebloc/_deprecation.py → tracebloc-2.0.0/tracebloc/compat/deprecation.py +1 -1
  19. tracebloc-1.2.91/tracebloc/_framework_utils.py → tracebloc-2.0.0/tracebloc/compat/frameworks.py +1 -1
  20. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/acceptance.py +1 -1
  21. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/families/hf/__init__.py +1 -1
  22. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/families/hf/_model_type.py +1 -1
  23. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/families/tabular.py +2 -2
  24. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/gate.py +1 -1
  25. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/outputs.py +2 -2
  26. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/assemble.py +18 -1
  27. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/checkpoint.py +1 -1
  28. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/package.py +1 -1
  29. tracebloc-2.0.0/tracebloc/convert/padding.py +29 -0
  30. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/tokenizers.py +4 -15
  31. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/training_versions.py +2 -2
  32. {tracebloc-1.2.91/tracebloc → tracebloc-2.0.0/tracebloc/downloads}/lifelines_weights.py +1 -1
  33. {tracebloc-1.2.91/tracebloc → tracebloc-2.0.0/tracebloc/downloads}/seed_weights.py +4 -4
  34. tracebloc-2.0.0/tracebloc/env_login.py +18 -0
  35. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/exceptions.py +1 -1
  36. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/fetch.py +2 -2
  37. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/inference.py +4 -6
  38. tracebloc-2.0.0/tracebloc/library_fetch.py +11 -0
  39. tracebloc-2.0.0/tracebloc/lifelines_weights.py +16 -0
  40. tracebloc-2.0.0/tracebloc/link_model_dataset.py +17 -0
  41. tracebloc-2.0.0/tracebloc/linking/__init__.py +14 -0
  42. tracebloc-2.0.0/tracebloc/linking/augmentation_methods.py +179 -0
  43. tracebloc-2.0.0/tracebloc/linking/check_model.py +72 -0
  44. tracebloc-1.2.91/tracebloc/_upload_conversion.py → tracebloc-2.0.0/tracebloc/linking/conversion.py +1 -1
  45. tracebloc-2.0.0/tracebloc/linking/data_methods.py +340 -0
  46. tracebloc-1.2.91/tracebloc/library_fetch.py → tracebloc-2.0.0/tracebloc/linking/library.py +1 -1
  47. tracebloc-2.0.0/tracebloc/linking/model_dataset.py +464 -0
  48. tracebloc-1.2.91/tracebloc/_linking.py → tracebloc-2.0.0/tracebloc/linking/response.py +15 -16
  49. tracebloc-1.2.91/tracebloc/_stored_link.py → tracebloc-2.0.0/tracebloc/linking/stored.py +2 -2
  50. tracebloc-2.0.0/tracebloc/linking/training_methods.py +365 -0
  51. tracebloc-2.0.0/tracebloc/linking/user_methods.py +275 -0
  52. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/notebook/__init__.py +2 -2
  53. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/declaration.py +1 -1
  54. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/fitted_model.py +1 -1
  55. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/schema.py +1 -1
  56. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/torch_checks.py +1 -1
  57. tracebloc-2.0.0/tracebloc/seed_weights.py +24 -0
  58. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/augmentation.py +43 -43
  59. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/callbacks.py +14 -14
  60. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/features.py +24 -24
  61. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/image_channels.py +1 -1
  62. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/lora.py +4 -4
  63. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/lora_validation.py +8 -8
  64. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/loss.py +24 -27
  65. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/plan.py +42 -44
  66. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/preprocessing.py +22 -22
  67. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/shape.py +19 -19
  68. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/submitter.py +15 -14
  69. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/summary.py +2 -3
  70. tracebloc-2.0.0/tracebloc/upload/loss_config.py +131 -0
  71. tracebloc-2.0.0/tracebloc/upload/model_params.py +213 -0
  72. tracebloc-2.0.0/tracebloc/upload/model_upload.py +398 -0
  73. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/nlp_probes.py +1 -1
  74. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/skl_tabular_base.py +3 -5
  75. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/skl_tabular_classifier.py +1 -1
  76. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/skl_tabular_regression.py +1 -1
  77. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/survival_base.py +3 -5
  78. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_embeddings.py +2 -4
  79. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_image_classifier.py +4 -8
  80. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_key_point_detector.py +6 -6
  81. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_nlp_base.py +5 -5
  82. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_object_detector.py +4 -4
  83. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_semantic_segmentation.py +4 -7
  84. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_seq2seq_modeler.py +1 -1
  85. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_tabular_classifier.py +3 -5
  86. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_tabular_regression.py +3 -5
  87. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_text_classifier.py +1 -1
  88. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_time_series_classifier.py +3 -6
  89. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_time_series_forecaster.py +3 -6
  90. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_time_to_event.py +3 -5
  91. tracebloc-2.0.0/tracebloc/upload/user_methods.py +366 -0
  92. tracebloc-2.0.0/tracebloc/upload/weights_averaging.py +210 -0
  93. tracebloc-2.0.0/tracebloc/upload/weights_check.py +271 -0
  94. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/weights_parts.py +2 -2
  95. tracebloc-2.0.0/tracebloc/user.py +399 -0
  96. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/data_probes.py +4 -11
  97. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/registry.py +1 -1
  98. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/safetensors_io.py +1 -1
  99. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/text_classification_utils.py +1 -1
  100. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/checker.py +4 -6
  101. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/pytorch_checks.py +3 -5
  102. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc.egg-info/PKG-INFO +1 -1
  103. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc.egg-info/SOURCES.txt +31 -2
  104. tracebloc-2.0.0/tracebloc.egg-info/top_level.txt +1 -0
  105. tracebloc-1.2.91/tracebloc/link_model_dataset.py +0 -1194
  106. tracebloc-1.2.91/tracebloc/upload/model_upload.py +0 -927
  107. tracebloc-1.2.91/tracebloc/user.py +0 -1069
  108. tracebloc-1.2.91/tracebloc.egg-info/top_level.txt +0 -2
  109. tracebloc-1.2.91/tracebloc_package/__init__.py +0 -53
  110. {tracebloc-1.2.91 → tracebloc-2.0.0}/MANIFEST.in +0 -0
  111. {tracebloc-1.2.91 → tracebloc-2.0.0}/README.md +0 -0
  112. {tracebloc-1.2.91 → tracebloc-2.0.0}/license.txt +0 -0
  113. {tracebloc-1.2.91 → tracebloc-2.0.0}/setup.cfg +0 -0
  114. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/__init__.py +0 -0
  115. /tracebloc-1.2.91/tracebloc/_http_utils.py → /tracebloc-2.0.0/tracebloc/api/responses.py +0 -0
  116. {tracebloc-1.2.91/tracebloc → tracebloc-2.0.0/tracebloc/auth}/env_login.py +0 -0
  117. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/config.py +0 -0
  118. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/contracts/stage_urls.v1.json +0 -0
  119. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/contracts/stage_urls.v1.source.json +0 -0
  120. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/contracts/survival_payload.py +0 -0
  121. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/contracts/training_requirements.source.json +0 -0
  122. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/contracts/training_requirements.txt +0 -0
  123. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/__init__.py +0 -0
  124. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/families/__init__.py +0 -0
  125. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/families/hf/_build.py +0 -0
  126. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/families/vision/__init__.py +0 -0
  127. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/families/vision/_matching.py +0 -0
  128. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/heads.py +0 -0
  129. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/interfaces.py +0 -0
  130. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/licence/__init__.py +0 -0
  131. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/licence/spdx.py +0 -0
  132. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/__init__.py +0 -0
  133. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/arguments.py +0 -0
  134. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/gate_rules.py +0 -0
  135. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/generate.py +0 -0
  136. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/head.py +0 -0
  137. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/import_check.py +0 -0
  138. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/layer0.py +0 -0
  139. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/live.py +0 -0
  140. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/model_class.py +0 -0
  141. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/remote.py +0 -0
  142. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/repo.py +0 -0
  143. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/shake.py +0 -0
  144. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/owncode/source_tree.py +0 -0
  145. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/convert/report.py +0 -0
  146. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/__init__.py +0 -0
  147. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/base.py +0 -0
  148. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/detection.py +0 -0
  149. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/keypoint_detection.py +0 -0
  150. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/semantic_segmentation.py +0 -0
  151. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/tabular.py +0 -0
  152. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/text.py +0 -0
  153. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/time_series.py +0 -0
  154. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/datasets/time_to_event.py +0 -0
  155. /tracebloc-1.2.91/tracebloc/_link_answer.py → /tracebloc-2.0.0/tracebloc/linking/answer.py +0 -0
  156. /tracebloc-1.2.91/tracebloc/_link_regeneration.py → /tracebloc-2.0.0/tracebloc/linking/regeneration.py +0 -0
  157. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/notebook/templates/_partials.tpl +0 -0
  158. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/notebook/templates/embeddings.tpl +0 -0
  159. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/notebook/templates/nlp_finetune.tpl +0 -0
  160. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/notebook/templates/nlp_generative.tpl +0 -0
  161. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/notebook/templates/survival.tpl +0 -0
  162. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/notebook/templates/tabular_timeseries.tpl +0 -0
  163. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/notebook/templates/vision_from_scratch.tpl +0 -0
  164. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/__init__.py +0 -0
  165. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/classes.py +0 -0
  166. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/frame_recording.py +0 -0
  167. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/link_check.py +0 -0
  168. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/pairs.py +0 -0
  169. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/seed_prefixes.py +0 -0
  170. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/sklearn_check.py +0 -0
  171. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode/survival.py +0 -0
  172. /tracebloc-1.2.91/tracebloc/_raw_width_note.py → /tracebloc-2.0.0/tracebloc/raw_mode/width_note.py +0 -0
  173. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode_frame.py +0 -0
  174. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode_seed.py +0 -0
  175. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode_survival.py +0 -0
  176. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/raw_mode_torch.py +0 -0
  177. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/__init__.py +0 -0
  178. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/converted.py +0 -0
  179. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/image_size.py +0 -0
  180. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/link_total.py +0 -0
  181. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/loss_policy.py +0 -0
  182. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/loss_source.py +0 -0
  183. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/memory_estimate.py +0 -0
  184. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/training/subdataset.py +0 -0
  185. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/__init__.py +0 -0
  186. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/lifelines_time_to_event.py +0 -0
  187. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/scikit_survival_time_to_event.py +0 -0
  188. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/sequence_length.py +0 -0
  189. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/statistical_base.py +0 -0
  190. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_causal_language_modeler.py +0 -0
  191. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_handler.py +0 -0
  192. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_masked_language_modeler.py +0 -0
  193. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_multi_label_text_classifier.py +0 -0
  194. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_sentence_pair_classifier.py +0 -0
  195. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_text_regressor.py +0 -0
  196. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/torch_token_classifier.py +0 -0
  197. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/upload/weight_loaders.py +0 -0
  198. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/__init__.py +0 -0
  199. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/class_order.py +0 -0
  200. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/constants.py +0 -0
  201. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/custom_loss_probe.py +0 -0
  202. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/declared_classes.py +0 -0
  203. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/declared_cls.py +0 -0
  204. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/detection_utils.py +0 -0
  205. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/device.py +0 -0
  206. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/entry_point.py +0 -0
  207. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/errors.py +0 -0
  208. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/feature_dict.py +0 -0
  209. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/general_utils.py +0 -0
  210. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/key_point_detection_utils.py +0 -0
  211. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/model_loading.py +0 -0
  212. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/model_params.py +0 -0
  213. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/resources.py +0 -0
  214. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/semantic_segmentation_utils.py +0 -0
  215. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/tabular_classification_utils.py +0 -0
  216. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/tabular_custom_loss_utils.py +0 -0
  217. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/tabular_regression_utils.py +0 -0
  218. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/time_series_utils.py +0 -0
  219. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/time_to_event_utils.py +0 -0
  220. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/utils/warnings_once.py +0 -0
  221. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/__init__.py +0 -0
  222. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/estimator_checks.py +0 -0
  223. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/header_rules.py +0 -0
  224. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/lifelines_checks.py +0 -0
  225. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/rewriter.py +0 -0
  226. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/scikit_survival_checks.py +0 -0
  227. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc/validation/sklearn_checks.py +0 -0
  228. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc.egg-info/dependency_links.txt +0 -0
  229. {tracebloc-1.2.91 → tracebloc-2.0.0}/tracebloc.egg-info/requires.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebloc
3
- Version: 1.2.91
3
+ Version: 2.0.0
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.91"
7
+ version = "2.0.0"
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"]
@@ -98,7 +98,7 @@ xgboost = [
98
98
  ]
99
99
  lifelines = [
100
100
  "lifelines>=0.30.3",
101
- # tracebloc.lifelines_weights reads a multi-edge run's downloaded
101
+ # tracebloc.downloads.lifelines_weights reads a multi-edge run's downloaded
102
102
  # coefficients file, a SafeTensors container. Same floor as [pytorch].
103
103
  "safetensors>=0.4.3",
104
104
  ]
@@ -173,16 +173,16 @@ dev = [
173
173
  [project.urls]
174
174
  Homepage = "https://tracebloc.io"
175
175
 
176
- # An allowlist of the import packages the wheel ships: the SDK and the
177
- # pre-0.8.0 `tracebloc_package` shim (slated for removal in 1.0.0; still
178
- # shipped). pyproject discovery runs in namespace mode, so every directory
176
+ # An allowlist of the import packages the wheel ships: the SDK, and only
177
+ # the SDK (the pre-0.8.0 `tracebloc_package` shim was removed in 2.0.0).
178
+ # pyproject discovery runs in namespace mode, so every directory
179
179
  # counts as a package whether or not it has an `__init__.py`; with no
180
180
  # `include` it shipped the repo's `tests/` and `scripts/` into site-packages
181
181
  # as top-level `tests` and `scripts` packages. A new public top-level package
182
182
  # has to be added here, and tests/test_wheel_packages.py holds the list.
183
183
  [tool.setuptools.packages.find]
184
184
  where = ["."]
185
- include = ["tracebloc", "tracebloc.*", "tracebloc_package", "tracebloc_package.*"]
185
+ include = ["tracebloc", "tracebloc.*"]
186
186
 
187
187
  # The backend's stage -> API URL contract (and its pin), which
188
188
  # tracebloc.config reads at import: a wheel or sdist without it cannot
@@ -233,11 +233,11 @@ ignore = ["N812"]
233
233
  [tool.ruff.lint.per-file-ignores]
234
234
  # Deprecation helpers: lowercase class name is intentional (decorator-like
235
235
  # descriptor), and module-level __getattr__/__dir__ are PEP 562 dunders.
236
- "tracebloc/_deprecation.py" = ["N801", "N807"]
236
+ "tracebloc/compat/deprecation.py" = ["N801", "N807"]
237
237
 
238
238
  # Deprecated camelCase class/method aliases are preserved until 1.0.0.
239
239
  # SDK.2c (class) and SDK.2d (method) aliases land as class-scope mixedCase.
240
- "tracebloc/link_model_dataset.py" = ["N815"]
240
+ "tracebloc/linking/model_dataset.py" = ["N815"]
241
241
  "tracebloc/user.py" = ["N815"]
242
242
 
243
243
  # YOLO / vision math uses single-letter S, B, C, H, W variables per ML
@@ -0,0 +1,14 @@
1
+ """Re-exports only (RFC-0348 C.3): moved to :mod:`tracebloc.compat.deprecation`.
2
+
3
+ Every name stays importable from this path for existing callers; new code
4
+ imports from the new module.
5
+ """
6
+
7
+ from tracebloc.compat.deprecation import ( # noqa: F401 (re-export, RFC-0348 C.3)
8
+ deprecated_method_alias,
9
+ deprecated_aliases,
10
+ discard_removed_kwarg,
11
+ _Sentinel,
12
+ UNSET,
13
+ resolve_renamed_kwarg,
14
+ )
@@ -0,0 +1,26 @@
1
+ """Re-exports only (RFC-0348 C.3): moved to :mod:`tracebloc.compat.frameworks`.
2
+
3
+ Every name stays importable from this path for existing callers; new code
4
+ imports from the new module.
5
+ """
6
+
7
+ from tracebloc.compat.frameworks import ( # noqa: F401 (re-export, RFC-0348 C.3)
8
+ _PYPI_EXTRAS_URL,
9
+ _DISTRIBUTION,
10
+ _META_EXTRAS,
11
+ _IMPORT_TO_DISTRIBUTION,
12
+ _EXTRA_MARKER,
13
+ _REQUIREMENT_NAME,
14
+ _normalize,
15
+ _declared_requirements,
16
+ build_module_extras,
17
+ _distribution_extras,
18
+ _ModuleExtras,
19
+ _MODULE_TO_EXTRA,
20
+ extra_for_module,
21
+ missing_extra_hint,
22
+ extras_for,
23
+ require_module,
24
+ _LOGICAL_TO_MODULE,
25
+ require_framework,
26
+ )
@@ -0,0 +1,12 @@
1
+ """Re-exports only (RFC-0348 C.3): moved to :mod:`tracebloc.api.responses`.
2
+
3
+ Every name stays importable from this path for existing callers; new code
4
+ imports from the new module.
5
+ """
6
+
7
+ from tracebloc.api.responses import ( # noqa: F401 (re-export, RFC-0348 C.3)
8
+ _extract_error_message,
9
+ LOAD_FAILED_PREFIX,
10
+ REUPLOAD_HINT,
11
+ is_load_failed,
12
+ )
@@ -0,0 +1,8 @@
1
+ """Re-exports only (RFC-0348 C.1): moved to
2
+ :mod:`tracebloc.linking.answer`. Every name stays importable from this path
3
+ for existing callers; new code imports from the new module.
4
+ """
5
+
6
+ from tracebloc.linking.answer import ( # noqa: F401 (re-export, RFC-0348 C.1)
7
+ compared_keys,
8
+ )
@@ -0,0 +1,25 @@
1
+ """Re-exports only (RFC-0348 C.1): moved to
2
+ :mod:`tracebloc.linking.regeneration`. Every name stays importable from this path
3
+ for existing callers; new code imports from the new module.
4
+ """
5
+
6
+ from tracebloc.linking.regeneration import ( # noqa: F401 (re-export, RFC-0348 C.1)
7
+ _class_count,
8
+ _folded,
9
+ _head_keys,
10
+ _PLACEHOLDER_LABEL,
11
+ _positive_int,
12
+ _put_back,
13
+ _remove,
14
+ _restored_on_error,
15
+ _rewrite,
16
+ align_head,
17
+ ALIGNED_HEAD,
18
+ changed_counts,
19
+ dataset_counts,
20
+ HEAD_CLASS_ORDER,
21
+ HEAD_PREFIXES,
22
+ head_rows,
23
+ ID2LABEL,
24
+ regenerated_for_link,
25
+ )
@@ -0,0 +1,15 @@
1
+ """Re-exports only (RFC-0348 C.1): moved to
2
+ :mod:`tracebloc.linking.response`. Every name stays importable from this path
3
+ for existing callers; new code imports from the new module.
4
+ """
5
+
6
+ from tracebloc.linking.response import ( # noqa: F401 (re-export, RFC-0348 C.1)
7
+ _apply_link_success,
8
+ _map_link_response,
9
+ _parse_api_message,
10
+ _render_mismatch_diagnostics,
11
+ _status_reason,
12
+ DATASET_KEY_HINT,
13
+ LinkSuccessState,
14
+ regenerated_for_link,
15
+ )
@@ -0,0 +1,12 @@
1
+ """Re-exports only (RFC-0348 C.3): moved to :mod:`tracebloc.raw_mode.width_note`.
2
+
3
+ Every name stays importable from this path for existing callers; new code
4
+ imports from the new module.
5
+ """
6
+
7
+ from tracebloc.raw_mode.width_note import ( # noqa: F401 (re-export, RFC-0348 C.3)
8
+ ONE_HOT_EXPECTED,
9
+ _START_REFUSAL,
10
+ _note,
11
+ raw_width_note,
12
+ )
@@ -0,0 +1,21 @@
1
+ """Re-exports only (RFC-0348 C.1): moved to
2
+ :mod:`tracebloc.linking.stored`. Every name stays importable from this path
3
+ for existing callers; new code imports from the new module.
4
+ """
5
+
6
+ from tracebloc.linking.stored import ( # noqa: F401 (re-export, RFC-0348 C.1)
7
+ _posix_stem,
8
+ check_weights_without_upload,
9
+ fetch_stored_model,
10
+ LIBRARY_MODEL_ID,
11
+ library_pick,
12
+ LIBRARY_REFUSAL_HINTS,
13
+ LIBRARY_VERSION,
14
+ raise_library_refusal,
15
+ stored_link_request,
16
+ STORED_MODEL,
17
+ STORED_MODEL_HINT,
18
+ stored_model_identity,
19
+ TEMPLATE,
20
+ WEIGHTS_FILE_ID,
21
+ )
@@ -0,0 +1,17 @@
1
+ """Re-exports only (RFC-0348 C.1): moved to
2
+ :mod:`tracebloc.linking.conversion`. Every name stays importable from this path
3
+ for existing callers; new code imports from the new module.
4
+ """
5
+
6
+ from tracebloc.linking.conversion import ( # noqa: F401 (re-export, RFC-0348 C.1)
7
+ _category,
8
+ _json,
9
+ _not_found,
10
+ _todays_path,
11
+ ASK,
12
+ dataset_task,
13
+ DATASET_TASK_PATH,
14
+ for_upload,
15
+ refuse_unsendable,
16
+ UploadInput,
17
+ )
@@ -0,0 +1,6 @@
1
+ """Reading the platform's HTTP answers (RFC-0348 C.3).
2
+
3
+ ``responses`` holds the error-message extraction and the load-failed check
4
+ that ``client``, ``fetch``, ``inference``, ``User`` and the upload and link
5
+ flows share. The old root module ``tracebloc.api.responses`` re-exports it.
6
+ """
@@ -0,0 +1,40 @@
1
+ """The experiment-status read behind ``User.get_experiment_status`` (RFC-0348 D.2).
2
+
3
+ Moved, unchanged, out of ``tracebloc/user.py``; the login check stays on
4
+ ``User`` (it raises rather than returning ``None``).
5
+ """
6
+
7
+ import json
8
+
9
+ from tracebloc.api.responses import _extract_error_message
10
+ from tracebloc.exceptions import APIError
11
+ from tracebloc.utils.errors import format_exception
12
+
13
+
14
+ def experiment_status(client, experiment_key):
15
+ """A run's status dict, or ``None`` on a 404. See ``User.get_experiment_status``."""
16
+ response = client.get(f"experiment-status/{experiment_key}/", raise_on_error=False)
17
+ if response.status_code == 404:
18
+ return None
19
+ if not response.ok:
20
+ raise APIError(response.status_code, _extract_error_message(response))
21
+ try:
22
+ body = response.json()
23
+ return {
24
+ "experiment_key": body.get("experiment_key", experiment_key),
25
+ "status": body.get("status"),
26
+ "status_display": body.get("status_display"),
27
+ "category": body.get("category"),
28
+ "reason": body.get("reason"),
29
+ }
30
+ except (ValueError, TypeError, AttributeError, json.JSONDecodeError) as error:
31
+ # A 2xx with a malformed / non-dict body (bad JSON, or a list /
32
+ # null / scalar that has no ``.get``) would otherwise surface as
33
+ # JSONDecodeError / AttributeError — outside the documented SDK
34
+ # exception hierarchy. Normalize to APIError, matching
35
+ # TraceblocClient.login and _map_link_response.
36
+ raise APIError(
37
+ response.status_code,
38
+ f"Malformed experiment-status response body: "
39
+ f"{format_exception(error)}",
40
+ ) from error
@@ -0,0 +1,5 @@
1
+ """Logging in without a prompt (RFC-0348 C.3).
2
+
3
+ ``env_login`` reads a scoped token from the environment. The old root module
4
+ ``tracebloc.auth.env_login`` re-exports it.
5
+ """
@@ -23,8 +23,9 @@ from __future__ import annotations
23
23
  import re
24
24
  import time
25
25
 
26
- from tracebloc.raw_mode_frame import raw_upload_failure
27
- from tracebloc.utils.general_utils import format_exception, remove_tmp_file
26
+ from tracebloc.raw_mode.frame_recording import raw_upload_failure
27
+ from tracebloc.utils.errors import format_exception
28
+ from tracebloc.utils.model_loading import remove_tmp_file
28
29
  from tracebloc.utils.warnings_once import warnings_once
29
30
 
30
31
  #: The ``display_data`` MIME type the payload travels under. Versioned: a
@@ -240,7 +241,7 @@ def _sanitise(message):
240
241
  def _parameter_count(task):
241
242
  """PyTorch models only, as the backend's ``parameter_count``."""
242
243
  from tracebloc.utils.constants import PYTORCH_FRAMEWORK
243
- from tracebloc.utils.general_utils import get_model_params_count
244
+ from tracebloc.utils.model_params import get_model_params_count
244
245
 
245
246
  if task.framework != PYTORCH_FRAMEWORK:
246
247
  return None
@@ -37,16 +37,17 @@ import requests
37
37
  from requests.adapters import HTTPAdapter
38
38
  from urllib3.util.retry import Retry
39
39
 
40
- from tracebloc._http_utils import _extract_error_message
40
+ from tracebloc.api.responses import _extract_error_message
41
41
  from tracebloc.config import TraceblocConfig
42
42
  from tracebloc.exceptions import APIError, AuthenticationError
43
- from tracebloc.utils.general_utils import format_exception
43
+ from tracebloc.utils.errors import format_exception
44
44
 
45
45
 
46
46
  #: The distribution this package installs as -- ``[project] name`` in
47
47
  #: ``pyproject.toml`` (``tests/test_client.py`` holds the two together).
48
48
  #: Not ``tracebloc_package``: that is the pre-0.8.0 redirect distribution,
49
- #: which depends on this one, so ``tracebloc`` is installed either way.
49
+ #: which depends on this one, so ``tracebloc`` is installed either way
50
+ #: (its import path was removed in 2.0.0; the distribution still resolves).
50
51
  _DISTRIBUTION = "tracebloc"
51
52
 
52
53
  #: What the version reads as when the distribution's metadata is missing
@@ -0,0 +1,6 @@
1
+ """Compatibility with older SDK versions and optional extras (RFC-0348 C.3).
2
+
3
+ ``deprecation`` holds the rename and retirement warnings; ``frameworks`` the
4
+ guarded imports for the optional ML-framework extras. The old root modules
5
+ ``tracebloc.compat.deprecation`` and ``tracebloc.compat.frameworks`` re-export them.
6
+ """
@@ -5,7 +5,7 @@ The camelCase-rename aliases below date from the 0.7.0 rename.
5
5
  Usage in a module that wants to expose old camelCase class names as
6
6
  deprecated aliases for the new snake-case or Pascal-cleaned versions::
7
7
 
8
- from tracebloc._deprecation import deprecated_aliases
8
+ from tracebloc.compat.deprecation import deprecated_aliases
9
9
 
10
10
  class LinkModelDataset:
11
11
  ...
@@ -69,7 +69,7 @@ def _declared_requirements() -> list[str]:
69
69
  return list(metadata.distribution(_DISTRIBUTION).requires or [])
70
70
  except metadata.PackageNotFoundError:
71
71
  pass
72
- pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml"
72
+ pyproject = Path(__file__).resolve().parents[2] / "pyproject.toml"
73
73
  try:
74
74
  import tomllib
75
75
 
@@ -235,7 +235,7 @@ def torch_strict_load(model: Any, written: WrittenPackage) -> CheckFinding:
235
235
 
236
236
  def pickle_strict_load(model: Any, written: WrittenPackage) -> tuple[Any, CheckFinding]:
237
237
  """The shipped fitted model unpickles to the class ``MyModel()`` builds."""
238
- from tracebloc.raw_mode import load_beside
238
+ from tracebloc.raw_mode.fitted_model import load_beside
239
239
 
240
240
  if written.weights is None:
241
241
  return None, CheckFinding(
@@ -355,7 +355,7 @@ class HuggingFaceFamily:
355
355
  return None
356
356
  if "auto_map" in config:
357
357
  return None # the model ships its own code: the own-code converter's
358
- from tracebloc._framework_utils import require_module
358
+ from tracebloc.compat.frameworks import require_module
359
359
 
360
360
  transformers = require_module("transformers", "converting a Hugging Face model")
361
361
  read_from = CONFIG_FILE
@@ -67,7 +67,7 @@ def model_type_of(folder: Path, config: Any) -> str | None:
67
67
  architectures = _names(config.get("architectures"))
68
68
  if "auto_map" in config or not architectures:
69
69
  return None
70
- from tracebloc._framework_utils import require_module
70
+ from tracebloc.compat.frameworks import require_module
71
71
 
72
72
  require_module("transformers", "converting a Hugging Face model")
73
73
  return _architecture_model_type(folder, architectures[0])
@@ -23,9 +23,9 @@ from tracebloc.convert.interfaces import (
23
23
  GeneratedPackage, Proof, Provenance, Recognition, RefusalCause, SourcedValue,
24
24
  UseCaseTask, ValueSource,
25
25
  )
26
- from tracebloc._framework_utils import extra_for_module
26
+ from tracebloc.compat.frameworks import extra_for_module
27
27
  from tracebloc.utils.constants import Framework, TaskCategory
28
- from tracebloc.utils.general_utils import format_exception
28
+ from tracebloc.utils.errors import format_exception
29
29
 
30
30
  #: The libraries whose fitted models this family reads, by top-level module.
31
31
  FRAMEWORK_OF_ROOT = {
@@ -69,7 +69,7 @@ from tracebloc.utils.constants import (
69
69
  PYTORCH_FRAMEWORK,
70
70
  _StringEnum,
71
71
  )
72
- from tracebloc.utils.general_utils import format_exception
72
+ from tracebloc.utils.errors import format_exception
73
73
  from tracebloc.validation.header_rules import (
74
74
  missing_framework_message,
75
75
  required_values,
@@ -27,7 +27,7 @@ from tracebloc.convert.interfaces import (
27
27
  )
28
28
  from tracebloc.convert.package import SEED_EXCLUDED_PREFIXES, WrittenPackage
29
29
  from tracebloc.utils.constants import Framework, TaskCategory
30
- from tracebloc.utils.general_utils import format_exception
30
+ from tracebloc.utils.errors import format_exception
31
31
  from tracebloc.validation.header_rules import SHAPE_VALUES
32
32
 
33
33
  #: The probe's batch, and its sequence length's ceiling.
@@ -171,7 +171,7 @@ def probe_for(category: str, header: Mapping[str, Any], model: Any) -> Probe:
171
171
  generator = torch.Generator().manual_seed(1234)
172
172
  kind = input_kind(category)
173
173
  if kind == "image":
174
- from tracebloc.utils.general_utils import detect_input_channels
174
+ from tracebloc.utils.data_probes import detect_input_channels
175
175
 
176
176
  side = int(header.get("image_size") or 224)
177
177
  channels = detect_input_channels(model)
@@ -220,7 +220,7 @@ def build(
220
220
  compared_output=compared,
221
221
  values=values,
222
222
  weights=saved,
223
- tokenizer=state.get("tokenizer"),
223
+ tokenizer=_padded_tokenizer(state.get("tokenizer"), workdir),
224
224
  changed_arguments=(
225
225
  *shaken.changed_arguments,
226
226
  *state.get("changed", ()),
@@ -230,6 +230,23 @@ def build(
230
230
  )
231
231
 
232
232
 
233
+ def _padded_tokenizer(tokenizer: Path | None, workdir: Path) -> Path | None:
234
+ """The folder's ``tokenizer.json`` with the padding its config declares baked in."""
235
+ if tokenizer is None:
236
+ return None
237
+ from tracebloc.convert.padding import declared_padding
238
+ from tracebloc.convert.tokenizers import generate_tokenizer_json
239
+ from tracebloc.convert.tokenizers import read_vocabulary
240
+
241
+ try:
242
+ config = read_vocabulary(tokenizer.parent).config
243
+ except ConversionRefusedError:
244
+ return tokenizer # an unreadable sidecar declares nothing
245
+ if declared_padding(config) is None:
246
+ return tokenizer
247
+ return generate_tokenizer_json(tokenizer.parent, workdir / "tokenizer")
248
+
249
+
233
250
  def remote_call(state: Mapping[str, Any], task: UseCaseTask) -> tuple[str, str]:
234
251
  """A config-built class: its config inlined, the class count set as
235
252
  ``num_labels``, and the head's keys as the task sets them (:func:`head_config`)."""
@@ -19,7 +19,7 @@ from pathlib import Path
19
19
  from typing import Any, Iterable, Mapping
20
20
 
21
21
  from tracebloc.convert.interfaces import ConversionRefusedError, RefusalCause
22
- from tracebloc.utils.general_utils import format_exception
22
+ from tracebloc.utils.errors import format_exception
23
23
 
24
24
  #: Files that hold weights the converter reads.
25
25
  WEIGHT_SUFFIXES = (".ckpt", ".pt", ".pth", ".bin", ".safetensors")
@@ -350,7 +350,7 @@ def state_dict_shapes(written: WrittenPackage) -> dict[str, tuple[int, ...]]:
350
350
  Built on the meta device, which allocates no memory, and on the CPU when
351
351
  the model's constructor cannot run there.
352
352
  """
353
- from tracebloc._framework_utils import require_module
353
+ from tracebloc.compat.frameworks import require_module
354
354
 
355
355
  torch = require_module("torch", purpose="deriving a converted PyTorch model's head")
356
356
  with tempfile.TemporaryDirectory(prefix="tracebloc_probe_") as raw:
@@ -0,0 +1,29 @@
1
+ """The pad token a tokenizer.json names, which is loaded with no config beside it."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Mapping
6
+
7
+
8
+ def designate_padding(tokenizer: Any, pad_token: str | None) -> None:
9
+ """Name the pad token in the file, which is loaded with no config beside it."""
10
+ from tracebloc.utils.text_classification_utils import PAD_TOKEN_FORMS
11
+
12
+ if tokenizer.padding is not None:
13
+ return
14
+ vocab = tokenizer.get_vocab()
15
+ forms = (pad_token, *PAD_TOKEN_FORMS)
16
+ chosen = next((form for form in forms if form and form in vocab), None)
17
+ if chosen is not None:
18
+ tokenizer.enable_padding(pad_id=vocab[chosen], pad_token=chosen)
19
+
20
+
21
+ def declared_padding(config: Mapping[str, Any]) -> str | None:
22
+ """The ``pad_token``, else the ``eos_token``, a ``tokenizer_config.json`` declares."""
23
+ for role in ("pad_token", "eos_token"):
24
+ declared = config.get(role)
25
+ if isinstance(declared, Mapping):
26
+ declared = declared.get("content")
27
+ if isinstance(declared, str) and declared:
28
+ return declared
29
+ return None
@@ -20,8 +20,9 @@ from typing import Any, Callable, Iterator, Mapping, Sequence
20
20
 
21
21
  from tracebloc.convert.interfaces import CheckFinding, ConversionRefusedError
22
22
  from tracebloc.convert.interfaces import RefusalCause
23
+ from tracebloc.convert.padding import declared_padding, designate_padding
23
24
  from tracebloc.utils.constants import _StringEnum
24
- from tracebloc.utils.general_utils import format_exception
25
+ from tracebloc.utils.errors import format_exception
25
26
 
26
27
  #: The file name the platform reads a tokenizer from.
27
28
  TOKENIZER_FILE = "tokenizer.json"
@@ -280,19 +281,6 @@ def _word_level_tokenizer(original: Any) -> Any:
280
281
  return tokenizer
281
282
 
282
283
 
283
- def _designate_padding(tokenizer: Any, pad_token: str | None) -> None:
284
- """Name the pad token in the file, which is loaded with no config beside it."""
285
- from tracebloc.utils.text_classification_utils import PAD_TOKEN_FORMS
286
-
287
- if tokenizer.padding is not None:
288
- return
289
- vocab = tokenizer.get_vocab()
290
- forms = (pad_token, *PAD_TOKEN_FORMS)
291
- chosen = next((form for form in forms if form and form in vocab), None)
292
- if chosen is not None:
293
- tokenizer.enable_padding(pad_id=vocab[chosen], pad_token=chosen)
294
-
295
-
296
284
  def generate_tokenizer_json(source: Path, workdir: Path) -> Path:
297
285
  """Write ``workdir/tokenizer.json`` from the vocabulary at ``source``.
298
286
 
@@ -305,6 +293,7 @@ def generate_tokenizer_json(source: Path, workdir: Path) -> Path:
305
293
  pad_token: str | None = None
306
294
  if vocabulary.kind is VocabularyKind.TOKENIZER_JSON:
307
295
  tokenizer = _read(vocabulary.files["tokenizer"], Tokenizer.from_file)
296
+ pad_token = declared_padding(vocabulary.config)
308
297
  elif vocabulary.kind is VocabularyKind.CHARACTER:
309
298
  tokenizer = _character_tokenizer(_characters(vocabulary))
310
299
  pad_token = vocabulary.config.get("pad_token") or "[PAD]"
@@ -318,7 +307,7 @@ def generate_tokenizer_json(source: Path, workdir: Path) -> Path:
318
307
  else:
319
308
  name = type(original).__name__
320
309
  raise _refuse(f"{name} exists in Python only, with no tokenizer.json form")
321
- _designate_padding(tokenizer, pad_token)
310
+ designate_padding(tokenizer, pad_token)
322
311
  workdir.mkdir(parents=True, exist_ok=True)
323
312
  target = workdir / TOKENIZER_FILE
324
313
  tokenizer.save(str(target))
@@ -19,14 +19,14 @@ from importlib import metadata
19
19
  from pathlib import Path
20
20
  from typing import Iterable, Mapping
21
21
 
22
- from tracebloc._framework_utils import _normalize as _canonical
22
+ from tracebloc.compat.frameworks import _normalize as _canonical
23
23
  from tracebloc.convert.interfaces import (
24
24
  CheckFinding,
25
25
  ConversionRefusedError,
26
26
  ConverterWiringError,
27
27
  RefusalCause,
28
28
  )
29
- from tracebloc.utils.general_utils import format_exception
29
+ from tracebloc.utils.errors import format_exception
30
30
 
31
31
  #: The vendored copy of the training images' requirements.
32
32
  PINS_FILE = (
@@ -41,7 +41,7 @@ import uuid
41
41
  from tracebloc.contracts import survival_payload
42
42
  from tracebloc.exceptions import FrameworkNotInstalledError, LifelinesWeightsError
43
43
  from tracebloc.utils.entry_point import missing_entry_point_message
44
- from tracebloc.utils.general_utils import format_exception
44
+ from tracebloc.utils.errors import format_exception
45
45
  from tracebloc.utils.safetensors_io import load_weights_with_envelope
46
46
 
47
47
  #: The extra that installs everything :func:`load_lifelines_model` imports.
@@ -48,9 +48,9 @@ from urllib.parse import urlsplit
48
48
 
49
49
  import requests
50
50
 
51
- from ._http_utils import _extract_error_message
52
- from .exceptions import APIError
53
- from .fetch import (
51
+ from ..api.responses import _extract_error_message
52
+ from ..exceptions import APIError
53
+ from ..fetch import (
54
54
  _CHUNK,
55
55
  _clear_abandoned_temps,
56
56
  _read_manifest,
@@ -60,7 +60,7 @@ from .fetch import (
60
60
  expected_names,
61
61
  zoo_template_stem,
62
62
  )
63
- from .utils.general_utils import format_exception, print_error
63
+ from ..utils.errors import format_exception, print_error
64
64
 
65
65
  #: The backend's seed key: a zoo template's file stem.
66
66
  _STEM = re.compile(r"[a-z0-9_]{1,128}")
@@ -0,0 +1,18 @@
1
+ """Re-exports only (RFC-0348 C.3): moved to :mod:`tracebloc.auth.env_login`.
2
+
3
+ Every name stays importable from this path for existing callers; new code
4
+ imports from the new module.
5
+ """
6
+
7
+ from tracebloc.auth.env_login import ( # noqa: F401 (re-export, RFC-0348 C.3)
8
+ TOKEN_ENV_VAR,
9
+ API_URL_ENV_VAR,
10
+ APP_URL_ENV_VAR,
11
+ ENV_TOKEN_SCHEME,
12
+ _ALLOWED_URL_SCHEMES,
13
+ _has_forbidden_character,
14
+ _read_var,
15
+ _validate_base_url,
16
+ EnvironmentLogin,
17
+ read_environment_login,
18
+ )
@@ -115,7 +115,7 @@ class NotebookContextError(TraceblocError, ValueError):
115
115
 
116
116
  class LifelinesWeightsError(TraceblocError, ValueError):
117
117
  """Raised when a downloaded lifelines weights file cannot be loaded into a
118
- fitter (``tracebloc.lifelines_weights.load_lifelines_model``): it is not a
118
+ fitter (``tracebloc.downloads.lifelines_weights.load_lifelines_model``): it is not a
119
119
  coefficients file of the version this SDK reads, or the model given is not a
120
120
  fitter of the file's estimator."""
121
121