wisent 0.5.14__tar.gz → 0.5.15__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.

Potentially problematic release.


This version of wisent might be problematic. Click here for more details.

Files changed (336) hide show
  1. {wisent-0.5.14 → wisent-0.5.15}/PKG-INFO +3 -1
  2. {wisent-0.5.14 → wisent-0.5.15}/pyproject.toml +2 -2
  3. {wisent-0.5.14 → wisent-0.5.15}/setup.py +3 -0
  4. wisent-0.5.15/wisent/__init__.py +1 -0
  5. wisent-0.5.15/wisent/cli.py +114 -0
  6. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/activations/activations_collector.py +19 -11
  7. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/__init__.py +3 -1
  8. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/create_steering_vector.py +60 -18
  9. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/evaluate_responses.py +14 -8
  10. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/generate_pairs_from_task.py +18 -5
  11. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/get_activations.py +1 -1
  12. wisent-0.5.15/wisent/core/cli/multi_steer.py +108 -0
  13. wisent-0.5.15/wisent/core/cli/optimize_classification.py +241 -0
  14. wisent-0.5.15/wisent/core/cli/optimize_sample_size.py +78 -0
  15. wisent-0.5.15/wisent/core/cli/optimize_steering.py +665 -0
  16. wisent-0.5.15/wisent/core/cli/tasks.py +447 -0
  17. wisent-0.5.15/wisent/core/errors/error_handler.py +134 -0
  18. wisent-0.5.15/wisent/core/evaluators/benchmark_specific/log_likelihoods_evaluator.py +186 -0
  19. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/rotator.py +22 -8
  20. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/main.py +5 -1
  21. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/model_persistence.py +4 -19
  22. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/models/wisent_model.py +11 -3
  23. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser.py +4 -3
  24. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/main_parser.py +1 -1
  25. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/multi_steer_parser.py +4 -3
  26. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/optimize_steering_parser.py +4 -0
  27. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/sample_size_optimizer_v2.py +1 -1
  28. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/steering_optimizer.py +2 -2
  29. wisent-0.5.15/wisent/core/trainers/__init__.py +0 -0
  30. wisent-0.5.15/wisent/tests/__init__.py +0 -0
  31. wisent-0.5.15/wisent/tests/examples/__init__.py +0 -0
  32. wisent-0.5.15/wisent/tests/examples/cli/__init__.py +0 -0
  33. wisent-0.5.15/wisent/tests/examples/cli/activations/__init__.py +0 -0
  34. wisent-0.5.15/wisent/tests/examples/cli/activations/test_get_activations.py +127 -0
  35. wisent-0.5.15/wisent/tests/examples/cli/classifier/__init__.py +0 -0
  36. wisent-0.5.15/wisent/tests/examples/cli/classifier/test_classifier_examples.py +141 -0
  37. wisent-0.5.15/wisent/tests/examples/cli/contrastive_pairs/__init__.py +0 -0
  38. wisent-0.5.15/wisent/tests/examples/cli/contrastive_pairs/test_generate_pairs.py +89 -0
  39. wisent-0.5.15/wisent/tests/examples/cli/evaluation/__init__.py +0 -0
  40. wisent-0.5.15/wisent/tests/examples/cli/evaluation/test_evaluation_examples.py +117 -0
  41. wisent-0.5.15/wisent/tests/examples/cli/generate/__init__.py +0 -0
  42. wisent-0.5.15/wisent/tests/examples/cli/generate/test_generate_with_classifier.py +146 -0
  43. wisent-0.5.15/wisent/tests/examples/cli/generate/test_generate_with_steering.py +149 -0
  44. wisent-0.5.15/wisent/tests/examples/cli/generate/test_only_generate.py +110 -0
  45. wisent-0.5.15/wisent/tests/examples/cli/multi_steering/__init__.py +0 -0
  46. wisent-0.5.15/wisent/tests/examples/cli/multi_steering/test_multi_steer_from_trained_vectors.py +210 -0
  47. wisent-0.5.15/wisent/tests/examples/cli/multi_steering/test_multi_steer_with_different_parameters.py +205 -0
  48. wisent-0.5.15/wisent/tests/examples/cli/multi_steering/test_train_and_multi_steer.py +174 -0
  49. wisent-0.5.15/wisent/tests/examples/cli/optimizer/__init__.py +0 -0
  50. wisent-0.5.15/wisent/tests/examples/cli/optimizer/test_optimize_sample_size.py +102 -0
  51. wisent-0.5.15/wisent/tests/examples/cli/optimizer/test_optimizer_examples.py +59 -0
  52. wisent-0.5.15/wisent/tests/examples/cli/steering/__init__.py +0 -0
  53. wisent-0.5.15/wisent/tests/examples/cli/steering/test_create_steering_vectors.py +135 -0
  54. wisent-0.5.15/wisent/tests/examples/cli/synthetic/__init__.py +0 -0
  55. wisent-0.5.15/wisent/tests/examples/cli/synthetic/test_synthetic_pairs.py +45 -0
  56. {wisent-0.5.14 → wisent-0.5.15}/wisent.egg-info/PKG-INFO +3 -1
  57. {wisent-0.5.14 → wisent-0.5.15}/wisent.egg-info/SOURCES.txt +33 -3
  58. {wisent-0.5.14 → wisent-0.5.15}/wisent.egg-info/requires.txt +3 -0
  59. wisent-0.5.14/wisent/__init__.py +0 -1
  60. wisent-0.5.14/wisent/core/agent/diagnose/test_synthetic_classifier.py +0 -71
  61. wisent-0.5.14/wisent/core/cli/optimize_classification.py +0 -339
  62. wisent-0.5.14/wisent/core/cli/optimize_steering.py +0 -364
  63. wisent-0.5.14/wisent/core/cli/tasks.py +0 -182
  64. wisent-0.5.14/wisent/core/evaluators/benchmark_specific/log_likelihoods_evaluator.py +0 -329
  65. {wisent-0.5.14 → wisent-0.5.15}/LICENSE +0 -0
  66. {wisent-0.5.14 → wisent-0.5.15}/README.md +0 -0
  67. {wisent-0.5.14 → wisent-0.5.15}/setup.cfg +0 -0
  68. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/__init__.py +0 -0
  69. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/activations/__init__.py +0 -0
  70. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/activations/activations.py +0 -0
  71. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/activations/core/__init__.py +0 -0
  72. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/activations/core/atoms.py +0 -0
  73. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/activations/prompt_construction_strategy.py +0 -0
  74. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/__init__.py +0 -0
  75. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/budget.py +0 -0
  76. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/device_benchmarks.py +0 -0
  77. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/__init__.py +0 -0
  78. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/agent_classifier_decision.py +0 -0
  79. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/classifier_marketplace.py +0 -0
  80. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/create_classifier.py +0 -0
  81. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/response_diagnostics.py +0 -0
  82. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/select_classifiers.py +0 -0
  83. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/synthetic_classifier_option.py +0 -0
  84. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/tasks/__init__.py +0 -0
  85. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/tasks/task_manager.py +0 -0
  86. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/tasks/task_relevance.py +0 -0
  87. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose/tasks/task_selector.py +0 -0
  88. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/diagnose.py +0 -0
  89. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/steer.py +0 -0
  90. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/agent/timeout.py +0 -0
  91. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/autonomous_agent.py +0 -0
  92. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/benchmark_extractors.py +0 -0
  93. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/bigcode_integration.py +0 -0
  94. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/branding.py +0 -0
  95. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/generate_pairs.py +0 -0
  96. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/generate_responses.py +0 -0
  97. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/generate_vector_from_synthetic.py +0 -0
  98. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli/generate_vector_from_task.py +0 -0
  99. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/cli_logger.py +0 -0
  100. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/__init__.py +0 -0
  101. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/core/__init__.py +0 -0
  102. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/core/atoms.py +0 -0
  103. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/core/buliders.py +0 -0
  104. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/core/pair.py +0 -0
  105. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/core/response.py +0 -0
  106. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/core/serialization.py +0 -0
  107. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/core/set.py +0 -0
  108. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/diagnostics/__init__.py +0 -0
  109. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/diagnostics/activations.py +0 -0
  110. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/diagnostics/base.py +0 -0
  111. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/diagnostics/control_vectors.py +0 -0
  112. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/diagnostics/coverage.py +0 -0
  113. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/diagnostics/divergence.py +0 -0
  114. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/diagnostics/duplicates.py +0 -0
  115. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/__init__.py +0 -0
  116. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/atoms.py +0 -0
  117. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_extractor_manifest.py +0 -0
  118. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_extractor_registry.py +0 -0
  119. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/__init__.py +0 -0
  120. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/arc_challenge.py +0 -0
  121. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/arc_easy.py +0 -0
  122. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/arithmetic.py +0 -0
  123. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/asdiv.py +0 -0
  124. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/boolq.py +0 -0
  125. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/cb.py +0 -0
  126. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/copa.py +0 -0
  127. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/coqa.py +0 -0
  128. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/drop.py +0 -0
  129. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/gsm8k.py +0 -0
  130. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/headqa.py +0 -0
  131. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/hellaswag.py +0 -0
  132. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/livecodebench.py +0 -0
  133. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/logiqa.py +0 -0
  134. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/logiqa2.py +0 -0
  135. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/mc-taco.py +0 -0
  136. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/medqa.py +0 -0
  137. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/mrpc.py +0 -0
  138. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/multirc.py +0 -0
  139. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/mutual.py +0 -0
  140. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/openbookqa.py +0 -0
  141. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/pawsx.py +0 -0
  142. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/piqa.py +0 -0
  143. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/prost.py +0 -0
  144. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/pubmedqa.py +0 -0
  145. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/qa4mre.py +0 -0
  146. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/qasper.py +0 -0
  147. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/qnli.py +0 -0
  148. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/qqp.py +0 -0
  149. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/race.py +0 -0
  150. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/record.py +0 -0
  151. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/rte.py +0 -0
  152. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/sciq.py +0 -0
  153. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/social_iqa.py +0 -0
  154. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/squad2.py +0 -0
  155. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/sst2.py +0 -0
  156. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/swag.py +0 -0
  157. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/triviaqa.py +0 -0
  158. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/truthfulqa_gen.py +0 -0
  159. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/truthfulqa_mc1.py +0 -0
  160. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/truthfulqa_mc2.py +0 -0
  161. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/webqs.py +0 -0
  162. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/wic.py +0 -0
  163. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/winogrande.py +0 -0
  164. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/wnli.py +0 -0
  165. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/wsc.py +0 -0
  166. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/xnli.py +0 -0
  167. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/xstorycloze.py +0 -0
  168. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/xwinograd.py +0 -0
  169. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_pairs_generation.py +0 -0
  170. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/data_loaders/__init__.py +0 -0
  171. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/data_loaders/core/__init__.py +0 -0
  172. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/data_loaders/core/atoms.py +0 -0
  173. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/data_loaders/loaders/__init__.py +0 -0
  174. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/data_loaders/loaders/custom.py +0 -0
  175. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/data_loaders/loaders/lm_loader.py +0 -0
  176. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/data_loaders/loaders/task_interface_loader.py +0 -0
  177. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/data_loaders/rotator.py +0 -0
  178. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/detection_handling.py +0 -0
  179. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/download_full_benchmarks.py +0 -0
  180. {wisent-0.5.14/wisent/core/evaluators → wisent-0.5.15/wisent/core/errors}/__init__.py +0 -0
  181. {wisent-0.5.14/wisent/core/evaluators/benchmark_specific/coding → wisent-0.5.15/wisent/core/evaluators}/__init__.py +0 -0
  182. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/__init__.py +0 -0
  183. {wisent-0.5.14/wisent/core/evaluators/benchmark_specific/coding/metrics → wisent-0.5.15/wisent/core/evaluators/benchmark_specific/coding}/__init__.py +0 -0
  184. {wisent-0.5.14/wisent/core/evaluators/benchmark_specific/coding/metrics/core → wisent-0.5.15/wisent/core/evaluators/benchmark_specific/coding/metrics}/__init__.py +0 -0
  185. {wisent-0.5.14/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer → wisent-0.5.15/wisent/core/evaluators/benchmark_specific/coding/metrics/core}/__init__.py +0 -0
  186. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/metrics/core/atoms.py +0 -0
  187. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/metrics/evaluator.py +0 -0
  188. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/metrics/passk.py +0 -0
  189. {wisent-0.5.14/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer/core → wisent-0.5.15/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer}/__init__.py +0 -0
  190. {wisent-0.5.14/wisent/core/evaluators/benchmark_specific/coding/providers → wisent-0.5.15/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer}/core/__init__.py +0 -0
  191. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer/core/atoms.py +0 -0
  192. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer/cpp_sanitizer.py +0 -0
  193. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer/java_sanitizer.py +0 -0
  194. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer/python_sanitizer.py +0 -0
  195. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/output_sanitizer/utils.py +0 -0
  196. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/providers/__init__.py +0 -0
  197. {wisent-0.5.14/wisent/core/evaluators/benchmark_specific/coding/safe_docker → wisent-0.5.15/wisent/core/evaluators/benchmark_specific/coding/providers/core}/__init__.py +0 -0
  198. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/providers/core/atoms.py +0 -0
  199. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/providers/livecodebench/__init__.py +0 -0
  200. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/providers/livecodebench/provider.py +0 -0
  201. {wisent-0.5.14/wisent/core/evaluators/benchmark_specific/coding/safe_docker/core → wisent-0.5.15/wisent/core/evaluators/benchmark_specific/coding/safe_docker}/__init__.py +0 -0
  202. {wisent-0.5.14/wisent/core/evaluators/oracles → wisent-0.5.15/wisent/core/evaluators/benchmark_specific/coding/safe_docker/core}/__init__.py +0 -0
  203. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/safe_docker/core/atoms.py +0 -0
  204. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/safe_docker/core/runtime.py +0 -0
  205. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/safe_docker/entrypoint.py +0 -0
  206. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/safe_docker/recipes.py +0 -0
  207. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/coding/solution_generator.py +0 -0
  208. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/exact_match_evaluator.py +0 -0
  209. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/f1_evaluator.py +0 -0
  210. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/generation_evaluator.py +0 -0
  211. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/perplexity_evaluator.py +0 -0
  212. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/benchmark_specific/personalization_evaluator.py +0 -0
  213. {wisent-0.5.14/wisent/core/models → wisent-0.5.15/wisent/core/evaluators/oracles}/__init__.py +0 -0
  214. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/oracles/interactive.py +0 -0
  215. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/oracles/nlp_evaluator.py +0 -0
  216. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/evaluators/oracles/user_specified.py +0 -0
  217. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/hyperparameter_optimizer.py +0 -0
  218. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/lm_eval_harness_ground_truth.py +0 -0
  219. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/managed_cached_benchmarks.py +0 -0
  220. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/mixed_benchmark_sampler.py +0 -0
  221. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/model_config_manager.py +0 -0
  222. {wisent-0.5.14/wisent/core/models/core → wisent-0.5.15/wisent/core/models}/__init__.py +0 -0
  223. {wisent-0.5.14/wisent/core/opti → wisent-0.5.15/wisent/core/models/core}/__init__.py +0 -0
  224. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/models/core/atoms.py +0 -0
  225. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/multi_steering.py +0 -0
  226. {wisent-0.5.14/wisent/core/opti/core → wisent-0.5.15/wisent/core/opti}/__init__.py +0 -0
  227. {wisent-0.5.14/wisent/core/opti/methods → wisent-0.5.15/wisent/core/opti/core}/__init__.py +0 -0
  228. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/opti/core/atoms.py +0 -0
  229. {wisent-0.5.14/wisent/core/optuna/steering → wisent-0.5.15/wisent/core/opti/methods}/__init__.py +0 -0
  230. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/opti/methods/opti_classificator.py +0 -0
  231. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/opti/methods/opti_steering.py +0 -0
  232. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/__init__.py +0 -0
  233. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/classifier/__init__.py +0 -0
  234. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/classifier/activation_generator.py +0 -0
  235. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/classifier/classifier_cache.py +0 -0
  236. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/classifier/optuna_classifier_optimizer.py +0 -0
  237. {wisent-0.5.14/wisent/core/prompts → wisent-0.5.15/wisent/core/optuna/steering}/__init__.py +0 -0
  238. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/steering/bigcode_evaluator_wrapper.py +0 -0
  239. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/steering/data_utils.py +0 -0
  240. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/steering/metrics.py +0 -0
  241. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/steering/optuna_pipeline.py +0 -0
  242. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/optuna/steering/steering_optimization.py +0 -0
  243. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/__init__.py +0 -0
  244. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/agent_parser.py +0 -0
  245. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/configure_model_parser.py +0 -0
  246. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/create_steering_vector_parser.py +0 -0
  247. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/evaluate_parser.py +0 -0
  248. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/evaluate_responses_parser.py +0 -0
  249. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/full_optimize_parser.py +0 -0
  250. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/generate_pairs_from_task_parser.py +0 -0
  251. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/generate_pairs_parser.py +0 -0
  252. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/generate_responses_parser.py +0 -0
  253. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/generate_vector_from_synthetic_parser.py +0 -0
  254. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/generate_vector_from_task_parser.py +0 -0
  255. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/generate_vector_parser.py +0 -0
  256. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/get_activations_parser.py +0 -0
  257. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/model_config_parser.py +0 -0
  258. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/monitor_parser.py +0 -0
  259. /wisent-0.5.14/wisent/core/parser_arguments/test_nonsense_parser.py → /wisent-0.5.15/wisent/core/parser_arguments/nonsense_parser.py +0 -0
  260. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/optimize_classification_parser.py +0 -0
  261. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/optimize_sample_size_parser.py +0 -0
  262. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/synthetic_parser.py +0 -0
  263. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/tasks_parser.py +0 -0
  264. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/parser_arguments/utils.py +0 -0
  265. {wisent-0.5.14/wisent/core/prompts/core → wisent-0.5.15/wisent/core/prompts}/__init__.py +0 -0
  266. {wisent-0.5.14/wisent/core/prompts/prompt_stratiegies → wisent-0.5.15/wisent/core/prompts/core}/__init__.py +0 -0
  267. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/prompts/core/atom.py +0 -0
  268. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/prompts/core/prompt_formater.py +0 -0
  269. {wisent-0.5.14/wisent/core/steering_methods → wisent-0.5.15/wisent/core/prompts/prompt_stratiegies}/__init__.py +0 -0
  270. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/prompts/prompt_stratiegies/direct_completion.py +0 -0
  271. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/prompts/prompt_stratiegies/instruction_following.py +0 -0
  272. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/prompts/prompt_stratiegies/multiple_choice.py +0 -0
  273. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/prompts/prompt_stratiegies/role_playing.py +0 -0
  274. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/representation.py +0 -0
  275. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/sample_size_optimizer.py +0 -0
  276. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/save_results.py +0 -0
  277. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/steering.py +0 -0
  278. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/steering_method.py +0 -0
  279. {wisent-0.5.14/wisent/core/steering_methods/core → wisent-0.5.15/wisent/core/steering_methods}/__init__.py +0 -0
  280. {wisent-0.5.14/wisent/core/steering_methods/methods → wisent-0.5.15/wisent/core/steering_methods/core}/__init__.py +0 -0
  281. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/steering_methods/core/atoms.py +0 -0
  282. {wisent-0.5.14/wisent/core/synthetic → wisent-0.5.15/wisent/core/steering_methods/methods}/__init__.py +0 -0
  283. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/steering_methods/methods/caa.py +0 -0
  284. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/steering_methods/rotator.py +0 -0
  285. {wisent-0.5.14/wisent/core/synthetic/cleaners → wisent-0.5.15/wisent/core/synthetic}/__init__.py +0 -0
  286. {wisent-0.5.14/wisent/core/synthetic/cleaners/core → wisent-0.5.15/wisent/core/synthetic/cleaners}/__init__.py +0 -0
  287. {wisent-0.5.14/wisent/core/synthetic/cleaners/methods → wisent-0.5.15/wisent/core/synthetic/cleaners/core}/__init__.py +0 -0
  288. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/cleaners/core/atoms.py +0 -0
  289. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/cleaners/deduper_cleaner.py +0 -0
  290. {wisent-0.5.14/wisent/core/synthetic/cleaners/methods/core → wisent-0.5.15/wisent/core/synthetic/cleaners/methods}/__init__.py +0 -0
  291. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/cleaners/methods/base_dedupers.py +0 -0
  292. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/cleaners/methods/base_refusalers.py +0 -0
  293. {wisent-0.5.14/wisent/core/synthetic/db_instructions → wisent-0.5.15/wisent/core/synthetic/cleaners/methods/core}/__init__.py +0 -0
  294. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/cleaners/methods/core/atoms.py +0 -0
  295. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/cleaners/pairs_cleaner.py +0 -0
  296. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/cleaners/refusaler_cleaner.py +0 -0
  297. {wisent-0.5.14/wisent/core/synthetic/db_instructions/core → wisent-0.5.15/wisent/core/synthetic/db_instructions}/__init__.py +0 -0
  298. {wisent-0.5.14/wisent/core/synthetic/generators → wisent-0.5.15/wisent/core/synthetic/db_instructions/core}/__init__.py +0 -0
  299. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/db_instructions/core/atoms.py +0 -0
  300. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/db_instructions/mini_dp.py +0 -0
  301. {wisent-0.5.14/wisent/core/synthetic/generators/core → wisent-0.5.15/wisent/core/synthetic/generators}/__init__.py +0 -0
  302. {wisent-0.5.14/wisent/core/synthetic/generators/diversities → wisent-0.5.15/wisent/core/synthetic/generators/core}/__init__.py +0 -0
  303. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/generators/core/atoms.py +0 -0
  304. {wisent-0.5.14/wisent/core/synthetic/generators/diversities/core → wisent-0.5.15/wisent/core/synthetic/generators/diversities}/__init__.py +0 -0
  305. {wisent-0.5.14/wisent/core/synthetic/generators/diversities/methods → wisent-0.5.15/wisent/core/synthetic/generators/diversities/core}/__init__.py +0 -0
  306. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/generators/diversities/core/core.py +0 -0
  307. {wisent-0.5.14/wisent/core/trainers → wisent-0.5.15/wisent/core/synthetic/generators/diversities/methods}/__init__.py +0 -0
  308. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/generators/diversities/methods/fast_diversity.py +0 -0
  309. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/synthetic/generators/pairs_generator.py +0 -0
  310. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/task_interface.py +0 -0
  311. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/task_selector.py +0 -0
  312. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/__init__.py +0 -0
  313. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/aime_task.py +0 -0
  314. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/file_task.py +0 -0
  315. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/hle_task.py +0 -0
  316. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/hmmt_task.py +0 -0
  317. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/livecodebench_task.py +0 -0
  318. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/livemathbench_task.py +0 -0
  319. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/lm_eval_task.py +0 -0
  320. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/math500_task.py +0 -0
  321. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/polymath_task.py +0 -0
  322. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tasks/supergpqa_task.py +0 -0
  323. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/time_estimator.py +0 -0
  324. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/timing_calibration.py +0 -0
  325. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tracking/__init__.py +0 -0
  326. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tracking/latency.py +0 -0
  327. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/tracking/memory.py +0 -0
  328. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/trainers/core/__init__.py +0 -0
  329. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/trainers/core/atoms.py +0 -0
  330. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/trainers/steering_trainer.py +0 -0
  331. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/user_model_config.py +0 -0
  332. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/utils/__init__.py +0 -0
  333. {wisent-0.5.14 → wisent-0.5.15}/wisent/core/utils/device.py +0 -0
  334. {wisent-0.5.14 → wisent-0.5.15}/wisent.egg-info/dependency_links.txt +0 -0
  335. {wisent-0.5.14 → wisent-0.5.15}/wisent.egg-info/entry_points.txt +0 -0
  336. {wisent-0.5.14 → wisent-0.5.15}/wisent.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wisent
