tracebloc 1.2.83__tar.gz → 1.2.85__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 (167) hide show
  1. {tracebloc-1.2.83 → tracebloc-1.2.85}/PKG-INFO +1 -1
  2. {tracebloc-1.2.83 → tracebloc-1.2.85}/pyproject.toml +1 -1
  3. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_link_regeneration.py +14 -4
  4. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_linking.py +2 -0
  5. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/families/hf/__init__.py +8 -0
  6. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/heads.py +26 -1
  7. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/assemble.py +9 -4
  8. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/head.py +1 -0
  9. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/remote.py +1 -0
  10. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/link_model_dataset.py +2 -1
  11. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/notebook/__init__.py +1 -0
  12. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/lora.py +2 -0
  13. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/lora_validation.py +5 -1
  14. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/loss.py +7 -0
  15. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/plan.py +2 -0
  16. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/shape.py +3 -0
  17. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/model_upload.py +3 -0
  18. tracebloc-1.2.85/tracebloc/upload/torch_multi_label_text_classifier.py +110 -0
  19. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_nlp_base.py +14 -3
  20. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/user.py +3 -0
  21. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/constants.py +6 -4
  22. tracebloc-1.2.85/tracebloc/utils/data_probes.py +282 -0
  23. tracebloc-1.2.85/tracebloc/utils/device.py +143 -0
  24. tracebloc-1.2.85/tracebloc/utils/errors.py +67 -0
  25. tracebloc-1.2.85/tracebloc/utils/general_utils.py +61 -0
  26. tracebloc-1.2.85/tracebloc/utils/model_loading.py +227 -0
  27. tracebloc-1.2.85/tracebloc/utils/model_params.py +285 -0
  28. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/registry.py +5 -0
  29. tracebloc-1.2.85/tracebloc/utils/resources.py +216 -0
  30. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/text_classification_utils.py +9 -5
  31. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/validation/header_rules.py +2 -0
  32. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc.egg-info/PKG-INFO +1 -1
  33. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc.egg-info/SOURCES.txt +7 -0
  34. tracebloc-1.2.83/tracebloc/utils/general_utils.py +0 -1188
  35. {tracebloc-1.2.83 → tracebloc-1.2.85}/MANIFEST.in +0 -0
  36. {tracebloc-1.2.83 → tracebloc-1.2.85}/README.md +0 -0
  37. {tracebloc-1.2.83 → tracebloc-1.2.85}/license.txt +0 -0
  38. {tracebloc-1.2.83 → tracebloc-1.2.85}/setup.cfg +0 -0
  39. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/__init__.py +0 -0
  40. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_deprecation.py +0 -0
  41. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_framework_utils.py +0 -0
  42. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_http_utils.py +0 -0
  43. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_link_answer.py +0 -0
  44. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_raw_width_note.py +0 -0
  45. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_stored_link.py +0 -0
  46. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/_upload_conversion.py +0 -0
  47. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/checks.py +0 -0
  48. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/client.py +0 -0
  49. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/config.py +0 -0
  50. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/contracts/stage_urls.v1.json +0 -0
  51. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/contracts/stage_urls.v1.source.json +0 -0
  52. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/contracts/survival_payload.py +0 -0
  53. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/contracts/training_requirements.source.json +0 -0
  54. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/contracts/training_requirements.txt +0 -0
  55. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/__init__.py +0 -0
  56. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/acceptance.py +0 -0
  57. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/families/__init__.py +0 -0
  58. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/families/hf/_build.py +0 -0
  59. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/families/hf/_model_type.py +0 -0
  60. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/families/tabular.py +0 -0
  61. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/families/vision/__init__.py +0 -0
  62. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/families/vision/_matching.py +0 -0
  63. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/gate.py +0 -0
  64. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/interfaces.py +0 -0
  65. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/licence/__init__.py +0 -0
  66. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/licence/spdx.py +0 -0
  67. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/outputs.py +0 -0
  68. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/__init__.py +0 -0
  69. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/arguments.py +0 -0
  70. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/checkpoint.py +0 -0
  71. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/gate_rules.py +0 -0
  72. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/generate.py +0 -0
  73. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/import_check.py +0 -0
  74. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/layer0.py +0 -0
  75. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/live.py +0 -0
  76. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/model_class.py +0 -0
  77. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/repo.py +0 -0
  78. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/shake.py +0 -0
  79. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/owncode/source_tree.py +0 -0
  80. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/package.py +0 -0
  81. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/report.py +0 -0
  82. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/tokenizers.py +0 -0
  83. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/convert/training_versions.py +0 -0
  84. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/env_login.py +0 -0
  85. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/exceptions.py +0 -0
  86. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/fetch.py +0 -0
  87. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/inference.py +0 -0
  88. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/library_fetch.py +0 -0
  89. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/lifelines_weights.py +0 -0
  90. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/notebook/templates/_partials.tpl +0 -0
  91. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/notebook/templates/embeddings.tpl +0 -0
  92. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/notebook/templates/nlp_finetune.tpl +0 -0
  93. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/notebook/templates/nlp_generative.tpl +0 -0
  94. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/notebook/templates/survival.tpl +0 -0
  95. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/notebook/templates/tabular_timeseries.tpl +0 -0
  96. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/notebook/templates/vision_from_scratch.tpl +0 -0
  97. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/raw_mode.py +0 -0
  98. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/raw_mode_frame.py +0 -0
  99. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/raw_mode_seed.py +0 -0
  100. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/raw_mode_survival.py +0 -0
  101. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/raw_mode_torch.py +0 -0
  102. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/seed_weights.py +0 -0
  103. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/__init__.py +0 -0
  104. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/augmentation.py +0 -0
  105. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/callbacks.py +0 -0
  106. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/converted.py +0 -0
  107. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/features.py +0 -0
  108. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/image_channels.py +0 -0
  109. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/image_size.py +0 -0
  110. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/memory_estimate.py +0 -0
  111. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/preprocessing.py +0 -0
  112. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/subdataset.py +0 -0
  113. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/submitter.py +0 -0
  114. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/training/summary.py +0 -0
  115. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/__init__.py +0 -0
  116. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/lifelines_time_to_event.py +0 -0
  117. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/scikit_survival_time_to_event.py +0 -0
  118. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/sequence_length.py +0 -0
  119. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/skl_tabular_base.py +0 -0
  120. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/skl_tabular_classifier.py +0 -0
  121. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/skl_tabular_regression.py +0 -0
  122. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/statistical_base.py +0 -0
  123. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/survival_base.py +0 -0
  124. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_causal_language_modeler.py +0 -0
  125. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_embeddings.py +0 -0
  126. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_image_classifier.py +0 -0
  127. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_key_point_detector.py +0 -0
  128. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_masked_language_modeler.py +0 -0
  129. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_object_detector.py +0 -0
  130. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_semantic_segmentation.py +0 -0
  131. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_sentence_pair_classifier.py +0 -0
  132. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_seq2seq_modeler.py +0 -0
  133. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_tabular_classifier.py +0 -0
  134. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_tabular_regression.py +0 -0
  135. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_text_classifier.py +0 -0
  136. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_time_series_classifier.py +0 -0
  137. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_time_series_forecaster.py +0 -0
  138. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_time_to_event.py +0 -0
  139. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/torch_token_classifier.py +0 -0
  140. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/weight_loaders.py +0 -0
  141. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/upload/weights_parts.py +0 -0
  142. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/__init__.py +0 -0
  143. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/class_order.py +0 -0
  144. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/custom_loss_probe.py +0 -0
  145. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/detection_utils.py +0 -0
  146. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/entry_point.py +0 -0
  147. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/feature_dict.py +0 -0
  148. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/key_point_detection_utils.py +0 -0
  149. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/safetensors_io.py +0 -0
  150. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/semantic_segmentation_utils.py +0 -0
  151. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/tabular_classification_utils.py +0 -0
  152. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/tabular_custom_loss_utils.py +0 -0
  153. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/tabular_regression_utils.py +0 -0
  154. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/time_series_utils.py +0 -0
  155. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/time_to_event_utils.py +0 -0
  156. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/utils/warnings_once.py +0 -0
  157. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/validation/__init__.py +0 -0
  158. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/validation/checker.py +0 -0
  159. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/validation/lifelines_checks.py +0 -0
  160. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/validation/pytorch_checks.py +0 -0
  161. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/validation/rewriter.py +0 -0
  162. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/validation/scikit_survival_checks.py +0 -0
  163. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc/validation/sklearn_checks.py +0 -0
  164. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc.egg-info/dependency_links.txt +0 -0
  165. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc.egg-info/requires.txt +0 -0
  166. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc.egg-info/top_level.txt +0 -0
  167. {tracebloc-1.2.83 → tracebloc-1.2.85}/tracebloc_package/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tracebloc
