wisent 0.5.6__tar.gz → 0.5.7__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 (228) hide show
  1. {wisent-0.5.6 → wisent-0.5.7}/PKG-INFO +1 -1
  2. wisent-0.5.7/wisent/__init__.py +1 -0
  3. wisent-0.5.7/wisent/core/multi_steering.py +348 -0
  4. {wisent-0.5.6 → wisent-0.5.7}/wisent.egg-info/PKG-INFO +1 -1
  5. wisent-0.5.6/wisent/__init__.py +0 -1
  6. wisent-0.5.6/wisent/core/multi_steering.py +0 -352
  7. {wisent-0.5.6 → wisent-0.5.7}/LICENSE +0 -0
  8. {wisent-0.5.6 → wisent-0.5.7}/README.md +0 -0
  9. {wisent-0.5.6 → wisent-0.5.7}/pyproject.toml +0 -0
  10. {wisent-0.5.6 → wisent-0.5.7}/setup.cfg +0 -0
  11. {wisent-0.5.6 → wisent-0.5.7}/setup.py +0 -0
  12. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/__init__.py +0 -0
  13. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/__init__.py +0 -0
  14. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/__init__.py +0 -0
  15. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/core/__init__.py +0 -0
  16. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/core/atoms.py +0 -0
  17. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/evaluator.py +0 -0
  18. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/passk.py +0 -0
  19. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/__init__.py +0 -0
  20. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/core/__init__.py +0 -0
  21. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/core/atoms.py +0 -0
  22. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/cpp_sanitizer.py +0 -0
  23. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/java_sanitizer.py +0 -0
  24. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/python_sanitizer.py +0 -0
  25. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/utils.py +0 -0
  26. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/providers/__init__.py +0 -0
  27. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/providers/core/__init__.py +0 -0
  28. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/providers/core/atoms.py +0 -0
  29. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/providers/livecodebench/__init__.py +0 -0
  30. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/providers/livecodebench/provider.py +0 -0
  31. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/__init__.py +0 -0
  32. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/core/__init__.py +0 -0
  33. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/core/atoms.py +0 -0
  34. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/core/runtime.py +0 -0
  35. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/entrypoint.py +0 -0
  36. {wisent-0.5.6 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/recipes.py +0 -0
  37. {wisent-0.5.6 → wisent-0.5.7}/wisent/classifiers/__init__.py +0 -0
  38. {wisent-0.5.6 → wisent-0.5.7}/wisent/classifiers/core/__init__.py +0 -0
  39. {wisent-0.5.6 → wisent-0.5.7}/wisent/classifiers/core/atoms.py +0 -0
  40. {wisent-0.5.6 → wisent-0.5.7}/wisent/classifiers/models/__init__.py +0 -0
  41. {wisent-0.5.6 → wisent-0.5.7}/wisent/classifiers/models/logistic.py +0 -0
  42. {wisent-0.5.6 → wisent-0.5.7}/wisent/classifiers/models/mlp.py +0 -0
  43. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/__init__.py +0 -0
  44. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/classifiers/__init__.py +0 -0
  45. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/classifiers/classifier_rotator.py +0 -0
  46. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/cli_logger.py +0 -0
  47. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/data_loaders/__init__.py +0 -0
  48. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/data_loaders/data_loader_rotator.py +0 -0
  49. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/evaluators/__init__.py +0 -0
  50. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/evaluators/evaluator_rotator.py +0 -0
  51. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/steering_methods/__init__.py +0 -0
  52. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/steering_methods/steering_rotator.py +0 -0
  53. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/__init__.py +0 -0
  54. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/commands/__init__.py +0 -0
  55. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/commands/help_cmd.py +0 -0
  56. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/commands/listing.py +0 -0
  57. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/commands/train_cmd.py +0 -0
  58. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/main.py +0 -0
  59. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/shell.py +0 -0
  60. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/ui.py +0 -0
  61. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/util/__init__.py +0 -0
  62. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/util/aggregations.py +0 -0
  63. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/util/parsing.py +0 -0
  64. {wisent-0.5.6 → wisent-0.5.7}/wisent/cli/wisent_cli/version.py +0 -0
  65. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/__init__.py +0 -0
  66. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/activations/__init__.py +0 -0
  67. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/activations/activations_collector.py +0 -0
  68. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/activations/core/__init__.py +0 -0
  69. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/activations/core/atoms.py +0 -0
  70. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/__init__.py +0 -0
  71. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/budget.py +0 -0
  72. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/device_benchmarks.py +0 -0
  73. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/__init__.py +0 -0
  74. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/agent_classifier_decision.py +0 -0
  75. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/classifier_marketplace.py +0 -0
  76. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/create_classifier.py +0 -0
  77. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/response_diagnostics.py +0 -0
  78. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/select_classifiers.py +0 -0
  79. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/synthetic_classifier_option.py +0 -0
  80. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/tasks/__init__.py +0 -0
  81. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/tasks/task_manager.py +0 -0
  82. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/tasks/task_relevance.py +0 -0
  83. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/tasks/task_selector.py +0 -0
  84. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose/test_synthetic_classifier.py +0 -0
  85. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/diagnose.py +0 -0
  86. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/steer.py +0 -0
  87. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/agent/timeout.py +0 -0
  88. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/autonomous_agent.py +0 -0
  89. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/bigcode_integration.py +0 -0
  90. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/__init__.py +0 -0
  91. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/__init__.py +0 -0
  92. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/atoms.py +0 -0
  93. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/buliders.py +0 -0
  94. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/pair.py +0 -0
  95. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/response.py +0 -0
  96. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/serialization.py +0 -0
  97. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/set.py +0 -0
  98. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/__init__.py +0 -0
  99. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/activations.py +0 -0
  100. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/base.py +0 -0
  101. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/control_vectors.py +0 -0
  102. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/coverage.py +0 -0
  103. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/divergence.py +0 -0
  104. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/duplicates.py +0 -0
  105. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/__init__.py +0 -0
  106. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/atoms.py +0 -0
  107. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_extractor_manifest.py +0 -0
  108. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_extractor_registry.py +0 -0
  109. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/__init__.py +0 -0
  110. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/winogrande.py +0 -0
  111. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_pairs_generation.py +0 -0
  112. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/data_loaders/__init__.py +0 -0
  113. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/data_loaders/core/__init__.py +0 -0
  114. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/data_loaders/core/atoms.py +0 -0
  115. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/data_loaders/loaders/__init__.py +0 -0
  116. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/data_loaders/loaders/custom.py +0 -0
  117. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/data_loaders/loaders/lm_loader.py +0 -0
  118. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/detection_handling.py +0 -0
  119. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/download_full_benchmarks.py +0 -0
  120. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/evaluators/__init__.py +0 -0
  121. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/evaluators/oracles/__init__.py +0 -0
  122. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/evaluators/oracles/interactive.py +0 -0
  123. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/evaluators/oracles/nlp_evaluator.py +0 -0
  124. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/evaluators/oracles/user_specified.py +0 -0
  125. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/hyperparameter_optimizer.py +0 -0
  126. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/lm_eval_harness_ground_truth.py +0 -0
  127. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/log_likelihoods_evaluator.py +0 -0
  128. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/managed_cached_benchmarks.py +0 -0
  129. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/mixed_benchmark_sampler.py +0 -0
  130. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/model_config_manager.py +0 -0
  131. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/model_persistence.py +0 -0
  132. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/models/__init__.py +0 -0
  133. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/models/core/__init__.py +0 -0
  134. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/models/core/atoms.py +0 -0
  135. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/models/wisent_model.py +0 -0
  136. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/__init__.py +0 -0
  137. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/classifier/__init__.py +0 -0
  138. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/classifier/activation_generator.py +0 -0
  139. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/classifier/classifier_cache.py +0 -0
  140. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/classifier/optuna_classifier_optimizer.py +0 -0
  141. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/steering/__init__.py +0 -0
  142. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/steering/bigcode_evaluator_wrapper.py +0 -0
  143. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/steering/data_utils.py +0 -0
  144. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/steering/metrics.py +0 -0
  145. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/steering/optuna_pipeline.py +0 -0
  146. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/optuna/steering/steering_optimization.py +0 -0
  147. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/parser.py +0 -0
  148. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/__init__.py +0 -0
  149. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/core/__init__.py +0 -0
  150. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/core/atom.py +0 -0
  151. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/core/prompt_formater.py +0 -0
  152. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/__init__.py +0 -0
  153. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/direct_completion.py +0 -0
  154. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/instruction_following.py +0 -0
  155. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/multiple_choice.py +0 -0
  156. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/role_playing.py +0 -0
  157. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/representation.py +0 -0
  158. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/sample_size_optimizer.py +0 -0
  159. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/sample_size_optimizer_v2.py +0 -0
  160. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/save_results.py +0 -0
  161. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/steering.py +0 -0
  162. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/steering_method.py +0 -0
  163. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/steering_methods/__init__.py +0 -0
  164. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/steering_methods/core/__init__.py +0 -0
  165. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/steering_methods/core/atoms.py +0 -0
  166. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/steering_methods/methods/__init__.py +0 -0
  167. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/steering_methods/methods/caa.py +0 -0
  168. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/steering_optimizer.py +0 -0
  169. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/task_interface.py +0 -0
  170. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/task_selector.py +0 -0
  171. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/__init__.py +0 -0
  172. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/aime_task.py +0 -0
  173. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/file_task.py +0 -0
  174. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/hle_task.py +0 -0
  175. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/hmmt_task.py +0 -0
  176. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/livecodebench_task.py +0 -0
  177. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/livemathbench_task.py +0 -0
  178. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/lm_eval_task.py +0 -0
  179. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/math500_task.py +0 -0
  180. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/polymath_task.py +0 -0
  181. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tasks/supergpqa_task.py +0 -0
  182. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/time_estimator.py +0 -0
  183. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/timing_calibration.py +0 -0
  184. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tracking/__init__.py +0 -0
  185. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tracking/latency.py +0 -0
  186. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/tracking/memory.py +0 -0
  187. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/trainers/__init__.py +0 -0
  188. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/trainers/core/__init__.py +0 -0
  189. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/trainers/core/atoms.py +0 -0
  190. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/trainers/steering_trainer.py +0 -0
  191. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/user_model_config.py +0 -0
  192. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/utils/__init__.py +0 -0
  193. {wisent-0.5.6 → wisent-0.5.7}/wisent/core/utils/device.py +0 -0
  194. {wisent-0.5.6 → wisent-0.5.7}/wisent/opti/__init__.py +0 -0
  195. {wisent-0.5.6 → wisent-0.5.7}/wisent/opti/core/__init__.py +0 -0
  196. {wisent-0.5.6 → wisent-0.5.7}/wisent/opti/core/atoms.py +0 -0
  197. {wisent-0.5.6 → wisent-0.5.7}/wisent/opti/methods/__init__.py +0 -0
  198. {wisent-0.5.6 → wisent-0.5.7}/wisent/opti/methods/opti_classificator.py +0 -0
  199. {wisent-0.5.6 → wisent-0.5.7}/wisent/opti/methods/opti_steering.py +0 -0
  200. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/__init__.py +0 -0
  201. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/__init__.py +0 -0
  202. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/core/__init__.py +0 -0
  203. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/core/atoms.py +0 -0
  204. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/deduper_cleaner.py +0 -0
  205. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/__init__.py +0 -0
  206. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/base_dedupers.py +0 -0
  207. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/base_refusalers.py +0 -0
  208. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/core/__init__.py +0 -0
  209. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/core/atoms.py +0 -0
  210. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/pairs_cleaner.py +0 -0
  211. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/cleaners/refusaler_cleaner.py +0 -0
  212. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/db_instructions/__init__.py +0 -0
  213. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/db_instructions/core/__init__.py +0 -0
  214. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/db_instructions/core/atoms.py +0 -0
  215. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/db_instructions/mini_dp.py +0 -0
  216. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/__init__.py +0 -0
  217. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/core/__init__.py +0 -0
  218. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/core/atoms.py +0 -0
  219. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/diversities/__init__.py +0 -0
  220. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/diversities/core/__init__.py +0 -0
  221. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/diversities/core/core.py +0 -0
  222. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/diversities/methods/__init__.py +0 -0
  223. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/diversities/methods/fast_diversity.py +0 -0
  224. {wisent-0.5.6 → wisent-0.5.7}/wisent/synthetic/generators/pairs_generator.py +0 -0
  225. {wisent-0.5.6 → wisent-0.5.7}/wisent.egg-info/SOURCES.txt +0 -0
  226. {wisent-0.5.6 → wisent-0.5.7}/wisent.egg-info/dependency_links.txt +0 -0
  227. {wisent-0.5.6 → wisent-0.5.7}/wisent.egg-info/requires.txt +0 -0
  228. {wisent-0.5.6 → wisent-0.5.7}/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.6
3
+ Version: 0.5.7
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
@@ -0,0 +1 @@
1
+ __version__ = "0.5.7"
@@ -0,0 +1,348 @@
1
+ """Multi-steering functionality for combining multiple steering vectors."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import torch
6
+ from typing import Iterable
7
+ from pathlib import Path
8
+
9
+ from wisent.core.models.wisent_model import WisentModel
10
+ from wisent.core.models.core.atoms import SteeringPlan
11
+ from wisent.core.activations.core.atoms import RawActivationMap
12
+ from wisent.core.prompts.core.atom import ChatMessage
13
+ from wisent.core.utils.device import resolve_default_device
14
+
15
+ __all__ = ["MultiSteering", "MultiSteeringError"]
16
+
17
+
18
+ class MultiSteeringError(Exception):
19
+ """Exception raised for multi-steering errors."""
20
+ pass
21
+
22
+
23
+ class MultiSteering:
24
+ """Handles multi-steering vector combination and application using WisentModel."""
25
+
26
+ def __init__(self, device: str | None = None, method: str = "CAA"):
27
+ """Initialize multi-steering handler.
28
+
29
+ Args:
30
+ device: Device to use for computations (cpu/cuda/mps)
31
+ method: Steering method to use (kept for backward compatibility, not used in new API)
32
+ """
33
+ self.device = device or resolve_default_device()
34
+ self.method = method # Kept for backward compatibility
35
+ self.loaded_vectors: list[dict] = []
36
+ self.weights: list[float] = []
37
+ self.combined_vector: torch.Tensor | None = None
38
+ self.layer: int | None = None
39
+
40
+ def load_vectors(self, vector_specs: list[str]) -> None:
41
+ """Load and validate steering vectors from file paths.
42
+
43
+ Args:
44
+ vector_specs: List of "path:weight" specifications
45
+
46
+ Raises:
47
+ MultiSteeringError: If vectors cannot be loaded or are incompatible
48
+ """
49
+ if not vector_specs:
50
+ raise MultiSteeringError("No vectors specified")
51
+
52
+ self.loaded_vectors = []
53
+ self.weights = []
54
+ layers_found = set()
55
+
56
+ for spec in vector_specs:
57
+ parts = spec.split(":")
58
+ if len(parts) != 2:
59
+ raise MultiSteeringError(f"Invalid vector specification: {spec}. Expected format: path:weight")
60
+
61
+ vector_path = parts[0]
62
+ try:
63
+ weight = float(parts[1])
64
+ except ValueError:
65
+ raise MultiSteeringError(f"Invalid weight in {spec}. Must be a number.")
66
+
67
+ if not Path(vector_path).exists():
68
+ raise MultiSteeringError(f"Vector file not found: {vector_path}")
69
+
70
+ print(f"Loading vector from {vector_path} with weight {weight}")
71
+
72
+ try:
73
+ vector_data = torch.load(vector_path, map_location=self.device, weights_only=False)
74
+ except Exception as e:
75
+ raise MultiSteeringError(f"Failed to load vector from {vector_path}: {e}")
76
+
77
+ # Extract metadata from loaded vector
78
+ if isinstance(vector_data, dict):
79
+ layer = vector_data.get("layer_index", None)
80
+ steering_vector = vector_data.get("steering_vector", None)
81
+
82
+ if steering_vector is None:
83
+ raise MultiSteeringError(f"No steering vector found in {vector_path}")
84
+
85
+ if layer is not None:
86
+ layers_found.add(layer)
87
+
88
+ self.loaded_vectors.append(vector_data)
89
+ self.weights.append(weight)
90
+
91
+ print(f" ✓ Loaded vector from layer {layer}")
92
+ else:
93
+ raise MultiSteeringError(f"Invalid vector format in {vector_path}")
94
+
95
+ # Validate compatibility
96
+ if len(layers_found) > 1:
97
+ raise MultiSteeringError(f"Vectors from different layers cannot be combined: {layers_found}")
98
+
99
+ if not layers_found:
100
+ raise MultiSteeringError("No layer information found in vectors")
101
+
102
+ self.layer = list(layers_found)[0]
103
+
104
+ print(f"\nUsing {self.method} method for vector combination")
105
+ print(f"Target layer: {self.layer}")
106
+
107
+ def combine_vectors(self, normalize: bool = True) -> torch.Tensor:
108
+ """Combine loaded vectors using SteeringPlan.
109
+
110
+ Args:
111
+ normalize: Whether to normalize the combined vector
112
+
113
+ Returns:
114
+ Combined steering vector as tensor
115
+
116
+ Raises:
117
+ MultiSteeringError: If combination fails
118
+ """
119
+ if not self.loaded_vectors:
120
+ raise MultiSteeringError("No vectors loaded")
121
+
122
+ if self.layer is None:
123
+ raise MultiSteeringError("No layer information available")
124
+
125
+ print(f"\n🔄 Combining {len(self.loaded_vectors)} vectors")
126
+
127
+ # Build RawActivationMap for each vector
128
+ raw_maps: list[RawActivationMap] = []
129
+ for vector_data in self.loaded_vectors:
130
+ steering_vector = vector_data["steering_vector"]
131
+
132
+ if not isinstance(steering_vector, torch.Tensor):
133
+ steering_vector = torch.tensor(steering_vector, device=self.device)
134
+ else:
135
+ steering_vector = steering_vector.to(self.device)
136
+
137
+ # Create a map with layer name as string (required by SteeringPlan)
138
+ raw_map: RawActivationMap = {str(self.layer): steering_vector}
139
+ raw_maps.append(raw_map)
140
+
141
+ # Create SteeringPlan with weighted combination
142
+ plan = SteeringPlan.from_raw(
143
+ raw=raw_maps,
144
+ weights=self.weights,
145
+ scale=1.0,
146
+ normalize=normalize
147
+ )
148
+
149
+ # Extract the combined vector from the plan
150
+ layer_str = str(self.layer)
151
+ if layer_str not in plan.layers:
152
+ raise MultiSteeringError(f"Layer {self.layer} not found in steering plan")
153
+
154
+ steering_vector = plan.layers[layer_str]
155
+ self.combined_vector = steering_vector.vector
156
+
157
+ print(f" ✓ Combined vector shape: {self.combined_vector.shape}")
158
+ print(f" ✓ Combined vector norm: {torch.norm(self.combined_vector).item():.4f}")
159
+
160
+ return self.combined_vector
161
+
162
+ def apply_steering_stream(
163
+ self,
164
+ model: WisentModel,
165
+ prompt: str,
166
+ max_new_tokens: int = 100,
167
+ temperature: float = 0.7,
168
+ top_p: float = 0.9
169
+ ) -> Iterable[str]:
170
+ """Apply the combined steering vector to generate text with streaming.
171
+
172
+ Args:
173
+ model: WisentModel instance to use for generation
174
+ prompt: Input prompt
175
+ max_new_tokens: Maximum tokens to generate
176
+ temperature: Sampling temperature
177
+ top_p: Top-p sampling parameter
178
+
179
+ Yields:
180
+ Generated text chunks
181
+
182
+ Raises:
183
+ MultiSteeringError: If steering fails
184
+ """
185
+ if self.combined_vector is None:
186
+ raise MultiSteeringError("No combined vector available. Call combine_vectors() first.")
187
+
188
+ if self.layer is None:
189
+ raise MultiSteeringError("No layer information available")
190
+
191
+ print(f"\n🎯 Applying combined steering vector at layer {self.layer}")
192
+ print(f"Prompt: {prompt}")
193
+ print("=" * 50)
194
+
195
+ # Create SteeringPlan from the combined vector
196
+ raw_map: RawActivationMap = {str(self.layer): self.combined_vector}
197
+ steering_plan = SteeringPlan.from_raw(
198
+ raw=raw_map,
199
+ scale=1.0,
200
+ normalize=False # Already normalized in combine_vectors
201
+ )
202
+
203
+ # Format prompt as chat messages
204
+ messages: list[ChatMessage] = [{"role": "user", "content": prompt}]
205
+
206
+ try:
207
+ # Use WisentModel's generate_stream with steering
208
+ yield from model.generate_stream(
209
+ inputs=[messages],
210
+ max_new_tokens=max_new_tokens,
211
+ temperature=temperature,
212
+ top_p=top_p,
213
+ use_steering=True,
214
+ steering_plan=steering_plan,
215
+ skip_prompt=True,
216
+ skip_special_tokens=True
217
+ )
218
+
219
+ except Exception as e:
220
+ raise MultiSteeringError(f"Failed to apply steering: {e}")
221
+
222
+ def apply_steering(
223
+ self,
224
+ model: WisentModel,
225
+ prompt: str,
226
+ max_new_tokens: int = 100,
227
+ temperature: float = 0.7,
228
+ top_p: float = 0.9
229
+ ) -> str:
230
+ """Apply the combined steering vector to generate text (non-streaming).
231
+
232
+ Args:
233
+ model: WisentModel instance to use for generation
234
+ prompt: Input prompt
235
+ max_new_tokens: Maximum tokens to generate
236
+ temperature: Sampling temperature
237
+ top_p: Top-p sampling parameter
238
+
239
+ Returns:
240
+ Generated text
241
+
242
+ Raises:
243
+ MultiSteeringError: If steering fails
244
+ """
245
+ if self.combined_vector is None:
246
+ raise MultiSteeringError("No combined vector available. Call combine_vectors() first.")
247
+
248
+ if self.layer is None:
249
+ raise MultiSteeringError("No layer information available")
250
+
251
+ print(f"\n🎯 Applying combined steering vector at layer {self.layer}")
252
+ print(f"Prompt: {prompt}")
253
+ print("=" * 50)
254
+
255
+ # Create SteeringPlan from the combined vector
256
+ raw_map: RawActivationMap = {str(self.layer): self.combined_vector}
257
+ steering_plan = SteeringPlan.from_raw(
258
+ raw=raw_map,
259
+ scale=1.0,
260
+ normalize=False # Already normalized in combine_vectors
261
+ )
262
+
263
+ # Format prompt as chat messages
264
+ messages: list[ChatMessage] = [{"role": "user", "content": prompt}]
265
+
266
+ try:
267
+ # Use WisentModel's generate with steering
268
+ outputs = model.generate(
269
+ inputs=[messages],
270
+ max_new_tokens=max_new_tokens,
271
+ temperature=temperature,
272
+ top_p=top_p,
273
+ use_steering=True,
274
+ steering_plan=steering_plan
275
+ )
276
+
277
+ return outputs[0] if outputs else ""
278
+
279
+ except Exception as e:
280
+ raise MultiSteeringError(f"Failed to apply steering: {e}")
281
+
282
+
283
+ def run_multi_steer(
284
+ vector_specs: list[str],
285
+ model_name: str,
286
+ prompt: str,
287
+ method: str = "CAA",
288
+ layer: int | None = None,
289
+ max_new_tokens: int = 100,
290
+ temperature: float = 0.7,
291
+ top_p: float = 0.9,
292
+ device: str | None = None,
293
+ verbose: bool = True,
294
+ ) -> str:
295
+ """Convenience function to run multi-steering.
296
+
297
+ Args:
298
+ vector_specs: List of "path:weight" specifications
299
+ model_name: Name of model to load
300
+ prompt: Input prompt
301
+ method: Steering method to use (kept for backward compatibility)
302
+ layer: Target layer (will be inferred from vectors if not specified)
303
+ max_new_tokens: Maximum tokens to generate
304
+ temperature: Sampling temperature
305
+ top_p: Top-p sampling parameter
306
+ device: Device to use
307
+ verbose: Whether to print progress
308
+
309
+ Returns:
310
+ Generated text
311
+ """
312
+ # Initialize model
313
+ if verbose:
314
+ print(f"\n🚀 Loading model: {model_name}")
315
+
316
+ chosen_device = device or resolve_default_device()
317
+
318
+ # Load model using WisentModel
319
+ model = WisentModel(
320
+ model_name=model_name,
321
+ device=chosen_device
322
+ )
323
+
324
+ # Initialize multi-steering with specified method
325
+ multi_steer = MultiSteering(device=chosen_device, method=method)
326
+
327
+ # Load vectors
328
+ multi_steer.load_vectors(vector_specs)
329
+
330
+ # Override layer if specified
331
+ if layer is not None:
332
+ multi_steer.layer = layer
333
+ if verbose:
334
+ print(f"Overriding layer to: {layer}")
335
+
336
+ # Combine vectors with normalization
337
+ multi_steer.combine_vectors(normalize=True)
338
+
339
+ # Apply steering (non-streaming)
340
+ output = multi_steer.apply_steering(
341
+ model=model,
342
+ prompt=prompt,
343
+ max_new_tokens=max_new_tokens,
344
+ temperature=temperature,
345
+ top_p=top_p
346
+ )
347
+
348
+ return output
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wisent
3
- Version: 0.5.6
3
+ Version: 0.5.7
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
@@ -1 +0,0 @@
1
- __version__ = "0.5.6"