3
- Version: 0.5.14
3
+ Version: 0.5.15
4
4
  Summary: Monitor and guard against harmful content in language models
5
5
  Home-page: https://github.com/yourusername/wisent-activation-guardrails
6
6
  Author: Wisent Team
@@ -26,6 +26,8 @@ Requires-Dist: sentence-transformers>=2.0.0
26
26
  Requires-Dist: faiss-cpu>=1.7.0
27
27
  Provides-Extra: harness
28
28
  Requires-Dist: lm-eval==0.4.8; extra == "harness"
29
+ Provides-Extra: cuda
30
+ Requires-Dist: flash-attn>=2.5.0; extra == "cuda"
29
31
  Dynamic: author
30
32
  Dynamic: author-email
31
33
  Dynamic: classifier
@@ -1,9 +1,9 @@
1
1
  [tool.pytest.ini_options]
2
- testpaths = ["tests"]
2
+ testpaths = ["wisent/tests"]
3
3
  python_files = ["test_*.py"]
4
4
  python_classes = ["Test*"]
5
5
  python_functions = ["test_*"]
6
- addopts = ["-v", "--tb=short", "--ignore=evaluation", "-m", "not slow and not heavy and not docker and not bigcode_required"]
6
+ addopts = ["-v", "--tb=short"]
7
7
  markers = [
8
8
  "slow: marks tests as slow (deselect with '-m \"not slow\"')",
9
9
  "heavy: marks tests as very resource-intensive with large model downloads (deselect with '-m \"not heavy\"')",
@@ -46,6 +46,9 @@ setup(
46
46
  "harness": [
47
47
  "lm-eval==0.4.8",
48
48
  ],
49
+ "cuda": [
50
+ "flash-attn>=2.5.0",
51
+ ],
49
52
  },
50
53
  entry_points={
51
54
  "console_scripts": [
@@ -0,0 +1 @@
1
+ __version__ = "0.5.15"
@@ -0,0 +1,114 @@
1
+ """
2
+ Programmatic API for running Wisent tasks.
3
+
4
+ This module provides a Python API for running tasks that would normally be invoked via CLI.
5
+ """
6
+
7
+ import argparse
8
+ from typing import Dict, Any, Optional
9
+ from wisent.core.cli.tasks import execute_tasks
10
+
11
+
12
+ def run_task_pipeline(
13
+ task_name: str,
14
+ model_name: str,
15
+ layer: str,
16
+ training_limit: int,
17
+ testing_limit: int,
18
+ seed: int = 42,
19
+ verbose: bool = False,
20
+ split_ratio: float = 0.8,
21
+ limit: Optional[int] = None,
22
+ steering_mode: bool = False,
23
+ token_aggregation: str = "average",
24
+ detection_threshold: float = 0.5,
25
+ classifier_type: str = "logistic",
26
+ steering_method: str = "CAA",
27
+ steering_strength: float = 1.0,
28
+ token_targeting_strategy: str = "LAST_TOKEN",
29
+ **kwargs
30
+ ) -> Dict[str, Any]:
31
+ """
32
+ Run a task pipeline programmatically.
33
+
34
+ This function provides a programmatic interface to the tasks command,
35
+ allowing other modules to run tasks without invoking the CLI.
36
+
37
+ Args:
38
+ task_name: Name of the task to run
39
+ model_name: Name or path of the model
40
+ layer: Layer to use for activations
41
+ training_limit: Number of training samples
42
+ testing_limit: Number of testing samples
43
+ seed: Random seed for reproducibility
44
+ verbose: Whether to print verbose output
45
+ split_ratio: Train/test split ratio
46
+ limit: Total limit of samples to load
47
+ steering_mode: Whether to use steering mode
48
+ token_aggregation: Token aggregation strategy
49
+ detection_threshold: Detection threshold for classification
50
+ classifier_type: Type of classifier to use
51
+ steering_method: Steering method to use (if steering_mode=True)
52
+ steering_strength: Steering strength (if steering_mode=True)
53
+ token_targeting_strategy: Token targeting strategy for steering
54
+ **kwargs: Additional arguments
55
+
56
+ Returns:
57
+ Dictionary containing results including:
58
+ - test_accuracy: Test accuracy
59
+ - test_f1_score: Test F1 score
60
+ - training_time: Time spent training
61
+ - evaluation_results: Evaluation results dict
62
+ """
63
+ # Create a namespace object that mimics argparse output
64
+ args = argparse.Namespace()
65
+
66
+ # Set required arguments
67
+ # task_name is already a string, keep it as a list
68
+ args.task_names = [task_name] if isinstance(task_name, str) else task_name
69
+ args.model = model_name
70
+ args.layer = int(layer) if isinstance(layer, str) else layer
71
+ args.training_limit = training_limit
72
+ args.testing_limit = testing_limit
73
+ args.seed = seed
74
+ args.verbose = verbose
75
+ args.split_ratio = split_ratio
76
+ args.limit = limit if limit is not None else (training_limit + testing_limit + 100)
77
+
78
+ # Set method-specific arguments
79
+ if steering_mode:
80
+ args.steering_mode = True
81
+ args.steering_method = steering_method
82
+ args.steering_strength = steering_strength
83
+ args.token_targeting_strategy = token_targeting_strategy
84
+ args.token_aggregation = token_aggregation
85
+ else:
86
+ args.steering_mode = False
87
+ args.token_aggregation = token_aggregation
88
+ args.detection_threshold = detection_threshold
89
+ args.classifier_type = classifier_type
90
+
91
+ # Set defaults for other arguments
92
+ args.train_only = False
93
+ args.inference_only = False
94
+ args.save_classifier = None
95
+ args.load_classifier = None
96
+ args.save_steering_vector = None
97
+ args.load_steering_vector = None
98
+ args.output = None
99
+ args.evaluation_report = None
100
+ args.device = kwargs.get('device', 'cpu')
101
+
102
+ # Execute the task and capture results
103
+ results = execute_tasks(args)
104
+
105
+ # If execute_tasks returns None (shouldn't happen with our changes, but handle it)
106
+ if results is None:
107
+ return {
108
+ "test_accuracy": 0.0,
109
+ "test_f1_score": 0.0,
110
+ "training_time": 0.0,
111
+ "evaluation_results": {}
112
+ }
113
+
114
+ return results
@@ -230,17 +230,25 @@ class ActivationCollector:
230
230
  # Use model's built-in chat template
231
231
  if not hasattr(tokenizer, "apply_chat_template"):
232
232
  raise RuntimeError("Tokenizer has no apply_chat_template; set it up or use a different strategy.")
233
- prompt_text = tokenizer.apply_chat_template(
234
- [{"role": "user", "content": prompt}],
235
- tokenize=False,
236
- add_generation_prompt=True,
237
- )
238
- full_text = tokenizer.apply_chat_template(
239
- [{"role": "user", "content": prompt},
240
- {"role": "assistant", "content": response}],
241
- tokenize=False,
242
- add_generation_prompt=False,
243
- )
233
+ try:
234
+ prompt_text = tokenizer.apply_chat_template(
235
+ [{"role": "user", "content": prompt}],
236
+ tokenize=False,
237
+ add_generation_prompt=True,
238
+ )
239
+ full_text = tokenizer.apply_chat_template(
240
+ [{"role": "user", "content": prompt},
241
+ {"role": "assistant", "content": response}],
242
+ tokenize=False,
243
+ add_generation_prompt=False,
244
+ )
245
+ except ValueError as e:
246
+ if "chat_template is not set" in str(e):
247
+ # Fallback to direct completion for models without chat templates
248
+ prompt_text = prompt
249
+ full_text = f"{prompt} {response}"
250
+ else:
251
+ raise
244
252
 
245
253
  elif strategy == PromptConstructionStrategy.DIRECT_COMPLETION:
246
254
  # Q → good_resp/bad_resp (direct answer)
@@ -9,7 +9,9 @@ from .generate_vector_from_task import execute_generate_vector_from_task
9
9
  from .generate_vector_from_synthetic import execute_generate_vector_from_synthetic
10
10
  from .optimize_classification import execute_optimize_classification
11
11
  from .optimize_steering import execute_optimize_steering
12
+ from .optimize_sample_size import execute_optimize_sample_size
12
13
  from .generate_responses import execute_generate_responses
13
14
  from .evaluate_responses import execute_evaluate_responses
15
+ from .multi_steer import execute_multi_steer
14
16
 
15
- __all__ = ['execute_tasks', 'execute_generate_pairs_from_task', 'execute_generate_pairs', 'execute_get_activations', 'execute_create_steering_vector', 'execute_generate_vector_from_task', 'execute_generate_vector_from_synthetic', 'execute_optimize_classification', 'execute_optimize_steering', 'execute_generate_responses', 'execute_evaluate_responses']
17
+ __all__ = ['execute_tasks', 'execute_generate_pairs_from_task', 'execute_generate_pairs', 'execute_get_activations', 'execute_create_steering_vector', 'execute_generate_vector_from_task', 'execute_generate_vector_from_synthetic', 'execute_optimize_classification', 'execute_optimize_steering', 'execute_optimize_sample_size', 'execute_generate_responses', 'execute_evaluate_responses', 'execute_multi_steer']
@@ -94,28 +94,70 @@ def execute_create_steering_vector(args):
94
94
 
95
95
  print(f" ✓ Generated {len(steering_vectors)} steering vectors")
96
96
 
97
- # 5. Save steering vectors to JSON
97
+ # 5. Save steering vectors (format depends on file extension)
98
98
  print(f"\n💾 Saving steering vectors to '{args.output}'...")
99
- output_data = {
100
- 'trait_label': trait_label,
101
- 'model': model,
102
- 'method': args.method,
103
- 'normalize': args.normalize,
104
- 'token_aggregation': token_aggregation,
105
- 'num_pairs': len(pairs_list),
106
- 'layers': list(steering_vectors.keys()),
107
- 'steering_vectors': steering_vectors,
108
- 'metadata': {
109
- 'source_file': args.enriched_pairs_file,
110
- 'creation_time': time.strftime('%Y-%m-%d %H:%M:%S'),
99
+ os.makedirs(os.path.dirname(os.path.abspath(args.output)) or '.', exist_ok=True)
100
+
101
+ if args.output.endswith('.pt'):
102
+ # For .pt format: save single-layer vectors for multi-steer compatibility
103
+ # If multiple layers, save the first one (or could save all and let user specify)
104
+ if len(steering_vectors) == 1:
105
+ layer_str = list(steering_vectors.keys())[0]
106
+ vector_tensor = torch.tensor(steering_vectors[layer_str], dtype=torch.float32)
107
+ torch.save({
108
+ 'steering_vector': vector_tensor,
109
+ 'layer_index': int(layer_str),
110
+ 'trait_label': trait_label,
111
+ 'model': model,
112
+ 'method': args.method,
113
+ 'normalize': args.normalize,
114
+ 'token_aggregation': token_aggregation,
115
+ 'num_pairs': len(pairs_list),
116
+ # Legacy keys for backward compatibility
117
+ 'vector': vector_tensor,
118
+ 'layer': int(layer_str),
119
+ }, args.output)
120
+ print(f" ✓ Saved steering vector (layer {layer_str}) to: {args.output}")
121
+ else:
122
+ # Save multiple layers - save each to separate file
123
+ for layer_str in steering_vectors.keys():
124
+ layer_output = args.output.replace('.pt', f'_layer_{layer_str}.pt')
125
+ vector_tensor = torch.tensor(steering_vectors[layer_str], dtype=torch.float32)
126
+ torch.save({
127
+ 'steering_vector': vector_tensor,
128
+ 'layer_index': int(layer_str),
129
+ 'trait_label': trait_label,
130
+ 'model': model,
131
+ 'method': args.method,
132
+ 'normalize': args.normalize,
133
+ 'token_aggregation': token_aggregation,
134
+ 'num_pairs': len(pairs_list),
135
+ # Legacy keys
136
+ 'vector': vector_tensor,
137
+ 'layer': int(layer_str),
138
+ }, layer_output)
139
+ print(f" ✓ Saved steering vector (layer {layer_str}) to: {layer_output}")
140
+ else:
141
+ # JSON format: save all layers together
142
+ output_data = {
143
+ 'trait_label': trait_label,
144
+ 'model': model,
145
+ 'method': args.method,
146
+ 'normalize': args.normalize,
147
+ 'token_aggregation': token_aggregation,
148
+ 'num_pairs': len(pairs_list),
149
+ 'layers': list(steering_vectors.keys()),
150
+ 'steering_vectors': steering_vectors,
151
+ 'metadata': {
152
+ 'source_file': args.enriched_pairs_file,
153
+ 'creation_time': time.strftime('%Y-%m-%d %H:%M:%S'),
154
+ }
111
155
  }
112
- }
113
156
 
114
- os.makedirs(os.path.dirname(os.path.abspath(args.output)), exist_ok=True)
115
- with open(args.output, 'w') as f:
116
- json.dump(output_data, f, indent=2)
157
+ with open(args.output, 'w') as f:
158
+ json.dump(output_data, f, indent=2)
117
159
 
118
- print(f" ✓ Saved steering vectors to: {args.output}")
160
+ print(f" ✓ Saved steering vectors to: {args.output}")
119
161
 
120
162
  # 6. Display statistics
121
163
  print(f"\n📈 Steering Vector Statistics:")
@@ -33,8 +33,14 @@ def execute_evaluate_responses(args):
33
33
  with open(args.input, 'r') as f:
34
34
  input_data = json.load(f)
35
35
 
36
- responses = input_data.get('responses', [])
37
- task_name = args.task if args.task else input_data.get('task')
36
+ # Handle both dict format (with 'responses' key) and direct list format
37
+ if isinstance(input_data, list):
38
+ responses = input_data
39
+ task_name = args.task if args.task else "generic" # Default to generic for list format
40
+ else:
41
+ responses = input_data.get('responses', [])
42
+ task_name = args.task if args.task else input_data.get('task', "generic")
43
+
38
44
  if not task_name:
39
45
  print(f" ❌ Task name not found in input file and not provided via --task")
40
46
  sys.exit(1)
@@ -299,8 +305,8 @@ def execute_evaluate_responses(args):
299
305
 
300
306
  output_data = {
301
307
  "input_file": args.input,
302
- "task": input_data.get('task'),
303
- "model": input_data.get('model'),
308
+ "task": task_name if isinstance(input_data, list) else input_data.get('task'),
309
+ "model": None if isinstance(input_data, list) else input_data.get('model'),
304
310
  "evaluation_type": evaluation_type,
305
311
  "evaluator_used": "CodingEvaluator",
306
312
  "aggregated_metrics": aggregated_metrics,
@@ -454,8 +460,8 @@ def execute_evaluate_responses(args):
454
460
 
455
461
  output_data = {
456
462
  "input_file": args.input,
457
- "task": input_data.get('task'),
458
- "model": input_data.get('model'),
463
+ "task": task_name if isinstance(input_data, list) else input_data.get('task'),
464
+ "model": None if isinstance(input_data, list) else input_data.get('model'),
459
465
  "evaluation_type": evaluation_type,
460
466
  "evaluator_used": "PersonalizationEvaluator",
461
467
  "judge_model": judge_model,
@@ -683,8 +689,8 @@ def execute_evaluate_responses(args):
683
689
 
684
690
  output_data = {
685
691
  "input_file": args.input,
686
- "task": input_data.get('task'),
687
- "model": input_data.get('model'),
692
+ "task": task_name if isinstance(input_data, list) else input_data.get('task'),
693
+ "model": None if isinstance(input_data, list) else input_data.get('model'),
688
694
  "evaluation_type": evaluation_type,
689
695
  "evaluator_used": evaluator.name,
690
696
  "aggregated_metrics": aggregated_metrics,
@@ -23,7 +23,7 @@ def _build_pairs_from_custom_task(task, limit: int | None):
23
23
  LiveCodeBenchExtractor as LiveCodeBenchPairExtractor
24
24
  )
25
25
 
26
- task_name = task.get_name()
26
+ task_name = task.task_name
27
27
 
28
28
  if task_name == "livecodebench":
29
29
  # Use the contrastive pair extractor for LiveCodeBench
@@ -61,10 +61,11 @@ def execute_generate_pairs_from_task(args):
61
61
  from wisent.core.contrastive_pairs.lm_eval_pairs.lm_task_pairs_generation import (
62
62
  lm_build_contrastive_pairs,
63
63
  )
64
+ from wisent.core.task_interface import TaskInterface
64
65
 
65
- # Handle both lm-eval tasks (dict) and custom tasks (TaskInterface)
66
+ # Handle both lm-eval tasks (dict or ConfigurableTask) and custom tasks (TaskInterface)
66
67
  if isinstance(task_obj, dict):
67
- # lm-eval task
68
+ # lm-eval task group with subtasks
68
69
  if len(task_obj) != 1:
69
70
  keys = ", ".join(sorted(task_obj.keys()))
70
71
  raise ValueError(
@@ -81,14 +82,26 @@ def execute_generate_pairs_from_task(args):
81
82
  lm_eval_task=task,
82
83
  limit=args.limit,
83
84
  )
84
- else:
85
- # Custom task (TaskInterface)
85
+ elif isinstance(task_obj, TaskInterface):
86
+ # Custom task (TaskInterface) - only livecodebench for now
86
87
  task = task_obj
87
88
  pairs_task_name = args.task_name
88
89
 
89
90
  # 2. Generate contrastive pairs using custom task interface
90
91
  print(f" 🔨 Building contrastive pairs...")
91
92
  pairs = _build_pairs_from_custom_task(task, args.limit)
93
+ else:
94
+ # Single lm-eval task (ConfigurableTask), not wrapped in dict
95
+ task = task_obj
96
+ pairs_task_name = args.task_name
97
+
98
+ # 2. Generate contrastive pairs using lm-eval interface
99
+ print(f" 🔨 Building contrastive pairs...")
100
+ pairs = lm_build_contrastive_pairs(
101
+ task_name=pairs_task_name,
102
+ lm_eval_task=task,
103
+ limit=args.limit,
104
+ )
92
105
 
93
106
  print(f" ✓ Generated {len(pairs)} contrastive pairs")
94
107
 
@@ -42,7 +42,7 @@ def execute_get_activations(args):
42
42
  trait_label = 'unknown'
43
43
 
44
44
  # Apply limit if specified
45
- if args.limit:
45
+ if hasattr(args, 'limit') and args.limit:
46
46
  pairs_list = pairs_list[:args.limit]
47
47
 
48
48
  print(f" ✓ Loaded {len(pairs_list)} pairs")
@@ -0,0 +1,108 @@
1
+ """Multi-steer command execution logic."""
2
+
3
+ import sys
4
+ import os
5
+ import torch
6
+
7
+
8
+ def execute_multi_steer(args):
9
+ """Execute the multi-steer command - combine multiple steering vectors and apply to generation."""
10
+ from wisent.core.multi_steering import MultiSteering, MultiSteeringError
11
+ from wisent.core.models.wisent_model import WisentModel
12
+
13
+ try:
14
+ # Check if no vectors provided - unsteered baseline mode
15
+ if not args.vector or len(args.vector) == 0:
16
+ print(f"\n🎯 Unsteered Baseline Generation Mode")
17
+ print(f" Model: {args.model}")
18
+ print(f" No steering vectors provided - generating baseline response")
19
+
20
+ # If prompt is provided, generate unsteered response
21
+ if hasattr(args, 'prompt') and args.prompt:
22
+ print(f"\n🤖 Loading model '{args.model}'...")
23
+ model = WisentModel(args.model, device=args.device)
24
+
25
+ # Generate WITHOUT steering
26
+ response = model.generate(
27
+ [[{"role": "user", "content": args.prompt}]],
28
+ max_new_tokens=args.max_new_tokens,
29
+ do_sample=True,
30
+ temperature=getattr(args, 'temperature', 0.7),
31
+ top_p=getattr(args, 'top_p', 0.9)
32
+ )[0]
33
+
34
+ print(f"\nUnsteered baseline output:\n{response}\n")
35
+ else:
36
+ print(f"\n⚠️ No prompt provided. Use --prompt to generate output.")
37
+
38
+ print(f"\n✅ Baseline generation completed successfully!\n")
39
+ return
40
+
41
+ print(f"\n🎯 Multi-Steering Mode")
42
+ print(f" Model: {args.model}")
43
+ print(f" Layer: {args.layer}")
44
+ print(f" Method: {args.method}")
45
+
46
+ # Initialize multi-steering
47
+ multi_steer = MultiSteering(device=args.device, method=args.method)
48
+
49
+ # Load and combine vectors
50
+ multi_steer.load_vectors(args.vector)
51
+
52
+ # Override layer if specified in args
53
+ if hasattr(args, 'layer') and args.layer:
54
+ multi_steer.layer = int(args.layer)
55
+
56
+ # Combine vectors
57
+ normalize = getattr(args, 'normalize_weights', True)
58
+ multi_steer.combine_vectors(normalize=normalize)
59
+
60
+ # Save combined vector if requested
61
+ if hasattr(args, 'save_combined') and args.save_combined:
62
+ print(f"\n💾 Saving combined vector to '{args.save_combined}'...")
63
+ os.makedirs(os.path.dirname(args.save_combined) or '.', exist_ok=True)
64
+ torch.save({
65
+ 'steering_vector': multi_steer.combined_vector,
66
+ 'layer_index': multi_steer.layer,
67
+ 'method': args.method,
68
+ 'model': args.model,
69
+ 'weights': multi_steer.weights,
70
+ 'num_vectors': len(multi_steer.loaded_vectors),
71
+ # Legacy keys for backward compatibility
72
+ 'vector': multi_steer.combined_vector,
73
+ 'layer': multi_steer.layer,
74
+ }, args.save_combined)
75
+ print(f" ✓ Combined vector saved to: {args.save_combined}")
76
+
77
+ # If prompt is provided, apply steering and generate
78
+ if hasattr(args, 'prompt') and args.prompt:
79
+ print(f"\n🤖 Loading model '{args.model}'...")
80
+ model = WisentModel(args.model, device=args.device)
81
+
82
+ # Generate with steering
83
+ temperature = getattr(args, 'temperature', 0.7)
84
+ top_p = getattr(args, 'top_p', 0.9)
85
+ output = multi_steer.apply_steering(
86
+ model=model,
87
+ prompt=args.prompt,
88
+ max_new_tokens=args.max_new_tokens,
89
+ temperature=temperature,
90
+ top_p=top_p
91
+ )
92
+
93
+ print(f"\nGenerated output:\n{output}\n")
94
+
95
+ print(f"\n✅ Multi-steering completed successfully!\n")
96
+
97
+ except MultiSteeringError as e:
98
+ print(f"\n❌ Multi-steering error: {str(e)}", file=sys.stderr)
99
+ if args.verbose:
100
+ import traceback
101
+ traceback.print_exc()
102
+ sys.exit(1)
103
+ except Exception as e:
104
+ print(f"\n❌ Error: {str(e)}", file=sys.stderr)
105
+ if args.verbose:
106
+ import traceback
107
+ traceback.print_exc()
108
+ sys.exit(1)