3
- Version: 1.2.83
3
+ Version: 1.2.85
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.83"
7
+ version = "1.2.85"
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"]
@@ -2,9 +2,11 @@
2
2
 
3
3
  At link the dataset's counts and class names arrive. A package the converter
4
4
  generated is rebuilt from the peer's original with the dataset's counts when a
5
- count the link compares differs, and its head is then fitted to the dataset's
6
- classes: a head whose class names are the dataset's keeps its rows, reordered
7
- into the dataset's order; any other head the checkpoint carried starts fresh.
5
+ count the link compares differs, or with the dataset's class names when its
6
+ task names its head for them (``NAMED_AT_LINK``), and its head is then fitted to
7
+ the dataset's classes: a head whose class names are the dataset's keeps its
8
+ rows, reordered into the dataset's order; any other head the checkpoint carried
9
+ starts fresh.
8
10
  A file the peer wrote (Layer 0) is never rewritten here.
9
11
  """
10
12
 
@@ -29,6 +31,7 @@ from tracebloc.convert.interfaces import (
29
31
  UseCaseTask,
30
32
  ValueSource,
31
33
  )
34
+ from tracebloc.convert.heads import NAMED_AT_LINK
32
35
  from tracebloc.convert.package import SEED_EXCLUDED_PREFIXES, write_package
33
36
  from tracebloc.convert.report import report_document, write_report
34
37
  from tracebloc.utils.constants import TaskCategory
@@ -327,7 +330,12 @@ def regenerated_for_link(
327
330
  order = content.get("class_order")
328
331
  order = tuple(str(name) for name in order) if isinstance(order, list) else ()
329
332
  outcome, said = conversion, []
330
- if changed:
333
+ unnamed = (
334
+ bool(order)
335
+ and category in NAMED_AT_LINK
336
+ and order != conversion.task.class_names
337
+ )
338
+ if changed or unnamed:
331
339
  task = UseCaseTask(
332
340
  conversion.task.category,
333
341
  from_use_case=True,
@@ -347,6 +355,8 @@ def regenerated_for_link(
347
355
  except ConversionRefusedError:
348
356
  return None # the link's mismatch report names the counts
349
357
  said.extend(f"{name} {old} -> {new}" for name, (old, new) in changed.items())
358
+ if unnamed:
359
+ said.append("the head's classes named as the dataset's")
350
360
  aligned = align_head(outcome, order)
351
361
  if aligned is not None:
352
362
  outcome = aligned[0]
@@ -53,6 +53,7 @@ from tracebloc.utils.constants import (
53
53
  TEXT_CLASSIFICATION,
54
54
  TOKEN_CLASSIFICATION,
55
55
  SENTENCE_PAIR_CLASSIFICATION,
56
+ MULTI_LABEL_TEXT_CLASSIFICATION,
56
57
  TABULAR_CLASSIFICATION,
57
58
  TABULAR_REGRESSION,
58
59
  KEYPOINT_DETECTION,
@@ -426,6 +427,7 @@ def _apply_link_success(
426
427
  in (
427
428
  TEXT_CLASSIFICATION,
428
429
  SENTENCE_PAIR_CLASSIFICATION,
430
+ MULTI_LABEL_TEXT_CLASSIFICATION,
429
431
  TIME_SERIES_CLASSIFICATION,
430
432
  )
431
433
  and class_names
@@ -28,6 +28,7 @@ from tracebloc.convert.families.hf._build import with_pad_token_id, write_weight
28
28
  from tracebloc.convert.families.hf._model_type import _AUTO, CONFIG_FILE, _mapping
29
29
  from tracebloc.convert.families.hf._model_type import _names, model_type_of
30
30
  from tracebloc.convert.families.vision import read_normalisation
31
+ from tracebloc.convert.heads import head_config
31
32
  from tracebloc.convert.interfaces import ComparedOutput, ConversionInput, Proof
32
33
  from tracebloc.convert.interfaces import ConversionRefusedError, RefusalCause
33
34
  from tracebloc.convert.interfaces import GeneratedFile, GeneratedPackage, Recognition
@@ -78,6 +79,10 @@ TASK_CLASSES: dict[TaskCategory, tuple[str, str]] = {
78
79
  "AutoModelForSequenceClassification",
79
80
  "MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES",
80
81
  ),
82
+ TaskCategory.MULTI_LABEL_TEXT_CLASSIFICATION: (
83
+ "AutoModelForSequenceClassification",
84
+ "MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES",
85
+ ),
81
86
  TaskCategory.TOKEN_CLASSIFICATION: (
82
87
  "AutoModelForTokenClassification",
83
88
  "MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES",
@@ -415,6 +420,9 @@ class HuggingFaceFamily:
415
420
  label = values["entry_point"].value
416
421
  auto_class = task_class(state, category, label)
417
422
  classes = _classes(task, values, label)
423
+ count = classes.value if classes is not None else None
424
+ head = head_config(category, task.class_names, count)
425
+ state = {**state, "config": {**state["config"], **head}}
418
426
  model, fresh, dropped = load(state, auto_class, classes, category, label)
419
427
  wrapper = None
420
428
  if category is TaskCategory.IMAGE_CLASSIFICATION:
@@ -5,9 +5,34 @@ Stdlib and ``tracebloc`` core at import.
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- from typing import Iterable
8
+ from typing import Any, Iterable, Mapping, Sequence
9
9
 
10
10
  from tracebloc.convert.interfaces import GeneratedPackage
11
+ from tracebloc.utils.constants import TaskCategory
12
+
13
+ #: The Hugging Face ``problem_type`` a task's head is built with, which picks
14
+ #: the loss and activation transformers apply. Set from the task, never carried
15
+ #: from the checkpoint.
16
+ PROBLEM_TYPES: Mapping[TaskCategory, str] = {
17
+ TaskCategory.MULTI_LABEL_TEXT_CLASSIFICATION: "multi_label_classification",
18
+ }
19
+ #: Tasks whose Hugging Face head is named for the use case's classes once the
20
+ #: link gives them; until then transformers' ``LABEL_<n>``.
21
+ NAMED_AT_LINK = frozenset({TaskCategory.MULTI_LABEL_TEXT_CLASSIFICATION})
22
+
23
+
24
+ def head_config(
25
+ category: TaskCategory, class_names: Sequence[str], classes: int | None
26
+ ) -> dict[str, Any]:
27
+ """The config keys the task sets on a Hugging Face head: its ``problem_type``,
28
+ and ``id2label`` / ``label2id`` when ``class_names`` are as many as ``classes``."""
29
+ config: dict[str, Any] = {}
30
+ if category in PROBLEM_TYPES:
31
+ config["problem_type"] = PROBLEM_TYPES[category]
32
+ if category in NAMED_AT_LINK and class_names and len(class_names) == classes:
33
+ config["id2label"] = dict(enumerate(class_names))
34
+ config["label2id"] = {name: index for index, name in enumerate(class_names)}
35
+ return config
11
36
 
12
37
  #: A package value naming its backbone's module: the keys the shipped weights
13
38
  #: lack outside it, or in its pooler, start fresh (:func:`head_key`).
@@ -26,6 +26,7 @@ from tracebloc.convert.interfaces import (
26
26
  UseCaseTask,
27
27
  ValueSource,
28
28
  )
29
+ from tracebloc.convert.heads import head_config
29
30
  from tracebloc.convert.owncode import generate, head
30
31
  from tracebloc.convert.owncode.arguments import CLASS_COUNT_PARAMETERS
31
32
  from tracebloc.convert.owncode.checkpoint import save
@@ -150,7 +151,7 @@ def build(
150
151
  weights = state.get("weights")
151
152
  plan, head_notes, head_changes = head.Head(), list[str](), list[str]()
152
153
  if state.get("config") is not None:
153
- call, preamble = remote_call(state, category)
154
+ call, preamble = remote_call(state, task)
154
155
  else:
155
156
  plan, weights, head_notes, head_changes = carry_head(
156
157
  state, category, task, class_count
@@ -229,14 +230,18 @@ def build(
229
230
  )
230
231
 
231
232
 
232
- def remote_call(state: Mapping[str, Any], category: TaskCategory) -> tuple[str, str]:
233
- """A config-built class: its config inlined, the class count set as ``num_labels``."""
233
+ def remote_call(state: Mapping[str, Any], task: UseCaseTask) -> tuple[str, str]:
234
+ """A config-built class: its config inlined, the class count set as
235
+ ``num_labels``, and the head's keys as the task sets them (:func:`head_config`)."""
236
+ category = TaskCategory(task.category)
234
237
  config = dict(state["config"])
