circuitkit 0.1.0__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.
- circuitkit-0.1.0/.github/workflows/docs.yml +83 -0
- circuitkit-0.1.0/.github/workflows/patch-release.yml +454 -0
- circuitkit-0.1.0/LICENSE.md +73 -0
- circuitkit-0.1.0/MANIFEST.in +53 -0
- circuitkit-0.1.0/PKG-INFO +192 -0
- circuitkit-0.1.0/README.md +107 -0
- circuitkit-0.1.0/docs/API_REFERENCE.md +491 -0
- circuitkit-0.1.0/docs/INSTALLATION.md +369 -0
- circuitkit-0.1.0/docs/about/faq.md +97 -0
- circuitkit-0.1.0/docs/about/license.md +49 -0
- circuitkit-0.1.0/docs/about/release-notes.md +50 -0
- circuitkit-0.1.0/docs/about/roadmap.md +50 -0
- circuitkit-0.1.0/docs/advanced/architecture-registry.md +183 -0
- circuitkit-0.1.0/docs/advanced/chat-templates.md +151 -0
- circuitkit-0.1.0/docs/advanced/circuit-artifacts.md +187 -0
- circuitkit-0.1.0/docs/advanced/hallucination-detection.md +161 -0
- circuitkit-0.1.0/docs/advanced/memory-optimization.md +156 -0
- circuitkit-0.1.0/docs/advanced/vllm-evaluation.md +151 -0
- circuitkit-0.1.0/docs/algorithms/acdc.md +106 -0
- circuitkit-0.1.0/docs/algorithms/capability-matrix.md +58 -0
- circuitkit-0.1.0/docs/algorithms/cdt.md +75 -0
- circuitkit-0.1.0/docs/algorithms/eap.md +156 -0
- circuitkit-0.1.0/docs/algorithms/ibcircuit.md +108 -0
- circuitkit-0.1.0/docs/algorithms/overview.md +128 -0
- circuitkit-0.1.0/docs/algorithms/stability-tiers.md +69 -0
- circuitkit-0.1.0/docs/api-reference/applications.md +244 -0
- circuitkit-0.1.0/docs/api-reference/backends.md +158 -0
- circuitkit-0.1.0/docs/api-reference/dict-config.md +195 -0
- circuitkit-0.1.0/docs/api-reference/evaluation.md +211 -0
- circuitkit-0.1.0/docs/api-reference/flat-api.md +350 -0
- circuitkit-0.1.0/docs/api-reference/overview.md +112 -0
- circuitkit-0.1.0/docs/api-reference/pipeline.md +304 -0
- circuitkit-0.1.0/docs/api-reference/selectors.md +143 -0
- circuitkit-0.1.0/docs/api-reference/tasks.md +182 -0
- circuitkit-0.1.0/docs/blog/introducing-circuitkit.md +193 -0
- circuitkit-0.1.0/docs/citation-map.md +41 -0
- circuitkit-0.1.0/docs/cli/applications.md +206 -0
- circuitkit-0.1.0/docs/cli/discovery.md +193 -0
- circuitkit-0.1.0/docs/cli/evaluation.md +170 -0
- circuitkit-0.1.0/docs/cli/overview.md +123 -0
- circuitkit-0.1.0/docs/cli/yaml-config.md +193 -0
- circuitkit-0.1.0/docs/contributing/documentation.md +146 -0
- circuitkit-0.1.0/docs/contributing/new-algorithms.md +185 -0
- circuitkit-0.1.0/docs/contributing/setup.md +149 -0
- circuitkit-0.1.0/docs/contributing/standards.md +139 -0
- circuitkit-0.1.0/docs/contributing/testing-on-cuda.md +133 -0
- circuitkit-0.1.0/docs/dev_enterprise_runbook.md +192 -0
- circuitkit-0.1.0/docs/evaluation/ablation.md +105 -0
- circuitkit-0.1.0/docs/evaluation/baselines.md +102 -0
- circuitkit-0.1.0/docs/evaluation/benchmarking.md +118 -0
- circuitkit-0.1.0/docs/evaluation/causal-patching.md +99 -0
- circuitkit-0.1.0/docs/evaluation/framework.md +182 -0
- circuitkit-0.1.0/docs/evaluation/generalization.md +102 -0
- circuitkit-0.1.0/docs/evaluation/robustness.md +134 -0
- circuitkit-0.1.0/docs/evaluation/stability.md +95 -0
- circuitkit-0.1.0/docs/examples/case-studies.md +52 -0
- circuitkit-0.1.0/docs/examples/notebooks.md +127 -0
- circuitkit-0.1.0/docs/examples/overview.md +44 -0
- circuitkit-0.1.0/docs/examples/scripts.md +152 -0
- circuitkit-0.1.0/docs/getting-started/configuration.md +165 -0
- circuitkit-0.1.0/docs/getting-started/core-concepts.md +215 -0
- circuitkit-0.1.0/docs/getting-started/index.md +30 -0
- circuitkit-0.1.0/docs/getting-started/installation.md +109 -0
- circuitkit-0.1.0/docs/getting-started/quickstart.md +121 -0
- circuitkit-0.1.0/docs/getting-started/taxonomy.md +105 -0
- circuitkit-0.1.0/docs/guidelines/Testing_Guidelines.md +170 -0
- circuitkit-0.1.0/docs/guides/CONCEPTS.md +375 -0
- circuitkit-0.1.0/docs/guides/circuit_artifact_guide.md +440 -0
- circuitkit-0.1.0/docs/guides/eap_ig_memory_optimization.md +151 -0
- circuitkit-0.1.0/docs/guides/hallucination_detection_guide.md +428 -0
- circuitkit-0.1.0/docs/guides/index.md +104 -0
- circuitkit-0.1.0/docs/guides/steering.md +408 -0
- circuitkit-0.1.0/docs/guides/vllm_evaluation.md +136 -0
- circuitkit-0.1.0/docs/index.md +208 -0
- circuitkit-0.1.0/docs/product_blueprint.md +122 -0
- circuitkit-0.1.0/docs/pypi_core_contract.md +13 -0
- circuitkit-0.1.0/docs/reference/ARCHITECTURE_REGISTRY.md +225 -0
- circuitkit-0.1.0/docs/reference/FEATURES.md +199 -0
- circuitkit-0.1.0/docs/reference/index.md +7 -0
- circuitkit-0.1.0/docs/references.md +35 -0
- circuitkit-0.1.0/docs/trust/index.md +30 -0
- circuitkit-0.1.0/docs/trust/results.md +62 -0
- circuitkit-0.1.0/docs/trust/scope.md +75 -0
- circuitkit-0.1.0/docs/user-guide/applications.md +224 -0
- circuitkit-0.1.0/docs/user-guide/custom-data.md +182 -0
- circuitkit-0.1.0/docs/user-guide/data-corruption.md +68 -0
- circuitkit-0.1.0/docs/user-guide/data.md +73 -0
- circuitkit-0.1.0/docs/user-guide/evaluation.md +155 -0
- circuitkit-0.1.0/docs/user-guide/pipeline-overview.md +173 -0
- circuitkit-0.1.0/docs/user-guide/selectors.md +125 -0
- circuitkit-0.1.0/docs/user-guide/tasks.md +85 -0
- circuitkit-0.1.0/docs/user-guide/troubleshooting.md +142 -0
- circuitkit-0.1.0/docs/user-guide/visualization.md +111 -0
- circuitkit-0.1.0/examples/01-quickstart.py +63 -0
- circuitkit-0.1.0/examples/02-discover-python-api.py +57 -0
- circuitkit-0.1.0/examples/04-discover-yaml.py +64 -0
- circuitkit-0.1.0/examples/05-evaluate-faithfulness.py +77 -0
- circuitkit-0.1.0/examples/06-applications.py +205 -0
- circuitkit-0.1.0/examples/07-pipeline.py +59 -0
- circuitkit-0.1.0/examples/08-custom-data.py +129 -0
- circuitkit-0.1.0/examples/09-load-and-reuse.py +83 -0
- circuitkit-0.1.0/examples/10-steering.py +32 -0
- circuitkit-0.1.0/examples/11-knowledge-editing.py +26 -0
- circuitkit-0.1.0/examples/12-custom-corruption.py +85 -0
- circuitkit-0.1.0/examples/13-transfer-matrix.py +28 -0
- circuitkit-0.1.0/examples/case-studies/14-faithfulness-audit-for-compliance.py +80 -0
- circuitkit-0.1.0/examples/case-studies/15-compression-for-deployment.py +74 -0
- circuitkit-0.1.0/examples/case-studies/16-tabular-model-audit.py +84 -0
- circuitkit-0.1.0/examples/case-studies/17-quantization-unlearning.py +65 -0
- circuitkit-0.1.0/examples/case-studies/18-banking-safety-steering.py +70 -0
- circuitkit-0.1.0/examples/case-studies/19-trade-finance-document-classification.py +79 -0
- circuitkit-0.1.0/examples/case-studies/20-transit-edge-deployment.py +84 -0
- circuitkit-0.1.0/examples/case-studies/21-quantization-permanent-unlearning.ipynb +540 -0
- circuitkit-0.1.0/examples/case-studies/22-gender-bias-audit-and-mitigation.ipynb +450 -0
- circuitkit-0.1.0/examples/case-studies/23-jailbreak-safety-steering.ipynb +723 -0
- circuitkit-0.1.0/examples/case-studies/24-safety-refusal-custom-data.py +239 -0
- circuitkit-0.1.0/examples/discovery/algorithm-comparison.py +69 -0
- circuitkit-0.1.0/examples/discovery/benchmark-circuit-discovery.py +654 -0
- circuitkit-0.1.0/examples/experiments/e1_algo_validation_ioi.py +155 -0
- circuitkit-0.1.0/examples/experiments/e2_cross_family_discovery.py +169 -0
- circuitkit-0.1.0/examples/experiments/e3_neuron_level_ioi.py +154 -0
- circuitkit-0.1.0/examples/experiments/e4_custom_data_jailbreak.py +255 -0
- circuitkit-0.1.0/examples/experiments/e567_downstream_applications.py +703 -0
- circuitkit-0.1.0/examples/finetuning/finetune-llama.py +670 -0
- circuitkit-0.1.0/examples/finetuning/finetune-qwen.py +656 -0
- circuitkit-0.1.0/examples/notebooks/00_colab_setup.ipynb +184 -0
- circuitkit-0.1.0/examples/notebooks/01_quickstart_pipeline.ipynb +291 -0
- circuitkit-0.1.0/examples/notebooks/02_algorithm_comparison.ipynb +345 -0
- circuitkit-0.1.0/examples/notebooks/03_custom_data_jailbreak.ipynb +359 -0
- circuitkit-0.1.0/examples/notebooks/04_evaluation_deep_dive.ipynb +365 -0
- circuitkit-0.1.0/examples/notebooks/05_visualization_gallery.ipynb +280 -0
- circuitkit-0.1.0/examples/notebooks/06_applications.ipynb +357 -0
- circuitkit-0.1.0/examples/notebooks/07_cli_and_yaml.ipynb +360 -0
- circuitkit-0.1.0/examples/notebooks/08_advanced_research_tools.ipynb +453 -0
- circuitkit-0.1.0/examples/notebooks/demo_2p5min.ipynb +197 -0
- circuitkit-0.1.0/examples/pruning/basic-prune.py +790 -0
- circuitkit-0.1.0/examples/pruning/prune-llama.py +664 -0
- circuitkit-0.1.0/examples/pruning/prune-qwen.py +594 -0
- circuitkit-0.1.0/examples/quantization/quantize-llama.py +748 -0
- circuitkit-0.1.0/examples/quantization/quantize-qwen.py +729 -0
- circuitkit-0.1.0/examples/simple_csv_task.yaml +50 -0
- circuitkit-0.1.0/examples/validation/_common.py +203 -0
- circuitkit-0.1.0/examples/validation/_runner.py +112 -0
- circuitkit-0.1.0/examples/validation/algos/01_eap_ig_activations_gpt2.py +71 -0
- circuitkit-0.1.0/examples/validation/algos/02_eap_clean_corrupted_gpt2.py +71 -0
- circuitkit-0.1.0/examples/validation/algos/03_eap_exact_gpt2.py +76 -0
- circuitkit-0.1.0/examples/validation/algos/04_compare_eap_family_gpt2.py +129 -0
- circuitkit-0.1.0/examples/validation/algos/05_atp_gd_gpt2.py +76 -0
- circuitkit-0.1.0/examples/validation/algos/06_eap_gp_gpt2.py +76 -0
- circuitkit-0.1.0/examples/validation/algos/07_relp_gpt2.py +75 -0
- circuitkit-0.1.0/examples/validation/algos/08_ibcircuit_gpt2.py +76 -0
- circuitkit-0.1.0/examples/validation/algos/09_peap_gpt2.py +76 -0
- circuitkit-0.1.0/examples/validation/algos/10_cdt_gpt2.py +74 -0
- circuitkit-0.1.0/examples/validation/algos/11_eap_ifr_gpt2.py +72 -0
- circuitkit-0.1.0/examples/validation/algos/12_all_algos_llama.py +203 -0
- circuitkit-0.1.0/examples/validation/algos/_algos_common.py +139 -0
- circuitkit-0.1.0/examples/validation/applications/01_pruning_gpt2_ioi.py +199 -0
- circuitkit-0.1.0/examples/validation/applications/02_lora_healing_gpt2_ioi.py +261 -0
- circuitkit-0.1.0/examples/validation/applications/03_pruning_gpt2_mmlu.py +193 -0
- circuitkit-0.1.0/examples/validation/applications/04_pruning_gpt2_gender_bias.py +190 -0
- circuitkit-0.1.0/examples/validation/applications/05_pruning_gpt2_sva.py +190 -0
- circuitkit-0.1.0/examples/validation/applications/06_pruning_gpt2_capital_country.py +190 -0
- circuitkit-0.1.0/examples/validation/applications/07_pruning_gpt2_boolq.py +190 -0
- circuitkit-0.1.0/examples/validation/applications/08_pruning_gpt2_arc_easy.py +190 -0
- circuitkit-0.1.0/examples/validation/applications/09_pruning_gpt2_hellaswag.py +190 -0
- circuitkit-0.1.0/examples/validation/applications/10_pruning_gpt2_crows_pairs.py +190 -0
- circuitkit-0.1.0/examples/validation/applications/11_knowledge_editing_gpt2.py +305 -0
- circuitkit-0.1.0/examples/validation/applications/12_unlearning_tofu_gpt2.py +263 -0
- circuitkit-0.1.0/examples/validation/applications/13_steering_gpt2_ioi.py +173 -0
- circuitkit-0.1.0/examples/validation/applications/14_linear_probe_gpt2.py +193 -0
- circuitkit-0.1.0/examples/validation/applications/15_hallucination_gpt2.py +169 -0
- circuitkit-0.1.0/examples/validation/applications/16_peft_benchmark.py +96 -0
- circuitkit-0.1.0/examples/validation/applications/17_knowledge_editing_full_gpt2.py +153 -0
- circuitkit-0.1.0/examples/validation/applications/18_steering_safety_gpt2.py +108 -0
- circuitkit-0.1.0/examples/validation/applications/19_quantization_llama1b.py +207 -0
- circuitkit-0.1.0/examples/validation/applications/20_ctheta_steering_gpt2.py +281 -0
- circuitkit-0.1.0/examples/validation/applications/21_ctheta_steering_llama1b.py +193 -0
- circuitkit-0.1.0/examples/validation/applications/22_ctheta_advbench_refusal.py +200 -0
- circuitkit-0.1.0/examples/validation/applications/23_ctheta_k_grid_gpt2.py +184 -0
- circuitkit-0.1.0/examples/validation/applications/24_circuitkit_advbench_refusal_steering.py +330 -0
- circuitkit-0.1.0/examples/validation/applications/25_knowledge_editing_llama_circuit.py +292 -0
- circuitkit-0.1.0/examples/validation/applications/26_soft_healing_llama_circuit.py +309 -0
- circuitkit-0.1.0/examples/validation/applications/27_hallucination_truthfulqa_llama.py +260 -0
- circuitkit-0.1.0/examples/validation/applications/28_safety_dataset_pillar_evals.py +263 -0
- circuitkit-0.1.0/examples/validation/applications/_apps_common.py +108 -0
- circuitkit-0.1.0/examples/validation/applications/_make_apps_cell.py +230 -0
- circuitkit-0.1.0/examples/validation/benchmark/01_gpt2_ioi.py +77 -0
- circuitkit-0.1.0/examples/validation/benchmark/02_gpt2_greater_than.py +74 -0
- circuitkit-0.1.0/examples/validation/benchmark/03_llama1b_ioi.py +80 -0
- circuitkit-0.1.0/examples/validation/benchmark/04_llama1b_greater_than.py +73 -0
- circuitkit-0.1.0/examples/validation/benchmark/05_gpt2_mmlu.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/06_llama1b_mmlu.py +72 -0
- circuitkit-0.1.0/examples/validation/benchmark/07_gpt2_gender_bias.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/08_gpt2_hypernymy.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/09_gpt2_sva.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/10_gpt2_capital_country.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/11_gpt2_boolq.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/12_gpt2_wmdp.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/13_gpt2_arc_easy.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/14_gpt2_arc_challenge.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/15_gpt2_hellaswag.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/16_gpt2_crows_pairs.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/17_gpt2_tofu.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/18_gpt2_gsm8k.py +78 -0
- circuitkit-0.1.0/examples/validation/benchmark/99_aggregate.py +99 -0
- circuitkit-0.1.0/examples/validation/benchmark/_bench_common.py +251 -0
- circuitkit-0.1.0/examples/validation/benchmark/_custom_tasks.py +349 -0
- circuitkit-0.1.0/examples/validation/benchmark/_make_cell.py +149 -0
- circuitkit-0.1.0/examples/validation/data/01_pairwise_crowspairs.py +59 -0
- circuitkit-0.1.0/examples/validation/data/02_instruction_alpaca.py +48 -0
- circuitkit-0.1.0/examples/validation/data/03_conversational_sharegpt.py +53 -0
- circuitkit-0.1.0/examples/validation/data/04_mcq_mmlu_arc_hellaswag.py +56 -0
- circuitkit-0.1.0/examples/validation/data/05_forget_retain_tofu.py +49 -0
- circuitkit-0.1.0/examples/validation/data/06_strategies_all.py +114 -0
- circuitkit-0.1.0/examples/validation/data/07_e2e_discovery_mcq_gpt2.py +93 -0
- circuitkit-0.1.0/examples/validation/data/08_e2e_discovery_tofu_gpt2.py +84 -0
- circuitkit-0.1.0/examples/validation/data/09_e2e_discovery_crowspairs_llama1b.py +88 -0
- circuitkit-0.1.0/examples/validation/data/10_e2e_quality_stability_mcq_gpt2.py +127 -0
- circuitkit-0.1.0/examples/validation/data/11_e2e_all_algos_custom_mcq_gpt2.py +117 -0
- circuitkit-0.1.0/examples/validation/data/12_e2e_safety_advbench_gpt2.py +118 -0
- circuitkit-0.1.0/examples/validation/data/_data_common.py +39 -0
- circuitkit-0.1.0/examples/validation/master_aggregator.py +189 -0
- circuitkit-0.1.0/examples/validation/visualizations/01_circuit_graph.py +75 -0
- circuitkit-0.1.0/examples/validation/visualizations/02_activation_saliency.py +57 -0
- circuitkit-0.1.0/examples/validation/visualizations/03_feature_saliency.py +57 -0
- circuitkit-0.1.0/examples/validation/visualizations/04_circuit_editor.py +55 -0
- circuitkit-0.1.0/examples/validation/visualizations/05_comparison_dashboard.py +62 -0
- circuitkit-0.1.0/examples/validation/visualizations/06_jupyter_widgets.py +63 -0
- circuitkit-0.1.0/examples/validation/visualizations/07_gallery_generator.py +75 -0
- circuitkit-0.1.0/examples/validation/visualizations/08_plotter.py +48 -0
- circuitkit-0.1.0/examples/validation/visualizations/09_eap_visualization.py +48 -0
- circuitkit-0.1.0/examples/validation/visualizations/10_acdc_visualize.py +52 -0
- circuitkit-0.1.0/examples/validation/visualizations/11_transfer_visualizer.py +67 -0
- circuitkit-0.1.0/examples/visualization/graph-viz-example.py +324 -0
- circuitkit-0.1.0/pyproject.toml +183 -0
- circuitkit-0.1.0/pytest.ini +14 -0
- circuitkit-0.1.0/requirements.txt +12 -0
- circuitkit-0.1.0/setup.cfg +4 -0
- circuitkit-0.1.0/src/circuitkit/__init__.py +128 -0
- circuitkit-0.1.0/src/circuitkit/__main__.py +9 -0
- circuitkit-0.1.0/src/circuitkit/analysis/__init__.py +19 -0
- circuitkit-0.1.0/src/circuitkit/analysis/cross_method_jaccard.py +116 -0
- circuitkit-0.1.0/src/circuitkit/analysis/metrics.py +54 -0
- circuitkit-0.1.0/src/circuitkit/analysis/scores.py +44 -0
- circuitkit-0.1.0/src/circuitkit/api.py +2682 -0
- circuitkit-0.1.0/src/circuitkit/applications/__init__.py +70 -0
- circuitkit-0.1.0/src/circuitkit/applications/arch_registry.py +315 -0
- circuitkit-0.1.0/src/circuitkit/applications/arch_utils.py +302 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/__init__.py +15 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/_covariance.py +223 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/_device.py +33 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/_metrics.py +429 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/_tokenization.py +510 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/benchmark_analysis.py +400 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/cure_clue.py +338 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/hallucination_detection.py +497 -0
- circuitkit-0.1.0/src/circuitkit/applications/common_utils/linear_probe.py +294 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/__init__.py +30 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/cake.py +237 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/circuit_guided_editing.py +487 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/fine_tune_editing.py +327 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/knowledge_editing.py +598 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/knowledge_editing_enhanced.py +863 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/mcircke.py +263 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/memit_wrapper.py +947 -0
- circuitkit-0.1.0/src/circuitkit/applications/editing/rome_wrapper.py +770 -0
- circuitkit-0.1.0/src/circuitkit/applications/finetuning/__init__.py +17 -0
- circuitkit-0.1.0/src/circuitkit/applications/finetuning/benchmark_peft.py +451 -0
- circuitkit-0.1.0/src/circuitkit/applications/finetuning/circuit_tuning.py +377 -0
- circuitkit-0.1.0/src/circuitkit/applications/finetuning/healing_metrics.py +304 -0
- circuitkit-0.1.0/src/circuitkit/applications/finetuning/peft_methods.py +563 -0
- circuitkit-0.1.0/src/circuitkit/applications/finetuning/soft_healing.py +717 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/__init__.py +13 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/eval_utils.py +347 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/examples/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/examples/prune.py +787 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/examples/prune_llama.py +661 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/examples/prune_qwen.py +591 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/finetune_utils.py +477 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/importance.py +97 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/neuron_pruner.py +36 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/node_pruner.py +186 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/pruner.py +529 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/score_extractor.py +541 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/selectors/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/selectors/multi_granular_selector.py +119 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/selectors/taylor_selector.py +112 -0
- circuitkit-0.1.0/src/circuitkit/applications/pruning/weight_pruner.py +652 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/__init__.py +19 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/examples/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/examples/quantize_llama.py +745 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/examples/quantize_qwen.py +726 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/llmcompressor_quantize.py +388 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/quant_utils.py +825 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/score_extractor.py +465 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/selectors/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/selectors/awq_selector.py +109 -0
- circuitkit-0.1.0/src/circuitkit/applications/quantization/selectors/tacq_selector.py +145 -0
- circuitkit-0.1.0/src/circuitkit/applications/selective_finetuning/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/applications/selective_finetuning/examples/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/applications/selective_finetuning/examples/finetune_llama.py +668 -0
- circuitkit-0.1.0/src/circuitkit/applications/selective_finetuning/examples/finetune_qwen.py +654 -0
- circuitkit-0.1.0/src/circuitkit/applications/selective_finetuning/finetune_utils.py +643 -0
- circuitkit-0.1.0/src/circuitkit/applications/selective_finetuning/score_loader.py +585 -0
- circuitkit-0.1.0/src/circuitkit/applications/selective_finetuning/selector.py +616 -0
- circuitkit-0.1.0/src/circuitkit/applications/steering/__init__.py +31 -0
- circuitkit-0.1.0/src/circuitkit/applications/steering/steering.py +791 -0
- circuitkit-0.1.0/src/circuitkit/applications/steering/steering_enhanced.py +556 -0
- circuitkit-0.1.0/src/circuitkit/applications/steering/weight_steering.py +407 -0
- circuitkit-0.1.0/src/circuitkit/artifacts/__init__.py +25 -0
- circuitkit-0.1.0/src/circuitkit/artifacts/circuit_artifact.py +559 -0
- circuitkit-0.1.0/src/circuitkit/artifacts/converters.py +405 -0
- circuitkit-0.1.0/src/circuitkit/artifacts/scores.py +195 -0
- circuitkit-0.1.0/src/circuitkit/backends/__init__.py +96 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/artifact_export.py +140 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/data.py +183 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/model_utils/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/model_utils/micro_model_utils.py +143 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/model_utils/transformer_lens_utils.py +232 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/prune.py +123 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/prune_algos/ACDC.py +136 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/prune_algos/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/prune_algos/mask_gradient.py +129 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/prune_algos/prune_algos.py +33 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/tasks/__init__.py +3 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/tasks/docstring_prompts.py +837 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/tasks/docstring_utils.py +88 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/tasks/induction_utils.py +122 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/tasks/ioi_dataset.py +156 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/tasks/ioi_utils.py +96 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/types.py +248 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/ablation_activations.py +160 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/custom_tqdm.py +14 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/graph_utils.py +497 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/misc.py +68 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/patch_wrapper.py +106 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/patchable_model.py +143 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/task_utils.py +31 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/utils/tensor_ops.py +118 -0
- circuitkit-0.1.0/src/circuitkit/backends/acdc/visualize.py +253 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/__init__.py +30 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/adapter.py +245 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/propagation.py +357 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/__init__.py +14 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/cdt_ablations.py +215 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/cdt_basic.py +235 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/cdt_core.py +418 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/cdt_from_source_nodes.py +237 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/cdt_source_to_target.py +685 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/faithfulness_ablations.py +251 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/general.py +314 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/ioi_dataset.py +958 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/local_importance.py +809 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/pathology.py +460 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/toy_model.py +190 -0
- circuitkit-0.1.0/src/circuitkit/backends/cdt/pyfunctions/wrappers.py +159 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/__init__.py +2 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/artifact_export.py +137 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/attribute.py +784 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/attribute_node.py +1795 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/circuit_kit_adapter.py +121 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/eap_utils.py +582 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/evaluate.py +762 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/graph.py +1569 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/metrics.py +793 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/py.typed +0 -0
- circuitkit-0.1.0/src/circuitkit/backends/eap/visualization.py +101 -0
- circuitkit-0.1.0/src/circuitkit/backends/ibcircuit/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/backends/ibcircuit/artifact_export.py +127 -0
- circuitkit-0.1.0/src/circuitkit/backends/ibcircuit/ib_noise.py +216 -0
- circuitkit-0.1.0/src/circuitkit/backends/ibcircuit/ib_utils.py +194 -0
- circuitkit-0.1.0/src/circuitkit/backends/ibcircuit/model_wrapper.py +537 -0
- circuitkit-0.1.0/src/circuitkit/backends/ibcircuit/trainer.py +603 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/__init__.py +47 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/baselines/__init__.py +20 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/baselines/gptq.py +200 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/baselines/magnitude.py +204 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/baselines/random.py +142 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/baselines/sparsegpt.py +236 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/baselines/wanda.py +263 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/benchmark.py +764 -0
- circuitkit-0.1.0/src/circuitkit/benchmarks/reporting.py +639 -0
- circuitkit-0.1.0/src/circuitkit/circuit.py +390 -0
- circuitkit-0.1.0/src/circuitkit/cli/__init__.py +1 -0
- circuitkit-0.1.0/src/circuitkit/cli/config.py +74 -0
- circuitkit-0.1.0/src/circuitkit/cli/debug.py +279 -0
- circuitkit-0.1.0/src/circuitkit/cli/main.py +2208 -0
- circuitkit-0.1.0/src/circuitkit/cli/utils.py +351 -0
- circuitkit-0.1.0/src/circuitkit/corruption/__init__.py +61 -0
- circuitkit-0.1.0/src/circuitkit/corruption/base.py +132 -0
- circuitkit-0.1.0/src/circuitkit/corruption/color_swap.py +170 -0
- circuitkit-0.1.0/src/circuitkit/corruption/distractor.py +319 -0
- circuitkit-0.1.0/src/circuitkit/corruption/distractor_variation.py +313 -0
- circuitkit-0.1.0/src/circuitkit/corruption/effectiveness.py +297 -0
- circuitkit-0.1.0/src/circuitkit/corruption/entity_swap.py +288 -0
- circuitkit-0.1.0/src/circuitkit/corruption/negation.py +364 -0
- circuitkit-0.1.0/src/circuitkit/corruption/paraphrase.py +390 -0
- circuitkit-0.1.0/src/circuitkit/corruption/pipeline.py +333 -0
- circuitkit-0.1.0/src/circuitkit/corruption/position_shift.py +106 -0
- circuitkit-0.1.0/src/circuitkit/corruption/role_swap.py +381 -0
- circuitkit-0.1.0/src/circuitkit/corruption/token_swap.py +257 -0
- circuitkit-0.1.0/src/circuitkit/corruption/validators.py +570 -0
- circuitkit-0.1.0/src/circuitkit/corruption/voice_swap.py +393 -0
- circuitkit-0.1.0/src/circuitkit/data/__init__.py +8 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/__init__.py +20 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/base.py +123 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/code.py +106 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/conversational.py +167 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/forget_retain.py +152 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/instruction.py +125 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/math.py +133 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/mcq.py +194 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/pairwise.py +182 -0
- circuitkit-0.1.0/src/circuitkit/data/adapters/safety_prompt.py +258 -0
- circuitkit-0.1.0/src/circuitkit/data/auto_detect.py +187 -0
- circuitkit-0.1.0/src/circuitkit/data/clean_only.py +124 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/__init__.py +38 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/base.py +239 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/benign_rewrite.py +127 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/code_syntax_corrupt.py +98 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/entity_swap.py +113 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/final_answer_swap.py +231 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/instruction_swap.py +149 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/llm_counterfactual.py +161 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/logical_negation.py +96 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/math_step_corrupt.py +88 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/mcq_choice_swap.py +106 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/operand_swap.py +103 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/profession_swap.py +125 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/resample.py +75 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/template.py +195 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/template_utils.py +328 -0
- circuitkit-0.1.0/src/circuitkit/data/corruption/token_swap.py +90 -0
- circuitkit-0.1.0/src/circuitkit/data/dataset_schema.py +169 -0
- circuitkit-0.1.0/src/circuitkit/data/eap_dataset.py +98 -0
- circuitkit-0.1.0/src/circuitkit/data/invariance_groups/__init__.py +33 -0
- circuitkit-0.1.0/src/circuitkit/data/invariance_groups/builder.py +323 -0
- circuitkit-0.1.0/src/circuitkit/data/invariance_groups/schema.py +274 -0
- circuitkit-0.1.0/src/circuitkit/data/normalized.py +259 -0
- circuitkit-0.1.0/src/circuitkit/data/normalized_task.py +594 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/__init__.py +11 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/core/TLACDCCorrespondence.py +263 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/core/TLACDCEdge.py +113 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/core/TLACDCExperiment.py +1052 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/core/TLACDCInterpNode.py +96 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/core/__init__.py +12 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/core/acdc_utils.py +614 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/generation/__init__.py +11 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/generation/cache.py +267 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/generation/manager.py +562 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/generation/utils.py +323 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/storage/__init__.py +18 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/storage/greaterthan/greaterthan_32_ffd33106.json +23 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/storage/ioi/ioi_16_8c879ddb.json +43 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/storage/ioi/ioi_32_a432ca4a.json +43 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/storage/ioi/ioi_500_1f7e7324.json +43 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/storage/ioi/ioi_64_3bba747e.json +43 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/storage/ioi/ioi_64_f4a164db.json +43 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/storage/ioi/ioi_8_e87df42e.json +43 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/__init__.py +10 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/binary_align/generate_binary_align.py +1167 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/binary_align/jailbreak_binary.csv +335 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/binary_align/safe_binary.csv +335 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/capital_country/__init__.py +5 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/capital_country/utils.py +395 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/docstring/__init__.py +5 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/docstring/prompts.py +1175 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/docstring/utils.py +282 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/double_io/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/double_io/double_io_dataset.py +485 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/gender_bias/__init__.py +5 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/gender_bias/utils.py +396 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/gender_bias/utils2.py +143 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/greaterthan/__init__.py +5 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/greaterthan/utils.py +534 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/hypernymy/__init__.py +5 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/hypernymy/utils.py +326 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/induction/__init__.py +5 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/induction/utils.py +222 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/ioi/__init__.py +8 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/ioi/ioi_dataset.py +962 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/ioi/utils.py +656 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/sva/__init__.py +5 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/sva/utils.py +132 -0
- circuitkit-0.1.0/src/circuitkit/data/task_data/tasks/wmdp/wmdp_utils.py +296 -0
- circuitkit-0.1.0/src/circuitkit/data/template.py +392 -0
- circuitkit-0.1.0/src/circuitkit/data/wikitext_calibration.py +164 -0
- circuitkit-0.1.0/src/circuitkit/data/worthiness.py +746 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/__init__.py +83 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/checkpoint_benchmark.py +857 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/evaluate.py +929 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/full.py +556 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/hf_checkpoint.py +1219 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/intervention_faithfulness.py +198 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/lm_eval_simple.py +223 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/lm_harness.py +681 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/master_grid.py +307 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/mmlu_eval.py +208 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/pillars/__init__.py +28 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/pillars/ablation.py +404 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/pillars/baselines.py +902 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/pillars/causal_patching.py +371 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/pillars/generalization.py +623 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/pillars/intervention_reliability.py +325 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/pillars/robustness.py +854 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/pillars/stability.py +571 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/report.py +318 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/reports/__init__.py +20 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/reports/aggregator.py +533 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/reports/robustness_report.py +331 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/reports/stability_report.py +298 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/stability_discovery.py +439 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/transfer.py +510 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/transfer_analysis.py +315 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/transfer_visualizer.py +327 -0
- circuitkit-0.1.0/src/circuitkit/evaluation/weight_based_eval.py +227 -0
- circuitkit-0.1.0/src/circuitkit/pipeline.py +1000 -0
- circuitkit-0.1.0/src/circuitkit/quick.py +1157 -0
- circuitkit-0.1.0/src/circuitkit/selection/__init__.py +54 -0
- circuitkit-0.1.0/src/circuitkit/selection/cdt_selector.py +64 -0
- circuitkit-0.1.0/src/circuitkit/selection/eap_gp_selector.py +67 -0
- circuitkit-0.1.0/src/circuitkit/selection/eap_selector.py +83 -0
- circuitkit-0.1.0/src/circuitkit/selection/gptq_selector.py +164 -0
- circuitkit-0.1.0/src/circuitkit/selection/ibcircuit_selector.py +120 -0
- circuitkit-0.1.0/src/circuitkit/selection/magnitude_selector.py +28 -0
- circuitkit-0.1.0/src/circuitkit/selection/random_selector.py +16 -0
- circuitkit-0.1.0/src/circuitkit/selection/relp_selector.py +66 -0
- circuitkit-0.1.0/src/circuitkit/selection/wanda_selector.py +174 -0
- circuitkit-0.1.0/src/circuitkit/tasks/__init__.py +40 -0
- circuitkit-0.1.0/src/circuitkit/tasks/_algorithm_families.py +106 -0
- circuitkit-0.1.0/src/circuitkit/tasks/_chat.py +262 -0
- circuitkit-0.1.0/src/circuitkit/tasks/auto_schema.py +526 -0
- circuitkit-0.1.0/src/circuitkit/tasks/bootstrap.py +93 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/__init__.py +44 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/boolq.py +501 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/capital_country.py +261 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/double_io.py +380 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/gender_bias.py +284 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/glue.py +683 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/greater_than.py +471 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/gsm8k.py +563 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/hypernymy.py +262 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/ifeval.py +116 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/ioi.py +447 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/ioi_acdc.py +323 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/ioi_legacy.py +473 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/mmlu.py +1578 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/sva.py +257 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/truthfulqa.py +520 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/winogrande.py +647 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/winogrande_mc.py +484 -0
- circuitkit-0.1.0/src/circuitkit/tasks/builtins/wmdp.py +1120 -0
- circuitkit-0.1.0/src/circuitkit/tasks/generic.py +1405 -0
- circuitkit-0.1.0/src/circuitkit/tasks/hf_factory.py +480 -0
- circuitkit-0.1.0/src/circuitkit/tasks/inspect.py +95 -0
- circuitkit-0.1.0/src/circuitkit/tasks/registry.py +72 -0
- circuitkit-0.1.0/src/circuitkit/tasks/safety_datasets.py +139 -0
- circuitkit-0.1.0/src/circuitkit/tasks/specs.py +246 -0
- circuitkit-0.1.0/src/circuitkit/tasks/type_specs/__init__.py +30 -0
- circuitkit-0.1.0/src/circuitkit/tasks/type_specs/classification_spec.py +49 -0
- circuitkit-0.1.0/src/circuitkit/tasks/type_specs/generation_spec.py +47 -0
- circuitkit-0.1.0/src/circuitkit/tasks/type_specs/mcq_spec.py +49 -0
- circuitkit-0.1.0/src/circuitkit/tasks/type_specs/qa_spec.py +129 -0
- circuitkit-0.1.0/src/circuitkit/tasks/type_specs/summarization_spec.py +45 -0
- circuitkit-0.1.0/src/circuitkit/tasks/type_specs/translation_spec.py +45 -0
- circuitkit-0.1.0/src/circuitkit/tasks/validator.py +481 -0
- circuitkit-0.1.0/src/circuitkit/tasks/yaml_loader.py +381 -0
- circuitkit-0.1.0/src/circuitkit/tooling/__init__.py +7 -0
- circuitkit-0.1.0/src/circuitkit/tooling/validate_environment.py +61 -0
- circuitkit-0.1.0/src/circuitkit/utils/__init__.py +0 -0
- circuitkit-0.1.0/src/circuitkit/utils/artifacts.py +39 -0
- circuitkit-0.1.0/src/circuitkit/utils/async_processing.py +371 -0
- circuitkit-0.1.0/src/circuitkit/utils/bootstrap.py +194 -0
- circuitkit-0.1.0/src/circuitkit/utils/config.py +330 -0
- circuitkit-0.1.0/src/circuitkit/utils/corruption_validation.py +369 -0
- circuitkit-0.1.0/src/circuitkit/utils/dataset_cache.py +303 -0
- circuitkit-0.1.0/src/circuitkit/utils/debug.py +345 -0
- circuitkit-0.1.0/src/circuitkit/utils/debugging.py +354 -0
- circuitkit-0.1.0/src/circuitkit/utils/device.py +51 -0
- circuitkit-0.1.0/src/circuitkit/utils/distributed.py +531 -0
- circuitkit-0.1.0/src/circuitkit/utils/exceptions.py +355 -0
- circuitkit-0.1.0/src/circuitkit/utils/logging.py +382 -0
- circuitkit-0.1.0/src/circuitkit/utils/memory.py +191 -0
- circuitkit-0.1.0/src/circuitkit/utils/optimization.py +316 -0
- circuitkit-0.1.0/src/circuitkit/utils/profiling.py +414 -0
- circuitkit-0.1.0/src/circuitkit/utils/token_utils.py +159 -0
- circuitkit-0.1.0/src/circuitkit/visualize/__init__.py +79 -0
- circuitkit-0.1.0/src/circuitkit/visualize/comparison.py +499 -0
- circuitkit-0.1.0/src/circuitkit/visualize/d3_template.py +1064 -0
- circuitkit-0.1.0/src/circuitkit/visualize/editor.py +385 -0
- circuitkit-0.1.0/src/circuitkit/visualize/feature_saliency.py +408 -0
- circuitkit-0.1.0/src/circuitkit/visualize/gallery.py +392 -0
- circuitkit-0.1.0/src/circuitkit/visualize/graph_viz.py +884 -0
- circuitkit-0.1.0/src/circuitkit/visualize/jupyter_suite.py +223 -0
- circuitkit-0.1.0/src/circuitkit/visualize/plotter.py +246 -0
- circuitkit-0.1.0/src/circuitkit/visualize/saliency.py +402 -0
- circuitkit-0.1.0/src/circuitkit/visualize/streamlit_app.py +471 -0
- circuitkit-0.1.0/src/circuitkit/visualize/theme.py +331 -0
- circuitkit-0.1.0/src/circuitkit.egg-info/PKG-INFO +192 -0
- circuitkit-0.1.0/src/circuitkit.egg-info/SOURCES.txt +754 -0
- circuitkit-0.1.0/src/circuitkit.egg-info/dependency_links.txt +1 -0
- circuitkit-0.1.0/src/circuitkit.egg-info/entry_points.txt +2 -0
- circuitkit-0.1.0/src/circuitkit.egg-info/requires.txt +64 -0
- circuitkit-0.1.0/src/circuitkit.egg-info/top_level.txt +1 -0
- circuitkit-0.1.0/tests/__init__.py +1 -0
- circuitkit-0.1.0/tests/apply/__init__.py +1 -0
- circuitkit-0.1.0/tests/apply/conftest.py +105 -0
- circuitkit-0.1.0/tests/apply/debug_memit.py +92 -0
- circuitkit-0.1.0/tests/apply/test_architecture_registry.py +281 -0
- circuitkit-0.1.0/tests/apply/test_benchmark_analysis.py +314 -0
- circuitkit-0.1.0/tests/apply/test_benchmark_peft.py +317 -0
- circuitkit-0.1.0/tests/apply/test_circuit_artifact.py +805 -0
- circuitkit-0.1.0/tests/apply/test_covariance.py +696 -0
- circuitkit-0.1.0/tests/apply/test_cross_architecture.py +523 -0
- circuitkit-0.1.0/tests/apply/test_fine_tune_editing.py +106 -0
- circuitkit-0.1.0/tests/apply/test_hallucination_detection.py +494 -0
- circuitkit-0.1.0/tests/apply/test_knowledge_editing.py +755 -0
- circuitkit-0.1.0/tests/apply/test_knowledge_editing_enhanced.py +381 -0
- circuitkit-0.1.0/tests/apply/test_knowledge_editing_pipeline.py +1866 -0
- circuitkit-0.1.0/tests/apply/test_linear_probe.py +55 -0
- circuitkit-0.1.0/tests/apply/test_peft_methods.py +448 -0
- circuitkit-0.1.0/tests/apply/test_pruner.py +41 -0
- circuitkit-0.1.0/tests/apply/test_steering.py +57 -0
- circuitkit-0.1.0/tests/apply/test_steering_enhanced.py +409 -0
- circuitkit-0.1.0/tests/apply/test_tokenization.py +1302 -0
- circuitkit-0.1.0/tests/apply/test_weight_steering.py +115 -0
- circuitkit-0.1.0/tests/backends/ibcircuit/test_ib_noise.py +186 -0
- circuitkit-0.1.0/tests/backends/ibcircuit/test_ib_utils.py +554 -0
- circuitkit-0.1.0/tests/backends/ibcircuit/test_model_wrapper.py +351 -0
- circuitkit-0.1.0/tests/backends/ibcircuit/test_trainer.py +480 -0
- circuitkit-0.1.0/tests/backends/test_artifact_export_integration.py +362 -0
- circuitkit-0.1.0/tests/benchmarks/test_baselines.py +254 -0
- circuitkit-0.1.0/tests/benchmarks/test_benchmark.py +345 -0
- circuitkit-0.1.0/tests/conftest.py +71 -0
- circuitkit-0.1.0/tests/corruption/__init__.py +1 -0
- circuitkit-0.1.0/tests/corruption/run_corruption_tests.py +273 -0
- circuitkit-0.1.0/tests/corruption/test_distractor.py +498 -0
- circuitkit-0.1.0/tests/corruption/test_effectiveness.py +372 -0
- circuitkit-0.1.0/tests/corruption/test_entity_swap.py +372 -0
- circuitkit-0.1.0/tests/corruption/test_new_corruptions.py +395 -0
- circuitkit-0.1.0/tests/corruption/test_paraphrase.py +476 -0
- circuitkit-0.1.0/tests/corruption/test_pipeline.py +374 -0
- circuitkit-0.1.0/tests/corruption/test_pipeline_integration_ioi.py +419 -0
- circuitkit-0.1.0/tests/corruption/test_practical_examples.py +372 -0
- circuitkit-0.1.0/tests/corruption/test_role_swap.py +542 -0
- circuitkit-0.1.0/tests/corruption/test_strategies_integration.py +324 -0
- circuitkit-0.1.0/tests/corruption/test_strategies_standalone.py +351 -0
- circuitkit-0.1.0/tests/corruption/test_template.py +346 -0
- circuitkit-0.1.0/tests/corruption/test_template_utils.py +243 -0
- circuitkit-0.1.0/tests/corruption/test_token_swap.py +402 -0
- circuitkit-0.1.0/tests/corruption/test_validators.py +558 -0
- circuitkit-0.1.0/tests/data/test_data_corruption_strategies.py +608 -0
- circuitkit-0.1.0/tests/integration/test_chat_template_instruct.py +155 -0
- circuitkit-0.1.0/tests/integration/test_interfaces_e2e.py +78 -0
- circuitkit-0.1.0/tests/integration/test_soft_healing_integration.py +290 -0
- circuitkit-0.1.0/tests/integration/test_steering_ioi.py +282 -0
- circuitkit-0.1.0/tests/integration/test_template_e2e.py +508 -0
- circuitkit-0.1.0/tests/integration/test_transfer_integration.py +512 -0
- circuitkit-0.1.0/tests/integration/test_transfer_matrix.py +376 -0
- circuitkit-0.1.0/tests/integration/test_transfer_minimal.py +439 -0
- circuitkit-0.1.0/tests/integration/verify_implementation.py +122 -0
- circuitkit-0.1.0/tests/integration/verify_implementation_standalone.py +132 -0
- circuitkit-0.1.0/tests/regression/__init__.py +0 -0
- circuitkit-0.1.0/tests/regression/test_cdt_nonzero_scores.py +105 -0
- circuitkit-0.1.0/tests/regression/test_circuit_tuner_training.py +106 -0
- circuitkit-0.1.0/tests/regression/test_cli_and_api_args.py +143 -0
- circuitkit-0.1.0/tests/regression/test_data_adapters_and_utils.py +136 -0
- circuitkit-0.1.0/tests/regression/test_greater_than_tokenizer.py +99 -0
- circuitkit-0.1.0/tests/regression/test_pruner_gqa_kv_head.py +120 -0
- circuitkit-0.1.0/tests/regression/test_steering_and_baselines.py +138 -0
- circuitkit-0.1.0/tests/release/test_release.py +170 -0
- circuitkit-0.1.0/tests/tasks/__init__.py +0 -0
- circuitkit-0.1.0/tests/tasks/test_auto_schema.py +532 -0
- circuitkit-0.1.0/tests/tasks/test_capital_country.py +217 -0
- circuitkit-0.1.0/tests/tasks/test_chat_template.py +154 -0
- circuitkit-0.1.0/tests/tasks/test_generic_task.py +704 -0
- circuitkit-0.1.0/tests/tasks/test_glue.py +304 -0
- circuitkit-0.1.0/tests/tasks/test_greater_than_corruption.py +212 -0
- circuitkit-0.1.0/tests/tasks/test_gsm8k.py +191 -0
- circuitkit-0.1.0/tests/tasks/test_ioi_regression.py +275 -0
- circuitkit-0.1.0/tests/tasks/test_validator.py +466 -0
- circuitkit-0.1.0/tests/tasks/test_winogrande.py +305 -0
- circuitkit-0.1.0/tests/tasks/test_winogrande_mc.py +233 -0
- circuitkit-0.1.0/tests/test_custom_data.py +2819 -0
- circuitkit-0.1.0/tests/unit/__init__.py +1 -0
- circuitkit-0.1.0/tests/unit/conftest.py +159 -0
- circuitkit-0.1.0/tests/unit/sample_pipeline.yaml +18 -0
- circuitkit-0.1.0/tests/unit/test_api.py +1496 -0
- circuitkit-0.1.0/tests/unit/test_attribute.py +267 -0
- circuitkit-0.1.0/tests/unit/test_attribute_node.py +378 -0
- circuitkit-0.1.0/tests/unit/test_baselines_multidraw.py +116 -0
- circuitkit-0.1.0/tests/unit/test_bootstrap.py +211 -0
- circuitkit-0.1.0/tests/unit/test_circuit.py +403 -0
- circuitkit-0.1.0/tests/unit/test_circuit_kit_adapter.py +284 -0
- circuitkit-0.1.0/tests/unit/test_circuit_scores.py +300 -0
- circuitkit-0.1.0/tests/unit/test_cli.py +65 -0
- circuitkit-0.1.0/tests/unit/test_cli_commands.py +178 -0
- circuitkit-0.1.0/tests/unit/test_cli_smoke.py +59 -0
- circuitkit-0.1.0/tests/unit/test_config_defaults.py +170 -0
- circuitkit-0.1.0/tests/unit/test_d5_d7_import.py +246 -0
- circuitkit-0.1.0/tests/unit/test_double_io.py +794 -0
- circuitkit-0.1.0/tests/unit/test_end_to_end.py +234 -0
- circuitkit-0.1.0/tests/unit/test_evaluate.py +768 -0
- circuitkit-0.1.0/tests/unit/test_extended_schema.py +212 -0
- circuitkit-0.1.0/tests/unit/test_finetune_utils.py +235 -0
- circuitkit-0.1.0/tests/unit/test_graph.py +341 -0
- circuitkit-0.1.0/tests/unit/test_graph_viz.py +421 -0
- circuitkit-0.1.0/tests/unit/test_graph_viz_standalone.py +420 -0
- circuitkit-0.1.0/tests/unit/test_hf_checkpoint.py +368 -0
- circuitkit-0.1.0/tests/unit/test_init_exports.py +202 -0
- circuitkit-0.1.0/tests/unit/test_instruction_swap_audit.py +42 -0
- circuitkit-0.1.0/tests/unit/test_mean_activations.py +143 -0
- circuitkit-0.1.0/tests/unit/test_mlp1.py +68 -0
- circuitkit-0.1.0/tests/unit/test_modules_exist.py +185 -0
- circuitkit-0.1.0/tests/unit/test_multi_token_answers.py +392 -0
- circuitkit-0.1.0/tests/unit/test_multi_token_unit.py +363 -0
- circuitkit-0.1.0/tests/unit/test_neuron_pruner.py +115 -0
- circuitkit-0.1.0/tests/unit/test_no_regressions.py +231 -0
- circuitkit-0.1.0/tests/unit/test_node_pruner.py +185 -0
- circuitkit-0.1.0/tests/unit/test_normalized_task.py +178 -0
- circuitkit-0.1.0/tests/unit/test_paraphrase_direct.py +233 -0
- circuitkit-0.1.0/tests/unit/test_perplexity_direct.py +294 -0
- circuitkit-0.1.0/tests/unit/test_perplexity_metric.py +432 -0
- circuitkit-0.1.0/tests/unit/test_perplexity_metric_simple.py +437 -0
- circuitkit-0.1.0/tests/unit/test_pillars.py +2614 -0
- circuitkit-0.1.0/tests/unit/test_pipeline_smoke.py +184 -0
- circuitkit-0.1.0/tests/unit/test_pipeline_unit.py +531 -0
- circuitkit-0.1.0/tests/unit/test_quantize_export_flow.py +167 -0
- circuitkit-0.1.0/tests/unit/test_quick_api.py +536 -0
- circuitkit-0.1.0/tests/unit/test_quick_extensions.py +381 -0
- circuitkit-0.1.0/tests/unit/test_r2_effect_magnitude.py +34 -0
- circuitkit-0.1.0/tests/unit/test_ranking_metrics.py +560 -0
- circuitkit-0.1.0/tests/unit/test_report.py +369 -0
- circuitkit-0.1.0/tests/unit/test_score_loader.py +692 -0
- circuitkit-0.1.0/tests/unit/test_security_hardening.py +119 -0
- circuitkit-0.1.0/tests/unit/test_selector.py +220 -0
- circuitkit-0.1.0/tests/unit/test_selector_bugs.py +97 -0
- circuitkit-0.1.0/tests/unit/test_selector_registry.py +145 -0
- circuitkit-0.1.0/tests/unit/test_soft_healing.py +352 -0
- circuitkit-0.1.0/tests/unit/test_stability_robustness_reports.py +477 -0
- circuitkit-0.1.0/tests/unit/test_steering.py +529 -0
- circuitkit-0.1.0/tests/unit/test_structural_pruner.py +353 -0
- circuitkit-0.1.0/tests/unit/test_tokenize_warning_throttle.py +86 -0
- circuitkit-0.1.0/tests/unit/test_validators_direct.py +171 -0
- circuitkit-0.1.0/tests/unit/test_validators_standalone.py +171 -0
- circuitkit-0.1.0/tests/unit/test_yaml_pipeline_config.py +307 -0
- circuitkit-0.1.0/tests/unit/test_yaml_run_cli.py +255 -0
- circuitkit-0.1.0/tests/visualize/__init__.py +1 -0
- circuitkit-0.1.0/tests/visualize/test_comparison.py +321 -0
- circuitkit-0.1.0/tests/visualize/test_editor.py +282 -0
- circuitkit-0.1.0/tests/visualize/test_feature_saliency.py +219 -0
- circuitkit-0.1.0/tests/visualize/test_gallery.py +309 -0
- circuitkit-0.1.0/tests/visualize/test_jupyter_suite.py +359 -0
- circuitkit-0.1.0/tests/visualize/test_saliency.py +236 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, cust_data]
|
|
6
|
+
paths:
|
|
7
|
+
- "docs/**"
|
|
8
|
+
- "mkdocs.yml"
|
|
9
|
+
- "src/circuitkit/**"
|
|
10
|
+
- ".github/workflows/docs.yml"
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [main]
|
|
13
|
+
paths:
|
|
14
|
+
- "docs/**"
|
|
15
|
+
- "mkdocs.yml"
|
|
16
|
+
- "src/circuitkit/**"
|
|
17
|
+
workflow_dispatch:
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: write
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build:
|
|
24
|
+
name: Build docs
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
with:
|
|
29
|
+
fetch-depth: 0
|
|
30
|
+
|
|
31
|
+
- uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.11"
|
|
34
|
+
|
|
35
|
+
- uses: actions/cache@v4
|
|
36
|
+
with:
|
|
37
|
+
path: ~/.cache/pip
|
|
38
|
+
key: docs-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
|
|
39
|
+
restore-keys: docs-${{ runner.os }}-
|
|
40
|
+
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: pip install ".[docs]"
|
|
43
|
+
|
|
44
|
+
- name: Build
|
|
45
|
+
run: mkdocs build --strict --clean
|
|
46
|
+
|
|
47
|
+
- name: Upload site artifact
|
|
48
|
+
uses: actions/upload-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: site
|
|
51
|
+
path: site/
|
|
52
|
+
retention-days: 3
|
|
53
|
+
|
|
54
|
+
deploy:
|
|
55
|
+
name: Deploy to GitHub Pages
|
|
56
|
+
needs: build
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
if: >
|
|
59
|
+
github.event_name == 'push' &&
|
|
60
|
+
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/cust_data')
|
|
61
|
+
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v4
|
|
64
|
+
with:
|
|
65
|
+
fetch-depth: 0
|
|
66
|
+
|
|
67
|
+
- uses: actions/setup-python@v5
|
|
68
|
+
with:
|
|
69
|
+
python-version: "3.11"
|
|
70
|
+
|
|
71
|
+
- uses: actions/cache@v4
|
|
72
|
+
with:
|
|
73
|
+
path: ~/.cache/pip
|
|
74
|
+
key: docs-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
|
|
75
|
+
restore-keys: docs-${{ runner.os }}-
|
|
76
|
+
|
|
77
|
+
- name: Install dependencies
|
|
78
|
+
run: pip install ".[docs]"
|
|
79
|
+
|
|
80
|
+
- name: Deploy
|
|
81
|
+
run: mkdocs gh-deploy --force --clean
|
|
82
|
+
env:
|
|
83
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
name: Automated patch release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
branches: [main]
|
|
6
|
+
types: [closed]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: circuitkit-patch-release
|
|
11
|
+
cancel-in-progress: false
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
pull-requests: read
|
|
16
|
+
|
|
17
|
+
env:
|
|
18
|
+
PYPI_PROJECT_NAME: circuitkit
|
|
19
|
+
PACKAGE_DISPLAY_NAME: CircuitKit
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
plan:
|
|
23
|
+
name: Inspect release state
|
|
24
|
+
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
outputs:
|
|
27
|
+
action: ${{ steps.plan.outputs.action }}
|
|
28
|
+
version: ${{ steps.plan.outputs.version }}
|
|
29
|
+
state: ${{ steps.plan.outputs.state }}
|
|
30
|
+
reason: ${{ steps.plan.outputs.reason }}
|
|
31
|
+
source-ref: ${{ steps.plan.outputs.source-ref }}
|
|
32
|
+
tag-exists: ${{ steps.plan.outputs.tag-exists }}
|
|
33
|
+
release-exists: ${{ steps.plan.outputs.release-exists }}
|
|
34
|
+
pypi-exists: ${{ steps.plan.outputs.pypi-exists }}
|
|
35
|
+
steps:
|
|
36
|
+
- name: Check out the trusted merged source
|
|
37
|
+
uses: actions/checkout@v6
|
|
38
|
+
with:
|
|
39
|
+
ref: ${{ github.event.pull_request.merge_commit_sha || github.ref }}
|
|
40
|
+
fetch-depth: 0
|
|
41
|
+
persist-credentials: false
|
|
42
|
+
|
|
43
|
+
- uses: actions/setup-python@v6
|
|
44
|
+
with:
|
|
45
|
+
python-version: "3.12"
|
|
46
|
+
|
|
47
|
+
- name: Classify trigger and external release state
|
|
48
|
+
id: plan
|
|
49
|
+
env:
|
|
50
|
+
GH_TOKEN: ${{ github.token }}
|
|
51
|
+
EVENT_NAME: ${{ github.event_name }}
|
|
52
|
+
PR_HEAD: ${{ github.event.pull_request.head.ref }}
|
|
53
|
+
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
54
|
+
PR_BODY: ${{ github.event.pull_request.body }}
|
|
55
|
+
shell: bash
|
|
56
|
+
run: |
|
|
57
|
+
set -euo pipefail
|
|
58
|
+
current_version=$(python scripts/release.py current-version)
|
|
59
|
+
source_sha=$(git rev-parse HEAD)
|
|
60
|
+
trigger=dispatch
|
|
61
|
+
requested_version=$current_version
|
|
62
|
+
|
|
63
|
+
if [[ "$EVENT_NAME" == "pull_request_target" ]]; then
|
|
64
|
+
generated_version=$(python scripts/release.py generated-version \
|
|
65
|
+
--head "$PR_HEAD" --title "$PR_TITLE" --body "$PR_BODY")
|
|
66
|
+
if [[ -n "$generated_version" ]]; then
|
|
67
|
+
trigger=generated
|
|
68
|
+
requested_version=$generated_version
|
|
69
|
+
python scripts/release.py validate-version "$requested_version"
|
|
70
|
+
else
|
|
71
|
+
trigger=normal
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
tag_exists=false
|
|
76
|
+
tag_annotated=true
|
|
77
|
+
tag_matches_source=true
|
|
78
|
+
source_ref=$source_sha
|
|
79
|
+
if git show-ref --verify --quiet "refs/tags/$requested_version"; then
|
|
80
|
+
tag_exists=true
|
|
81
|
+
source_ref="refs/tags/$requested_version"
|
|
82
|
+
if [[ "$(git cat-file -t "$requested_version")" != "tag" ]]; then
|
|
83
|
+
tag_annotated=false
|
|
84
|
+
fi
|
|
85
|
+
tag_sha=$(git rev-list -n 1 "$requested_version")
|
|
86
|
+
if [[ "$trigger" == "generated" && "$tag_sha" != "$source_sha" ]]; then
|
|
87
|
+
tag_matches_source=false
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
version_tree=$(mktemp -d)
|
|
91
|
+
mkdir -p "$version_tree/src/circuitkit" "$version_tree/scripts"
|
|
92
|
+
cp scripts/release.py "$version_tree/scripts/release.py"
|
|
93
|
+
for version_file in pyproject.toml src/circuitkit/__init__.py CITATION.cff; do
|
|
94
|
+
git show "$requested_version:$version_file" > "$version_tree/$version_file"
|
|
95
|
+
done
|
|
96
|
+
if ! (cd "$version_tree" && python scripts/release.py validate-version "$requested_version"); then
|
|
97
|
+
tag_matches_source=false
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
release_response=$(mktemp)
|
|
102
|
+
release_status=$(curl --silent --show-error --location \
|
|
103
|
+
--header "Authorization: Bearer $GH_TOKEN" \
|
|
104
|
+
--header "Accept: application/vnd.github+json" \
|
|
105
|
+
--output "$release_response" --write-out '%{http_code}' \
|
|
106
|
+
"https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$requested_version")
|
|
107
|
+
release_exists=false
|
|
108
|
+
release_matches_tag=true
|
|
109
|
+
if [[ "$release_status" == "200" ]]; then
|
|
110
|
+
release_exists=true
|
|
111
|
+
if ! python - "$release_response" "$requested_version" <<'PY'
|
|
112
|
+
import json
|
|
113
|
+
import sys
|
|
114
|
+
|
|
115
|
+
release = json.load(open(sys.argv[1], encoding="utf-8"))
|
|
116
|
+
expected = sys.argv[2]
|
|
117
|
+
valid = (
|
|
118
|
+
release.get("tag_name") == expected
|
|
119
|
+
and release.get("name") == expected
|
|
120
|
+
and release.get("draft") is False
|
|
121
|
+
and release.get("prerelease") is False
|
|
122
|
+
)
|
|
123
|
+
raise SystemExit(0 if valid else 1)
|
|
124
|
+
PY
|
|
125
|
+
then
|
|
126
|
+
release_matches_tag=false
|
|
127
|
+
fi
|
|
128
|
+
elif [[ "$release_status" != "404" ]]; then
|
|
129
|
+
echo "::error::GitHub release lookup failed with HTTP $release_status."
|
|
130
|
+
exit 1
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
pypi_response=$(mktemp)
|
|
134
|
+
pypi_status=$(curl --silent --show-error --location \
|
|
135
|
+
--output "$pypi_response" --write-out '%{http_code}' \
|
|
136
|
+
"https://pypi.org/pypi/$PYPI_PROJECT_NAME/$requested_version/json")
|
|
137
|
+
pypi_exists=false
|
|
138
|
+
if [[ "$pypi_status" == "200" ]]; then
|
|
139
|
+
pypi_exists=true
|
|
140
|
+
python - "$pypi_response" "$requested_version" <<'PY'
|
|
141
|
+
import json
|
|
142
|
+
import sys
|
|
143
|
+
|
|
144
|
+
payload = json.load(open(sys.argv[1], encoding="utf-8"))
|
|
145
|
+
if payload.get("info", {}).get("version") != sys.argv[2]:
|
|
146
|
+
raise SystemExit("PyPI returned metadata for an unexpected version")
|
|
147
|
+
PY
|
|
148
|
+
elif [[ "$pypi_status" != "404" ]]; then
|
|
149
|
+
echo "::error::PyPI lookup failed with HTTP $pypi_status."
|
|
150
|
+
exit 1
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
open_bump_pr=false
|
|
154
|
+
if [[ "$trigger" == "normal" && "$tag_exists" == "true" \
|
|
155
|
+
&& "$release_exists" == "true" && "$pypi_exists" == "true" ]]; then
|
|
156
|
+
open_prs=$(mktemp)
|
|
157
|
+
gh pr list --state open --limit 100 --json headRefName,title,body > "$open_prs"
|
|
158
|
+
open_bump_pr=$(python - "$open_prs" "$current_version" <<'PY'
|
|
159
|
+
import json
|
|
160
|
+
import sys
|
|
161
|
+
|
|
162
|
+
from scripts.release import BUMP_MARKER, generated_bump_version, next_patch
|
|
163
|
+
|
|
164
|
+
pull_requests = json.load(open(sys.argv[1], encoding="utf-8"))
|
|
165
|
+
candidates = [
|
|
166
|
+
pr for pr in pull_requests
|
|
167
|
+
if pr["headRefName"].startswith("release/bump-")
|
|
168
|
+
or pr["title"].startswith("[release] Bump version to ")
|
|
169
|
+
or BUMP_MARKER in (pr.get("body") or "")
|
|
170
|
+
]
|
|
171
|
+
if len(candidates) > 1:
|
|
172
|
+
raise SystemExit("Multiple open version-bump PRs require manual repair")
|
|
173
|
+
if not candidates:
|
|
174
|
+
print("false")
|
|
175
|
+
else:
|
|
176
|
+
pr = candidates[0]
|
|
177
|
+
version = generated_bump_version(pr["headRefName"], pr["title"], pr.get("body") or "")
|
|
178
|
+
expected = next_patch(sys.argv[2])
|
|
179
|
+
if version != expected:
|
|
180
|
+
raise SystemExit(f"Open bump PR targets {version}, expected {expected}")
|
|
181
|
+
print("true")
|
|
182
|
+
PY
|
|
183
|
+
)
|
|
184
|
+
fi
|
|
185
|
+
|
|
186
|
+
decision=$(python scripts/release.py plan \
|
|
187
|
+
--trigger "$trigger" --version "$requested_version" \
|
|
188
|
+
--tag "$tag_exists" --release "$release_exists" --pypi "$pypi_exists" \
|
|
189
|
+
--tag-annotated "$tag_annotated" \
|
|
190
|
+
--tag-matches-source "$tag_matches_source" \
|
|
191
|
+
--release-matches-tag "$release_matches_tag" \
|
|
192
|
+
--open-bump-pr "$open_bump_pr")
|
|
193
|
+
|
|
194
|
+
action=$(python -c 'import json,sys; print(json.loads(sys.argv[1])["action"])' "$decision")
|
|
195
|
+
version=$(python -c 'import json,sys; print(json.loads(sys.argv[1])["version"])' "$decision")
|
|
196
|
+
state=$(python -c 'import json,sys; print(json.loads(sys.argv[1])["state"])' "$decision")
|
|
197
|
+
reason=$(python -c 'import json,sys; print(json.loads(sys.argv[1])["reason"])' "$decision")
|
|
198
|
+
{
|
|
199
|
+
echo "action=$action"
|
|
200
|
+
echo "version=$version"
|
|
201
|
+
echo "state=$state"
|
|
202
|
+
echo "reason=$reason"
|
|
203
|
+
echo "source-ref=$source_ref"
|
|
204
|
+
echo "tag-exists=$tag_exists"
|
|
205
|
+
echo "release-exists=$release_exists"
|
|
206
|
+
echo "pypi-exists=$pypi_exists"
|
|
207
|
+
} >> "$GITHUB_OUTPUT"
|
|
208
|
+
echo "Release decision: action=$action version=$version state=$state reason=$reason"
|
|
209
|
+
|
|
210
|
+
bump:
|
|
211
|
+
name: Open patch-version pull request
|
|
212
|
+
needs: plan
|
|
213
|
+
if: needs.plan.outputs.action == 'bump'
|
|
214
|
+
runs-on: ubuntu-latest
|
|
215
|
+
permissions:
|
|
216
|
+
contents: read
|
|
217
|
+
pull-requests: read
|
|
218
|
+
steps:
|
|
219
|
+
- name: Check out default branch
|
|
220
|
+
uses: actions/checkout@v6
|
|
221
|
+
with:
|
|
222
|
+
ref: main
|
|
223
|
+
fetch-depth: 0
|
|
224
|
+
persist-credentials: false
|
|
225
|
+
|
|
226
|
+
- uses: actions/setup-python@v6
|
|
227
|
+
with:
|
|
228
|
+
python-version: "3.12"
|
|
229
|
+
|
|
230
|
+
- name: Create or resume version-bump branch and PR
|
|
231
|
+
env:
|
|
232
|
+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
|
233
|
+
NEXT_VERSION: ${{ needs.plan.outputs.version }}
|
|
234
|
+
shell: bash
|
|
235
|
+
run: |
|
|
236
|
+
set -euo pipefail
|
|
237
|
+
if [[ -z "$PERSONAL_ACCESS_TOKEN" ]]; then
|
|
238
|
+
echo "::error::PERSONAL_ACCESS_TOKEN is required to push the bump branch and open its PR."
|
|
239
|
+
exit 1
|
|
240
|
+
fi
|
|
241
|
+
branch="release/bump-$NEXT_VERSION"
|
|
242
|
+
base_sha=$(git rev-parse HEAD)
|
|
243
|
+
expected_files=$'CITATION.cff\npyproject.toml\nsrc/circuitkit/__init__.py'
|
|
244
|
+
|
|
245
|
+
if git ls-remote --exit-code --heads origin "refs/heads/$branch" >/dev/null 2>&1; then
|
|
246
|
+
git fetch origin "refs/heads/$branch:refs/remotes/origin/release-bump"
|
|
247
|
+
branch_sha=$(git rev-parse refs/remotes/origin/release-bump)
|
|
248
|
+
branch_parent=$(git rev-parse "$branch_sha^")
|
|
249
|
+
if [[ "$branch_parent" != "$base_sha" ]]; then
|
|
250
|
+
echo "::error::Existing $branch is not based on the expected default-branch commit."
|
|
251
|
+
exit 1
|
|
252
|
+
fi
|
|
253
|
+
git switch --detach "$branch_sha"
|
|
254
|
+
python scripts/release.py validate-version "$NEXT_VERSION"
|
|
255
|
+
actual_files=$(git diff-tree --no-commit-id --name-only -r "$branch_sha" | sort)
|
|
256
|
+
if [[ "$actual_files" != "$expected_files" ]]; then
|
|
257
|
+
echo "::error::Existing bump branch changes files outside the authoritative version set."
|
|
258
|
+
exit 1
|
|
259
|
+
fi
|
|
260
|
+
else
|
|
261
|
+
git switch -c "$branch"
|
|
262
|
+
python scripts/release.py set-version "$NEXT_VERSION"
|
|
263
|
+
actual_files=$(git diff --name-only | sort)
|
|
264
|
+
if [[ "$actual_files" != "$expected_files" ]]; then
|
|
265
|
+
echo "::error::Version helper changed an unexpected set of files."
|
|
266
|
+
exit 1
|
|
267
|
+
fi
|
|
268
|
+
git config user.name github-actions[bot]
|
|
269
|
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
270
|
+
git add CITATION.cff pyproject.toml src/circuitkit/__init__.py
|
|
271
|
+
git commit -m "Bump version to $NEXT_VERSION"
|
|
272
|
+
basic_auth=$(printf 'x-access-token:%s' "$PERSONAL_ACCESS_TOKEN" | base64 -w0)
|
|
273
|
+
git -c "http.extraheader=AUTHORIZATION: basic $basic_auth" \
|
|
274
|
+
push "https://github.com/$GITHUB_REPOSITORY.git" "HEAD:refs/heads/$branch"
|
|
275
|
+
unset basic_auth
|
|
276
|
+
fi
|
|
277
|
+
|
|
278
|
+
GH_TOKEN="$PERSONAL_ACCESS_TOKEN" gh pr create --base main --head "$branch" \
|
|
279
|
+
--title "[release] Bump version to $NEXT_VERSION" \
|
|
280
|
+
--body "$(printf '%s\n\n%s\n' \
|
|
281
|
+
'<!-- circuitkit-version-bump -->' \
|
|
282
|
+
"Automated patch-version bump to \`$NEXT_VERSION\`. Merging this PR starts the release.")"
|
|
283
|
+
|
|
284
|
+
release:
|
|
285
|
+
name: Build, release, and publish
|
|
286
|
+
needs: plan
|
|
287
|
+
if: needs.plan.outputs.action == 'release'
|
|
288
|
+
runs-on: ubuntu-latest
|
|
289
|
+
permissions:
|
|
290
|
+
contents: write
|
|
291
|
+
env:
|
|
292
|
+
RELEASE_TAG: ${{ needs.plan.outputs.version }}
|
|
293
|
+
steps:
|
|
294
|
+
- name: Check out exact release source
|
|
295
|
+
uses: actions/checkout@v6
|
|
296
|
+
with:
|
|
297
|
+
ref: ${{ needs.plan.outputs.source-ref }}
|
|
298
|
+
fetch-depth: 0
|
|
299
|
+
|
|
300
|
+
- uses: actions/setup-python@v6
|
|
301
|
+
with:
|
|
302
|
+
python-version: "3.12"
|
|
303
|
+
|
|
304
|
+
- name: Validate source version
|
|
305
|
+
run: python scripts/release.py validate-version "$RELEASE_TAG"
|
|
306
|
+
|
|
307
|
+
# Tests are intentionally skipped in the release workflow to avoid delaying (taking more than 6hours)
|
|
308
|
+
# GitHub releases and PyPI publication.
|
|
309
|
+
# - name: Install project test dependencies
|
|
310
|
+
# continue-on-error: true
|
|
311
|
+
# run: python -m pip install -e ".[dev]"
|
|
312
|
+
|
|
313
|
+
# - name: Run project test suite (advisory)
|
|
314
|
+
# continue-on-error: true
|
|
315
|
+
# run: python -m pytest
|
|
316
|
+
|
|
317
|
+
- name: Install mandatory packaging tools
|
|
318
|
+
run: python -m pip install --upgrade build twine
|
|
319
|
+
|
|
320
|
+
- name: Build and validate distributions
|
|
321
|
+
run: |
|
|
322
|
+
python -m build
|
|
323
|
+
python -m twine check dist/*
|
|
324
|
+
python scripts/release.py validate-dist "$RELEASE_TAG" --project-name "$PYPI_PROJECT_NAME" dist/*
|
|
325
|
+
|
|
326
|
+
- name: Create or verify annotated tag
|
|
327
|
+
env:
|
|
328
|
+
GH_TOKEN: ${{ github.token }}
|
|
329
|
+
shell: bash
|
|
330
|
+
run: |
|
|
331
|
+
set -euo pipefail
|
|
332
|
+
expected_sha=$(git rev-parse HEAD)
|
|
333
|
+
git fetch --force origin "refs/tags/$RELEASE_TAG:refs/tags/$RELEASE_TAG" 2>/dev/null || true
|
|
334
|
+
if git show-ref --verify --quiet "refs/tags/$RELEASE_TAG"; then
|
|
335
|
+
if [[ "$(git cat-file -t "$RELEASE_TAG")" != "tag" ]]; then
|
|
336
|
+
echo "::error::Existing $RELEASE_TAG is not an annotated tag."
|
|
337
|
+
exit 1
|
|
338
|
+
fi
|
|
339
|
+
if [[ "$(git rev-list -n 1 "$RELEASE_TAG")" != "$expected_sha" ]]; then
|
|
340
|
+
echo "::error::Existing $RELEASE_TAG points at a different commit; it will not be moved."
|
|
341
|
+
exit 1
|
|
342
|
+
fi
|
|
343
|
+
else
|
|
344
|
+
git config user.name github-actions[bot]
|
|
345
|
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
346
|
+
git tag --annotate "$RELEASE_TAG" --message "CircuitKit $RELEASE_TAG"
|
|
347
|
+
git push origin "refs/tags/$RELEASE_TAG"
|
|
348
|
+
fi
|
|
349
|
+
|
|
350
|
+
- name: Create or verify GitHub release
|
|
351
|
+
env:
|
|
352
|
+
GH_TOKEN: ${{ github.token }}
|
|
353
|
+
shell: bash
|
|
354
|
+
run: |
|
|
355
|
+
set -euo pipefail
|
|
356
|
+
if gh release view "$RELEASE_TAG" --json tagName,name,isDraft,isPrerelease > release.json 2>/dev/null; then
|
|
357
|
+
python - "$RELEASE_TAG" <<'PY'
|
|
358
|
+
import json
|
|
359
|
+
import sys
|
|
360
|
+
|
|
361
|
+
release = json.load(open("release.json", encoding="utf-8"))
|
|
362
|
+
expected = sys.argv[1]
|
|
363
|
+
if release != {
|
|
364
|
+
"isDraft": False,
|
|
365
|
+
"isPrerelease": False,
|
|
366
|
+
"name": expected,
|
|
367
|
+
"tagName": expected,
|
|
368
|
+
}:
|
|
369
|
+
raise SystemExit(f"Existing GitHub release conflicts with {expected}: {release}")
|
|
370
|
+
PY
|
|
371
|
+
else
|
|
372
|
+
gh release create "$RELEASE_TAG" --verify-tag --generate-notes --title "$RELEASE_TAG"
|
|
373
|
+
fi
|
|
374
|
+
|
|
375
|
+
- name: Publish the exact distributions to PyPI
|
|
376
|
+
if: needs.plan.outputs.pypi-exists == 'false'
|
|
377
|
+
env:
|
|
378
|
+
TWINE_USERNAME: __token__
|
|
379
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
380
|
+
shell: bash
|
|
381
|
+
run: |
|
|
382
|
+
set -euo pipefail
|
|
383
|
+
: "${TWINE_PASSWORD:?PYPI_API_TOKEN is required to publish the release}"
|
|
384
|
+
python -m twine upload --non-interactive --verbose dist/*
|
|
385
|
+
|
|
386
|
+
- name: Verify exact version on PyPI
|
|
387
|
+
shell: bash
|
|
388
|
+
run: |
|
|
389
|
+
set -euo pipefail
|
|
390
|
+
for attempt in 1 2 3 4 5; do
|
|
391
|
+
if python - "$PYPI_PROJECT_NAME" "$RELEASE_TAG" <<'PY'
|
|
392
|
+
import json
|
|
393
|
+
import sys
|
|
394
|
+
import urllib.error
|
|
395
|
+
import urllib.request
|
|
396
|
+
|
|
397
|
+
url = f"https://pypi.org/pypi/{sys.argv[1]}/{sys.argv[2]}/json"
|
|
398
|
+
try:
|
|
399
|
+
with urllib.request.urlopen(url, timeout=20) as response:
|
|
400
|
+
payload = json.load(response)
|
|
401
|
+
except (urllib.error.URLError, TimeoutError):
|
|
402
|
+
raise SystemExit(1)
|
|
403
|
+
raise SystemExit(0 if payload.get("info", {}).get("version") == sys.argv[2] else 1)
|
|
404
|
+
PY
|
|
405
|
+
then
|
|
406
|
+
exit 0
|
|
407
|
+
fi
|
|
408
|
+
sleep 10
|
|
409
|
+
done
|
|
410
|
+
echo "::error::PyPI did not return exact version $RELEASE_TAG after publication."
|
|
411
|
+
exit 1
|
|
412
|
+
|
|
413
|
+
- name: Send release notes to Slack
|
|
414
|
+
uses: slackapi/slack-github-action@v1.24.0
|
|
415
|
+
continue-on-error: true
|
|
416
|
+
with:
|
|
417
|
+
channel-id: "lexsi-labs-circuitkit-release" #${{ vars.SLACK_CHANNEL }}
|
|
418
|
+
payload: |
|
|
419
|
+
{
|
|
420
|
+
"text": "CircuitKit release",
|
|
421
|
+
"blocks": [
|
|
422
|
+
{
|
|
423
|
+
"type": "section",
|
|
424
|
+
"text": {
|
|
425
|
+
"type": "mrkdwn",
|
|
426
|
+
"text": "*Version:* ${{ env.RELEASE_TAG }}"
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"type": "section",
|
|
431
|
+
"text": {
|
|
432
|
+
"type": "mrkdwn",
|
|
433
|
+
"text": "*Release:* https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }}"
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"type": "section",
|
|
438
|
+
"text": {
|
|
439
|
+
"type": "mrkdwn",
|
|
440
|
+
"text": "*PyPI:* https://pypi.org/project/circuitkit/${{ env.RELEASE_TAG }}/"
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
env:
|
|
446
|
+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
447
|
+
|
|
448
|
+
complete:
|
|
449
|
+
name: Report no-op rerun
|
|
450
|
+
needs: plan
|
|
451
|
+
if: needs.plan.outputs.action == 'noop'
|
|
452
|
+
runs-on: ubuntu-latest
|
|
453
|
+
steps:
|
|
454
|
+
- run: echo "No release mutation is needed - ${{ needs.plan.outputs.reason }}."
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Lexsi Labs Source Available License (LSAL) – Version 1.1 (CircuitKit)
|
|
2
|
+
|
|
3
|
+
## Preamble
|
|
4
|
+
|
|
5
|
+
This Source Available License governs use of the software known as **CircuitKit**, together with its example datasets, notebooks, and documentation (collectively, the "Licensed Work"), developed and owned by **Lexsi Labs (Lithasa Technologies Pvt. Ltd.)** ("Licensor").
|
|
6
|
+
|
|
7
|
+
This is **not** an open-source license as defined by the [Open Source Initiative (OSI)](https://opensource.org/). It grants broad, free access to the source code and artifacts for **research, evaluation, education, and audit**, while restricting commercial exploitation and unsafe use. These restrictions are deliberate: the Licensed Work locates and manipulates the internal circuits of language models, including safety-relevant behaviors, and its value lies in reproducible research and auditing, not in unreviewed production deployment or the removal of model safeguards.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Grant of Rights
|
|
12
|
+
|
|
13
|
+
Subject to the terms of this License, permission is hereby granted, free of charge, to any person obtaining a copy of the Licensed Work, to use, copy, modify, merge, publish, and redistribute the Licensed Work and derivative works thereof, **for Noncommercial Purposes only**, provided that the above copyright notice, this License, and the Responsible Use conditions (Section 4) are included in full in all copies or substantial portions of the Licensed Work.
|
|
14
|
+
|
|
15
|
+
**Noncommercial Purposes** means:
|
|
16
|
+
|
|
17
|
+
* personal use for research, experimentation, private study, or hobby projects;
|
|
18
|
+
* academic and scholarly research, teaching, and publication (including use in papers, theses, benchmarks, and reproducibility artifacts);
|
|
19
|
+
* internal evaluation, red-teaming, or safety auditing that is not itself a paid product or service;
|
|
20
|
+
* use by charitable organizations, educational institutions, public research organizations, or government bodies for non-revenue-generating purposes.
|
|
21
|
+
|
|
22
|
+
## 2. Commercial Restriction
|
|
23
|
+
|
|
24
|
+
Without a separate **commercial license** from Lexsi Labs, you may **not** Sell the Licensed Work. "**Sell**" means practicing any right granted to you under this License to provide to third parties, for a fee or other consideration, a product or service whose value derives, entirely or substantially, from the functionality of the Licensed Work — including without limitation:
|
|
25
|
+
|
|
26
|
+
* offering the Licensed Work, or a derivative of it, as a commercial product, paid service, SaaS, hosted, or API offering;
|
|
27
|
+
* embedding the Licensed Work in proprietary or revenue-generating software;
|
|
28
|
+
* paid consulting or support whose substance is the Licensed Work.
|
|
29
|
+
|
|
30
|
+
You may also not **re-license, rebrand, or redistribute** the Licensed Work under different terms, nor use **Lexsi Labs**, **CircuitKit**, or related trademarks, logos, or branding except to identify unmodified, licensed copies.
|
|
31
|
+
|
|
32
|
+
## 3. Patents
|
|
33
|
+
|
|
34
|
+
The Licensor grants you a non-exclusive, worldwide, royalty-free patent license, under patent claims the Licensor can license that are necessarily infringed by the Licensed Work, to use the Licensed Work for Noncommercial Purposes as permitted by this License. This patent license terminates immediately if you or your company make any written claim that the Licensed Work infringes a patent.
|
|
35
|
+
|
|
36
|
+
## 4. Responsible Use (Safety Conditions)
|
|
37
|
+
|
|
38
|
+
The Licensed Work can locate the circuits that implement safety-relevant behaviors (such as refusal) and can modify models through them. As a condition of this License, you may **not**:
|
|
39
|
+
|
|
40
|
+
* use the Licensed Work to locate, remove, weaken, or bypass the safety behaviors of any model in order to deploy, distribute, or operationalize the resulting model outside a research, evaluation, or audit context;
|
|
41
|
+
* deploy a checkpoint exported by the Licensed Work's intervention modules in a production, user-facing, or agentic system without re-evaluating its safety-relevant behavior after the intervention;
|
|
42
|
+
* use the Licensed Work to intentionally produce, disseminate, or operationalize harmful model behavior outside a research, evaluation, or audit context.
|
|
43
|
+
|
|
44
|
+
## 5. Ownership
|
|
45
|
+
|
|
46
|
+
All rights, title, and interest in and to the Licensed Work remain with **Lithasa Technologies Pvt. Ltd.** Except as expressly stated in Sections 1 and 3, nothing in this License transfers ownership or any other rights to the Licensee.
|
|
47
|
+
|
|
48
|
+
## 6. Contributions
|
|
49
|
+
|
|
50
|
+
If you submit modifications, pull requests, or patches ("Contributions") to Lexsi Labs, you grant Lexsi Labs a perpetual, worldwide, royalty-free right to use, modify, distribute, and license your Contributions under any terms, including commercial ones, and you represent that you have the right to make such Contributions.
|
|
51
|
+
|
|
52
|
+
## 7. Warranty Disclaimer
|
|
53
|
+
|
|
54
|
+
THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE LICENSOR OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
|
|
55
|
+
|
|
56
|
+
## 8. Termination
|
|
57
|
+
|
|
58
|
+
This License terminates automatically if you breach any of its terms. Upon termination, you must immediately cease use and destroy all copies of the Licensed Work in your possession. Licenses of parties who received the Licensed Work from you remain in force provided they remain in compliance.
|
|
59
|
+
|
|
60
|
+
## 9. Governing Law
|
|
61
|
+
|
|
62
|
+
This License shall be governed by and construed in accordance with the **laws of India**, without regard to its conflict of law principles.
|
|
63
|
+
|
|
64
|
+
## 10. Contact for Commercial Licensing
|
|
65
|
+
|
|
66
|
+
For commercial use, partnership, or redistribution rights, contact:
|
|
67
|
+
**support@lexsi.ai** · **https://lexsi.ai**
|
|
68
|
+
|
|
69
|
+
## 11. Notice
|
|
70
|
+
|
|
71
|
+
**CircuitKit** © 2026 **Lithasa Technologies Pvt. Ltd.**
|
|
72
|
+
Licensed under the **Lexsi Labs Source Available License (LSAL) v1.1**.
|
|
73
|
+
**Not for commercial use, and not for removing or weakening the safety behaviors of deployed models, without explicit permission.**
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Include the README and LICENSE files
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
include requirements.txt
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
|
|
7
|
+
# Include example configurations
|
|
8
|
+
recursive-include examples *.py *.yaml *.yml *.json
|
|
9
|
+
recursive-include examples *.ipynb
|
|
10
|
+
|
|
11
|
+
# Include test data
|
|
12
|
+
recursive-include tests *.py *.csv *.json *.yaml *.yml
|
|
13
|
+
|
|
14
|
+
# Include documentation
|
|
15
|
+
recursive-include docs *.rst *.md *.txt *.py
|
|
16
|
+
|
|
17
|
+
# Include configuration files
|
|
18
|
+
include pytest.ini
|
|
19
|
+
include .github/workflows/*.yml
|
|
20
|
+
|
|
21
|
+
# Exclude unnecessary files
|
|
22
|
+
exclude .gitignore
|
|
23
|
+
exclude .github/workflows/ci.yml
|
|
24
|
+
exclude tests/__pycache__
|
|
25
|
+
exclude tests/*/__pycache__
|
|
26
|
+
exclude examples/__pycache__
|
|
27
|
+
exclude examples/*/__pycache__
|
|
28
|
+
|
|
29
|
+
# Exclude large data files
|
|
30
|
+
exclude *.csv
|
|
31
|
+
exclude *.pt
|
|
32
|
+
exclude *.pth
|
|
33
|
+
exclude *.h5
|
|
34
|
+
exclude *.hdf5
|
|
35
|
+
exclude *.pkl
|
|
36
|
+
exclude *.pickle
|
|
37
|
+
exclude *.npy
|
|
38
|
+
exclude *.npz
|
|
39
|
+
|
|
40
|
+
# Exclude results and temporary files
|
|
41
|
+
exclude results/*
|
|
42
|
+
exclude data/*
|
|
43
|
+
exclude temp/*
|
|
44
|
+
exclude tmp/*
|
|
45
|
+
exclude *.log
|
|
46
|
+
exclude *.tmp
|
|
47
|
+
exclude *.temp
|
|
48
|
+
|
|
49
|
+
# In-package data must ship in the sdist (the root-level `exclude *.csv` above
|
|
50
|
+
# only matches root-level files, but without an explicit rule the src/ data was
|
|
51
|
+
# omitted entirely). Keep in sync with [tool.setuptools.package-data].
|
|
52
|
+
recursive-include src/circuitkit *.json *.csv
|
|
53
|
+
include src/circuitkit/backends/eap/py.typed
|