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