235
238
  call = "**CONFIG"
236
239
  if generate.has_output_classes(category):
237
- for key in ("num_labels", "id2label", "label2id"):
240
+ for key in ("num_labels", "id2label", "label2id", "problem_type"):
238
241
  config.pop(key, None)
239
242
  call += ", num_labels=output_classes"
243
+ classes = task.counts.get("output_classes")
244
+ config.update(head_config(category, task.class_names, classes))
240
245
  return f"{state['config_class']}({call})", generate.config_literal(config)
241
246
 
242
247
 
@@ -25,6 +25,7 @@ CLASSIFICATION_HEADS = (
25
25
  TaskCategory.IMAGE_CLASSIFICATION,
26
26
  TaskCategory.TEXT_CLASSIFICATION,
27
27
  TaskCategory.SENTENCE_PAIR_CLASSIFICATION,
28
+ TaskCategory.MULTI_LABEL_TEXT_CLASSIFICATION,
28
29
  TaskCategory.TOKEN_CLASSIFICATION,
29
30
  TaskCategory.TABULAR_CLASSIFICATION,
30
31
  TaskCategory.TIME_SERIES_CLASSIFICATION,
@@ -43,6 +43,7 @@ AUTO_CLASS = {
43
43
  TaskCategory.OBJECT_DETECTION: "AutoModelForObjectDetection",
44
44
  TaskCategory.TEXT_CLASSIFICATION: "AutoModelForSequenceClassification",
45
45
  TaskCategory.SENTENCE_PAIR_CLASSIFICATION: "AutoModelForSequenceClassification",
46
+ TaskCategory.MULTI_LABEL_TEXT_CLASSIFICATION: "AutoModelForSequenceClassification",
46
47
  TaskCategory.TOKEN_CLASSIFICATION: "AutoModelForTokenClassification",
47
48
  TaskCategory.MASKED_LANGUAGE_MODELING: "AutoModelForMaskedLM",
48
49
  TaskCategory.CAUSAL_LANGUAGE_MODELING: "AutoModelForCausalLM",
@@ -1103,7 +1103,8 @@ class LinkModelDataset:
1103
1103
  print(
1104
1104
  "Operation not allowed. LoRA is only supported for NLP models "
1105
1105
  "(text_classification, token_classification, "
1106
- "sentence_pair_classification, masked_language_modeling, "
1106
+ "sentence_pair_classification, multi_label_text_classification, "
1107
+ "masked_language_modeling, "
1107
1108
  "causal_language_modeling, seq2seq, embeddings)."
1108
1109
  )
1109
1110
  return
@@ -140,6 +140,7 @@ FAMILIES = {
140
140
  "nlp_finetune": (
141
141
  Category.TEXT_CLASSIFICATION,
142
142
  Category.SENTENCE_PAIR_CLASSIFICATION,
143
+ Category.MULTI_LABEL_TEXT_CLASSIFICATION,
143
144
  Category.TOKEN_CLASSIFICATION,
144
145
  ),
145
146
  "nlp_generative": (
@@ -24,6 +24,7 @@ from tracebloc.utils.constants import (
24
24
  EMBEDDINGS,
25
25
  MASKED_LANGUAGE_MODELING,
26
26
  SENTENCE_PAIR_CLASSIFICATION,
27
+ MULTI_LABEL_TEXT_CLASSIFICATION,
27
28
  SEQ2SEQ,
28
29
  TEXT_CLASSIFICATION,
29
30
  TOKEN_CLASSIFICATION,
@@ -43,6 +44,7 @@ LORA_CATEGORIES = (
43
44
  TEXT_CLASSIFICATION,
44
45
  TOKEN_CLASSIFICATION,
45
46
  SENTENCE_PAIR_CLASSIFICATION,
47
+ MULTI_LABEL_TEXT_CLASSIFICATION,
46
48
  MASKED_LANGUAGE_MODELING,
47
49
  CAUSAL_LANGUAGE_MODELING,
48
50
  SEQ2SEQ,
@@ -33,6 +33,7 @@ from tracebloc.utils.constants import (
33
33
  TEXT_CLASSIFICATION,
34
34
  TOKEN_CLASSIFICATION,
35
35
  SENTENCE_PAIR_CLASSIFICATION,
36
+ MULTI_LABEL_TEXT_CLASSIFICATION,
36
37
  MASKED_LANGUAGE_MODELING,
37
38
  CAUSAL_LANGUAGE_MODELING,
38
39
  SEQ2SEQ,
@@ -163,6 +164,7 @@ class LoraValidator(_FacadeCoordinator):
163
164
  TEXT_CLASSIFICATION,
164
165
  TOKEN_CLASSIFICATION,
165
166
  SENTENCE_PAIR_CLASSIFICATION,
167
+ MULTI_LABEL_TEXT_CLASSIFICATION,
166
168
  MASKED_LANGUAGE_MODELING,
167
169
  CAUSAL_LANGUAGE_MODELING,
168
170
  SEQ2SEQ,
@@ -171,7 +173,8 @@ class LoraValidator(_FacadeCoordinator):
171
173
  print(
172
174
  "Operation not allowed. LoRA parameters are only supported for NLP models "
173
175
  "(text_classification, token_classification, "
174
- "sentence_pair_classification, masked_language_modeling, "
176
+ "sentence_pair_classification, multi_label_text_classification, "
177
+ "masked_language_modeling, "
175
178
  "causal_language_modeling, seq2seq, embeddings)."
176
179
  )
177
180
  return
@@ -190,6 +193,7 @@ class LoraValidator(_FacadeCoordinator):
190
193
  TEXT_CLASSIFICATION,
191
194
  TOKEN_CLASSIFICATION,
192
195
  SENTENCE_PAIR_CLASSIFICATION,
196
+ MULTI_LABEL_TEXT_CLASSIFICATION,
193
197
  MASKED_LANGUAGE_MODELING,
194
198
  CAUSAL_LANGUAGE_MODELING,
195
199
  SEQ2SEQ,
@@ -49,6 +49,7 @@ from tracebloc.utils.constants import (
49
49
  TEXT_CLASSIFICATION,
50
50
  TOKEN_CLASSIFICATION,
51
51
  SENTENCE_PAIR_CLASSIFICATION,
52
+ MULTI_LABEL_TEXT_CLASSIFICATION,
52
53
  MASKED_LANGUAGE_MODELING,
53
54
  CAUSAL_LANGUAGE_MODELING,
54
55
  SEQ2SEQ,
@@ -245,6 +246,11 @@ _LOSS_POLICY = {
245
246
  # runtime hardcodes cox_ph_loss_torch and ignores the rest (#762 > #113).
246
247
  (PYTORCH_FRAMEWORK, TIME_TO_EVENT_PREDICTION): ("coxph", ("coxph",)),
247
248
  (PYTORCH_FRAMEWORK, TIME_SERIES_FORECASTING): ("mse", ("mse", "l1")),
249
+ # Multi-hot targets against the logits; the engine never reads a model's own loss.
250
+ (PYTORCH_FRAMEWORK, MULTI_LABEL_TEXT_CLASSIFICATION): (
251
+ "bcewithlogits",
252
+ ("bcewithlogits",),
253
+ ),
248
254
  # Catch-all: image / keypoint / object-detection.
249
255
  (PYTORCH_FRAMEWORK, None): ("mse", ("crossentropy", "mse", "l1")),
250
256
  # sklearn's allowlist is category-independent (worker wires only MSE + binary
@@ -474,6 +480,7 @@ class LossFunctionConfig(_FacadeCoordinator):
474
480
  TEXT_CLASSIFICATION,
475
481
  TOKEN_CLASSIFICATION,
476
482
  SENTENCE_PAIR_CLASSIFICATION,
483
+ MULTI_LABEL_TEXT_CLASSIFICATION,
477
484
  MASKED_LANGUAGE_MODELING,
478
485
  CAUSAL_LANGUAGE_MODELING,
479
486
  SEQ2SEQ,
@@ -30,6 +30,7 @@ from tracebloc.utils.constants import (
30
30
  MASKED_LANGUAGE_MODELING,
31
31
  SCIKIT_SURVIVAL_FRAMEWORK,
32
32
  SENTENCE_PAIR_CLASSIFICATION,
33
+ MULTI_LABEL_TEXT_CLASSIFICATION,
33
34
  SEQ2SEQ,
34
35
  SKLEARN_FRAMEWORK,
35
36
  TEXT_CLASSIFICATION,
@@ -57,6 +58,7 @@ _TEXT_CATEGORIES = (
57
58
  TEXT_CLASSIFICATION,
58
59
  TOKEN_CLASSIFICATION,
59
60
  SENTENCE_PAIR_CLASSIFICATION,
61
+ MULTI_LABEL_TEXT_CLASSIFICATION,
60
62
  MASKED_LANGUAGE_MODELING,
61
63
  CAUSAL_LANGUAGE_MODELING,
62
64
  SEQ2SEQ,
@@ -46,6 +46,7 @@ from tracebloc.utils.constants import (
46
46
  TIME_SERIES_CLASSIFICATION,
47
47
  TOKEN_CLASSIFICATION,
48
48
  SENTENCE_PAIR_CLASSIFICATION,
49
+ MULTI_LABEL_TEXT_CLASSIFICATION,
49
50
  TIME_TO_EVENT_PREDICTION,
50
51
  )
51
52
 
@@ -60,6 +61,7 @@ _SEQUENCE_CATEGORIES = (
60
61
  TEXT_CLASSIFICATION,
61
62
  TOKEN_CLASSIFICATION,
62
63
  SENTENCE_PAIR_CLASSIFICATION,
64
+ MULTI_LABEL_TEXT_CLASSIFICATION,
63
65
  MASKED_LANGUAGE_MODELING,
64
66
  CAUSAL_LANGUAGE_MODELING,
65
67
  SEQ2SEQ,
@@ -71,6 +73,7 @@ _TEXT_SEQUENCE_CATEGORIES = (
71
73
  TEXT_CLASSIFICATION,
72
74
  TOKEN_CLASSIFICATION,
73
75
  SENTENCE_PAIR_CLASSIFICATION,
76
+ MULTI_LABEL_TEXT_CLASSIFICATION,
74
77
  MASKED_LANGUAGE_MODELING,
75
78
  CAUSAL_LANGUAGE_MODELING,
76
79
  SEQ2SEQ,
@@ -56,6 +56,7 @@ from tracebloc.utils.constants import (
56
56
  OBJECT_DETECTION,
57
57
  TEXT_CLASSIFICATION,
58
58
  SENTENCE_PAIR_CLASSIFICATION,
59
+ MULTI_LABEL_TEXT_CLASSIFICATION,
59
60
  MASKED_LANGUAGE_MODELING,
60
61
  CAUSAL_LANGUAGE_MODELING,
61
62
  SEQ2SEQ,
@@ -892,6 +893,8 @@ class Model:
892
893
  # classification head (PyTorch only) — same CrossEntropy
893
894
  # default as text classification.
894
895
  SENTENCE_PAIR_CLASSIFICATION: nn.CrossEntropyLoss,
896
+ # Multi-hot float targets against raw logits (``bcewithlogits``).
897
+ MULTI_LABEL_TEXT_CLASSIFICATION: nn.BCEWithLogitsLoss,
895
898
  MASKED_LANGUAGE_MODELING: lambda: nn.CrossEntropyLoss(ignore_index=-100),
896
899
  CAUSAL_LANGUAGE_MODELING: lambda: nn.CrossEntropyLoss(
897
900
  ignore_index=-100
@@ -0,0 +1,110 @@
1
+ import random
2
+
3
+ import torch
4
+
5
+ from tracebloc.upload.torch_text_classifier import TorchTextClassifier
6
+ from tracebloc.utils.text_classification_utils import call_model_with_optional_mask
7
+
8
+ #: Seed of the smoke labels, so an upload's check is the same on every run.
9
+ _SMOKE_LABEL_SEED = 7
10
+
11
+
12
+ def multi_hot_smoke_labels(samples, classes, seed=_SMOKE_LABEL_SEED):
13
+ """``samples`` multi-hot float vectors over ``classes``, each with at least
14
+ one class and, where there are two or more classes, never all of them."""
15
+ rng = random.Random(seed)
16
+ most = max(1, classes - 1)
17
+ labels = []
18
+ for _ in range(samples):
19
+ on = set(rng.sample(range(classes), rng.randint(1, most)))
20
+ labels.append([1.0 if index in on else 0.0 for index in range(classes)])
21
+ return labels
22
+
23
+
24
+ class TorchMultiLabelTextClassifier(TorchTextClassifier):
25
+ """Upload-time functional check for PyTorch multi-label text-classification models.
26
+
27
+ Every class that applies to one text or sequence: the model must produce
28
+ logits ``(batch, output_classes)``, one per class, trained against
29
+ multi-hot float targets. As the engine does, the model is called without
30
+ ``labels`` and the plan's criterion (``bcewithlogits``) applied to its
31
+ logits, so a model's own loss is never what is checked.
32
+ """
33
+
34
+ _task_label = "Multi-label text-classification"
35
+ _no_trainable_params_error = (
36
+ "Model has no trainable parameters. Multi-label text-classification "
37
+ "models must have at least an encoder and a classifier head."
38
+ )
39
+ _no_linear_error = (
40
+ "Multi-label text-classification model has no nn.Linear layers. "
41
+ "Models need at least a classifier head (Linear projection to "
42
+ "output_classes) and Linear layers are required for LoRA fine-tuning."
43
+ )
44
+ _smoke_failure_template = (
45
+ "\nModel not supported for training on {category} dataset "
46
+ "as there is error {error} "
47
+ )
48
+ _model_loss_allowed = False
49
+ _multi_hot_targets = True
50
+
51
+ def _build_smoke_dataset(self, smoke_seq_len):
52
+ classes = self._class_count()
53
+ dataset = super()._build_smoke_dataset(smoke_seq_len)
54
+ dataset.labels = multi_hot_smoke_labels(len(dataset), classes)
55
+ return dataset
56
+
57
+ def _class_count(self):
58
+ """The declared ``output_classes``; refused unless a positive whole number."""
59
+ try:
60
+ classes = 0 if isinstance(self.classes, bool) else int(self.classes)
61
+ except (TypeError, ValueError):
62
+ classes = 0
63
+ if classes < 1:
64
+ raise ValueError(
65
+ f"Multi-label text-classification models declare output_classes, "
66
+ f"the dataset's number of classes; got {self.classes!r}."
67
+ )
68
+ return classes
69
+
70
+ def _probe_forward(self, inputs):
71
+ self._probe_batch = int(inputs["input_ids"].shape[0])
72
+ return super()._probe_forward(inputs)
73
+
74
+ def _assert_probe_logits(self, outputs, logits):
75
+ """Logits must be floating point, shaped ``(batch, output_classes)``:
76
+ one independent score per class, as many as the dataset has."""
77
+ if not torch.is_tensor(logits):
78
+ raise ValueError(
79
+ f"Could not extract a logits tensor from the model output "
80
+ f"(got {type(outputs).__name__}). Multi-label text-classification "
81
+ f"models must return a tensor, an object with a `.logits` "
82
+ f"attribute, a dict with a 'logits' key, or a tuple/list "
83
+ f"whose first element is the logits."
84
+ )
85
+ classes = self._class_count()
86
+ expected = (getattr(self, "_probe_batch", logits.shape[0]), classes)
87
+ if logits.dim() != 2 or tuple(logits.shape) != expected:
88
+ raise ValueError(
89
+ f"Multi-label text-classification model must output logits of "
90
+ f"shape (batch, output_classes) = {expected}, one score per "
91
+ f"class, got {tuple(logits.shape)}. A 3D output suggests a "
92
+ f"token-classification architecture."
93
+ )
94
+ if not logits.is_floating_point():
95
+ raise ValueError(
96
+ f"Multi-label text-classification model must output floating-"
97
+ f"point logits, got {logits.dtype}."
98
+ )
99
+
100
+ def _training_step(self, inputs, labels, loss_exists, is_hf_model):
101
+ if is_hf_model:
102
+ outputs = self.model(**inputs)
103
+ else:
104
+ # The edge passes attention_mask only when forward accepts it, and
105
+ # a forward error must surface, not be retried without the mask.
106
+ outputs = call_model_with_optional_mask(
107
+ self.model, inputs["input_ids"].long(), inputs.get("attention_mask")
108
+ )
109
+ logits = self._unwrap_probe_logits(outputs)
110
+ return self.loss(logits, labels.to(logits.dtype))
@@ -1,6 +1,6 @@
1
1
  """Shared template for the PyTorch NLP upload handlers (WS-U Step 1, #293).
2
2
 
3
- The six torch NLP modelers (text / token / sentence-pair classification,
3
+ The torch NLP modelers (text / token / sentence-pair classification,
4
4
  masked / causal LM, seq2seq, embeddings) used to carry near-identical copies
5
5
  of the same upload-time functional check: structural validation → synthetic
6
6
  smoke dataset → output-shape probe → declared-sequence-length probe → loss
@@ -117,6 +117,11 @@ class TorchNLPModelerBase(Model, TorchChecks):
117
117
  "\nModel not supported for training on {category} dataset "
118
118
  "as there is error {error} "
119
119
  )
120
+ #: False where the engine applies the plan's criterion to the logits and
121
+ #: never a model's own loss (multi-label text classification).
122
+ _model_loss_allowed = True
123
+ #: Whether a target is a multi-hot float vector rather than class indices.
124
+ _multi_hot_targets = False
120
125
 
121
126
  def __init__(
122
127
  self,
@@ -457,14 +462,20 @@ class TorchNLPModelerBase(Model, TorchChecks):
457
462
  CrossEntropy-style custom loss sees the standard 2D contract.
458
463
  Embeddings overrides this to a no-op (intrinsic objective).
459
464
  """
460
- loss_availability = self.check_loss_availability(loader=train_loader)
465
+ loss_availability = self._model_loss_allowed and self.check_loss_availability(
466
+ loader=train_loader
467
+ )
461
468
  if custom_loss:
462
469
  self.loss = self.configure_loss(custom_loss=True, category=self.category)
463
470
  loss_availability = False
464
471
  # Reject a loss coupled to a fixed input shape before it can
465
472
  # crash on the edge (the client pads to a different
466
473
  # batch*sequence_length than the smoke-train uses).
467
- assert_custom_loss_shape_robust(self.loss, self._custom_loss_probe_size())
474
+ assert_custom_loss_shape_robust(
475
+ self.loss,
476
+ self._custom_loss_probe_size(),
477
+ multi_hot=self._multi_hot_targets,
478
+ )
468
479
  elif not loss_availability or self.model_id_llm is None:
469
480
  self.loss = self._default_smoke_loss()
470
481
  return loss_availability
@@ -57,6 +57,7 @@ from tracebloc.utils.constants import (
57
57
  TEXT_CLASSIFICATION,
58
58
  TOKEN_CLASSIFICATION,
59
59
  SENTENCE_PAIR_CLASSIFICATION,
60
+ MULTI_LABEL_TEXT_CLASSIFICATION,
60
61
  TABULAR_CLASSIFICATION,
61
62
  TABULAR_REGRESSION,
62
63
  TIME_TO_EVENT_PREDICTION,
@@ -309,6 +310,7 @@ class User:
309
310
  TEXT_CLASSIFICATION,
310
311
  TOKEN_CLASSIFICATION,
311
312
  SENTENCE_PAIR_CLASSIFICATION,
313
+ MULTI_LABEL_TEXT_CLASSIFICATION,
312
314
  MASKED_LANGUAGE_MODELING,
313
315
  CAUSAL_LANGUAGE_MODELING,
314
316
  SEQ2SEQ,
@@ -389,6 +391,7 @@ class User:
389
391
  TEXT_CLASSIFICATION,
390
392
  TOKEN_CLASSIFICATION,
391
393
  SENTENCE_PAIR_CLASSIFICATION,
394
+ MULTI_LABEL_TEXT_CLASSIFICATION,
392
395
  MASKED_LANGUAGE_MODELING,
393
396
  CAUSAL_LANGUAGE_MODELING,
394
397
  SEQ2SEQ,
@@ -45,7 +45,7 @@ class Framework(_StringEnum):
45
45
 
46
46
 
47
47
  class TaskCategory(_StringEnum):
48
- """The sixteen task categories the platform supports.
48
+ """The task categories the platform supports.
49
49
 
50
50
  GATED equal, as a set and in both directions, to ``data-ingestors``'
51
51
  ``tracebloc_ingestor/contracts/schema/ingest.v1.json`` category enum — the
@@ -78,6 +78,7 @@ class TaskCategory(_StringEnum):
78
78
  EMBEDDINGS = "embeddings"
79
79
  TOKEN_CLASSIFICATION = "token_classification"
80
80
  SENTENCE_PAIR_CLASSIFICATION = "sentence_pair_classification"
81
+ MULTI_LABEL_TEXT_CLASSIFICATION = "multi_label_text_classification"
81
82
 
82
83
 
83
84
  # --- Legacy string aliases (kept for backwards compatibility) -------------
@@ -105,6 +106,7 @@ SEQ2SEQ = TaskCategory.SEQ2SEQ
105
106
  EMBEDDINGS = TaskCategory.EMBEDDINGS
106
107
  TOKEN_CLASSIFICATION = TaskCategory.TOKEN_CLASSIFICATION
107
108
  SENTENCE_PAIR_CLASSIFICATION = TaskCategory.SENTENCE_PAIR_CLASSIFICATION
109
+ MULTI_LABEL_TEXT_CLASSIFICATION = TaskCategory.MULTI_LABEL_TEXT_CLASSIFICATION
108
110
 
109
111
  # Categories whose datasets carry no classes: regression targets
110
112
  # (tabular regression, time-series forecasting) and the generative /
@@ -139,9 +141,9 @@ CLASSLESS_CATEGORIES = (
139
141
  # platform called instance_segmentation a zombie in June and then decided it
140
142
  # dead, and three repos had already acted while the SDK was never told).
141
143
  #
142
- # They are off ``TaskCategory`` as of 1.2.0 so the list is sixteen and can be
143
- # gated. The module-level NAMES resolve for one more minor with a
144
- # DeprecationWarning rather than an ImportError, because
144
+ # They are off ``TaskCategory`` as of 1.2.0 so the list can be gated. The
145
+ # module-level NAMES resolve for one more minor with a DeprecationWarning
146
+ # rather than an ImportError, because
145
147
  # ``from tracebloc.utils.constants import INSTANCE_SEGMENTATION`` is public
146
148
  # API this project's SemVer covers — the same shape as the hf_token removal,
147
149
  # which was softened to a warning and shipped as a minor. They resolve to the