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.
- {wisent-0.5.5 → wisent-0.5.7}/PKG-INFO +1 -1
- wisent-0.5.7/wisent/__init__.py +1 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/multi_steering.py +202 -170
- {wisent-0.5.5 → wisent-0.5.7}/wisent.egg-info/PKG-INFO +1 -1
- wisent-0.5.5/wisent/__init__.py +0 -1
- {wisent-0.5.5 → wisent-0.5.7}/LICENSE +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/README.md +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/pyproject.toml +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/setup.cfg +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/setup.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/evaluator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/metrics/passk.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/cpp_sanitizer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/java_sanitizer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/python_sanitizer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/output_sanitizer/utils.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/providers/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/providers/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/providers/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/providers/livecodebench/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/providers/livecodebench/provider.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/core/runtime.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/entrypoint.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/benchmarks/coding/safe_docker/recipes.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/classifiers/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/classifiers/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/classifiers/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/classifiers/models/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/classifiers/models/logistic.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/classifiers/models/mlp.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/classifiers/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/classifiers/classifier_rotator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/cli_logger.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/data_loaders/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/data_loaders/data_loader_rotator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/evaluators/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/evaluators/evaluator_rotator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/steering_methods/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/steering_methods/steering_rotator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/commands/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/commands/help_cmd.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/commands/listing.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/commands/train_cmd.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/main.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/shell.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/ui.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/util/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/util/aggregations.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/util/parsing.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/cli/wisent_cli/version.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/activations/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/activations/activations_collector.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/activations/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/activations/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/budget.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/device_benchmarks.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/agent_classifier_decision.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/classifier_marketplace.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/create_classifier.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/response_diagnostics.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/select_classifiers.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/synthetic_classifier_option.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/tasks/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/tasks/task_manager.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/tasks/task_relevance.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/tasks/task_selector.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose/test_synthetic_classifier.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/diagnose.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/steer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/agent/timeout.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/autonomous_agent.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/bigcode_integration.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/buliders.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/pair.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/response.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/serialization.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/core/set.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/activations.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/base.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/control_vectors.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/coverage.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/divergence.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/diagnostics/duplicates.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_extractor_manifest.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_extractor_registry.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_extractors/winogrande.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/contrastive_pairs/lm_eval_pairs/lm_task_pairs_generation.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/data_loaders/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/data_loaders/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/data_loaders/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/data_loaders/loaders/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/data_loaders/loaders/custom.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/data_loaders/loaders/lm_loader.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/detection_handling.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/download_full_benchmarks.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/evaluators/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/evaluators/oracles/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/evaluators/oracles/interactive.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/evaluators/oracles/nlp_evaluator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/evaluators/oracles/user_specified.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/hyperparameter_optimizer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/lm_eval_harness_ground_truth.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/log_likelihoods_evaluator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/managed_cached_benchmarks.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/mixed_benchmark_sampler.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/model_config_manager.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/model_persistence.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/models/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/models/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/models/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/models/wisent_model.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/classifier/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/classifier/activation_generator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/classifier/classifier_cache.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/classifier/optuna_classifier_optimizer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/steering/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/steering/bigcode_evaluator_wrapper.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/steering/data_utils.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/steering/metrics.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/steering/optuna_pipeline.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/optuna/steering/steering_optimization.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/parser.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/core/atom.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/core/prompt_formater.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/direct_completion.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/instruction_following.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/multiple_choice.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/prompts/prompt_stratiegies/role_playing.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/representation.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/sample_size_optimizer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/sample_size_optimizer_v2.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/save_results.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/steering.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/steering_method.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/steering_methods/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/steering_methods/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/steering_methods/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/steering_methods/methods/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/steering_methods/methods/caa.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/steering_optimizer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/task_interface.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/task_selector.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/aime_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/file_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/hle_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/hmmt_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/livecodebench_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/livemathbench_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/lm_eval_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/math500_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/polymath_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tasks/supergpqa_task.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/time_estimator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/timing_calibration.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tracking/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tracking/latency.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/tracking/memory.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/trainers/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/trainers/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/trainers/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/trainers/steering_trainer.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/user_model_config.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/utils/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/core/utils/device.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/opti/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/opti/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/opti/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/opti/methods/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/opti/methods/opti_classificator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/opti/methods/opti_steering.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/deduper_cleaner.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/base_dedupers.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/base_refusalers.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/methods/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/pairs_cleaner.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/cleaners/refusaler_cleaner.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/db_instructions/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/db_instructions/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/db_instructions/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/db_instructions/mini_dp.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/core/atoms.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/diversities/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/diversities/core/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/diversities/core/core.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/diversities/methods/__init__.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/diversities/methods/fast_diversity.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent/synthetic/generators/pairs_generator.py +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent.egg-info/SOURCES.txt +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent.egg-info/dependency_links.txt +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent.egg-info/requires.txt +0 -0
- {wisent-0.5.5 → wisent-0.5.7}/wisent.egg-info/top_level.txt +0 -0
|
@@ -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
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
4
5
|
import torch
|
|
5
|
-
from typing import
|
|
6
|
+
from typing import Iterable
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
|
|
8
|
-
from .
|
|
9
|
-
from .
|
|
10
|
-
from .
|
|
11
|
-
from .
|
|
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
|
|
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:
|
|
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 =
|
|
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
|
|
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
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
|
169
|
-
|
|
170
|
-
|
|
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:
|
|
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
|
|
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
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
-
#
|
|
238
|
-
|
|
239
|
-
|
|
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
|
|
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:
|
|
284
|
+
vector_specs: list[str],
|
|
258
285
|
model_name: str,
|
|
259
286
|
prompt: str,
|
|
260
287
|
method: str = "CAA",
|
|
261
|
-
layer:
|
|
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 (
|
|
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
|
-
|
|
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 =
|
|
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
|
wisent-0.5.5/wisent/__init__.py
DELETED
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|