crca 1.4.0__py3-none-any.whl → 1.5.0__py3-none-any.whl
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.
- CRCA.py +172 -7
- MODEL_CARD.md +53 -0
- PKG-INFO +8 -2
- RELEASE_NOTES.md +17 -0
- STABILITY.md +19 -0
- architecture/hybrid/consistency_engine.py +362 -0
- architecture/hybrid/conversation_manager.py +421 -0
- architecture/hybrid/explanation_generator.py +452 -0
- architecture/hybrid/few_shot_learner.py +533 -0
- architecture/hybrid/graph_compressor.py +286 -0
- architecture/hybrid/hybrid_agent.py +4398 -0
- architecture/hybrid/language_compiler.py +623 -0
- architecture/hybrid/main,py +0 -0
- architecture/hybrid/reasoning_tracker.py +322 -0
- architecture/hybrid/self_verifier.py +524 -0
- architecture/hybrid/task_decomposer.py +567 -0
- architecture/hybrid/text_corrector.py +341 -0
- benchmark_results/crca_core_benchmarks.json +178 -0
- branches/crca_sd/crca_sd_realtime.py +6 -2
- branches/general_agent/__init__.py +102 -0
- branches/general_agent/general_agent.py +1400 -0
- branches/general_agent/personality.py +169 -0
- branches/general_agent/utils/__init__.py +19 -0
- branches/general_agent/utils/prompt_builder.py +170 -0
- {crca-1.4.0.dist-info → crca-1.5.0.dist-info}/METADATA +8 -2
- {crca-1.4.0.dist-info → crca-1.5.0.dist-info}/RECORD +303 -20
- crca_core/__init__.py +35 -0
- crca_core/benchmarks/__init__.py +14 -0
- crca_core/benchmarks/synthetic_scm.py +103 -0
- crca_core/core/__init__.py +23 -0
- crca_core/core/api.py +120 -0
- crca_core/core/estimate.py +208 -0
- crca_core/core/godclass.py +72 -0
- crca_core/core/intervention_design.py +174 -0
- crca_core/core/lifecycle.py +48 -0
- crca_core/discovery/__init__.py +9 -0
- crca_core/discovery/tabular.py +193 -0
- crca_core/identify/__init__.py +171 -0
- crca_core/identify/backdoor.py +39 -0
- crca_core/identify/frontdoor.py +48 -0
- crca_core/identify/graph.py +106 -0
- crca_core/identify/id_algorithm.py +43 -0
- crca_core/identify/iv.py +48 -0
- crca_core/models/__init__.py +67 -0
- crca_core/models/provenance.py +56 -0
- crca_core/models/refusal.py +39 -0
- crca_core/models/result.py +83 -0
- crca_core/models/spec.py +151 -0
- crca_core/models/validation.py +68 -0
- crca_core/scm/__init__.py +9 -0
- crca_core/scm/linear_gaussian.py +198 -0
- crca_core/timeseries/__init__.py +6 -0
- crca_core/timeseries/pcmci.py +181 -0
- crca_llm/__init__.py +12 -0
- crca_llm/client.py +85 -0
- crca_llm/coauthor.py +118 -0
- crca_llm/orchestrator.py +289 -0
- crca_llm/types.py +21 -0
- crca_reasoning/__init__.py +16 -0
- crca_reasoning/critique.py +54 -0
- crca_reasoning/godclass.py +206 -0
- crca_reasoning/memory.py +24 -0
- crca_reasoning/rationale.py +10 -0
- crca_reasoning/react_controller.py +81 -0
- crca_reasoning/tool_router.py +97 -0
- crca_reasoning/types.py +40 -0
- crca_sd/__init__.py +15 -0
- crca_sd/crca_sd_core.py +2 -0
- crca_sd/crca_sd_governance.py +2 -0
- crca_sd/crca_sd_mpc.py +2 -0
- crca_sd/crca_sd_realtime.py +2 -0
- crca_sd/crca_sd_tui.py +2 -0
- cuda-keyring_1.1-1_all.deb +0 -0
- cuda-keyring_1.1-1_all.deb.1 +0 -0
- docs/IMAGE_ANNOTATION_USAGE.md +539 -0
- docs/INSTALL_DEEPSPEED.md +125 -0
- docs/api/branches/crca-cg.md +19 -0
- docs/api/branches/crca-q.md +27 -0
- docs/api/branches/crca-sd.md +37 -0
- docs/api/branches/general-agent.md +24 -0
- docs/api/branches/overview.md +19 -0
- docs/api/crca/agent-methods.md +62 -0
- docs/api/crca/operations.md +79 -0
- docs/api/crca/overview.md +32 -0
- docs/api/image-annotation/engine.md +52 -0
- docs/api/image-annotation/overview.md +17 -0
- docs/api/schemas/annotation.md +34 -0
- docs/api/schemas/core-schemas.md +82 -0
- docs/api/schemas/overview.md +32 -0
- docs/api/schemas/policy.md +30 -0
- docs/api/utils/conversation.md +22 -0
- docs/api/utils/graph-reasoner.md +32 -0
- docs/api/utils/overview.md +21 -0
- docs/api/utils/router.md +19 -0
- docs/api/utils/utilities.md +97 -0
- docs/architecture/causal-graphs.md +41 -0
- docs/architecture/data-flow.md +29 -0
- docs/architecture/design-principles.md +33 -0
- docs/architecture/hybrid-agent/components.md +38 -0
- docs/architecture/hybrid-agent/consistency.md +26 -0
- docs/architecture/hybrid-agent/overview.md +44 -0
- docs/architecture/hybrid-agent/reasoning.md +22 -0
- docs/architecture/llm-integration.md +26 -0
- docs/architecture/modular-structure.md +37 -0
- docs/architecture/overview.md +69 -0
- docs/architecture/policy-engine-arch.md +29 -0
- docs/branches/crca-cg/corposwarm.md +39 -0
- docs/branches/crca-cg/esg-scoring.md +30 -0
- docs/branches/crca-cg/multi-agent.md +35 -0
- docs/branches/crca-cg/overview.md +40 -0
- docs/branches/crca-q/alternative-data.md +55 -0
- docs/branches/crca-q/architecture.md +71 -0
- docs/branches/crca-q/backtesting.md +45 -0
- docs/branches/crca-q/causal-engine.md +33 -0
- docs/branches/crca-q/execution.md +39 -0
- docs/branches/crca-q/market-data.md +60 -0
- docs/branches/crca-q/overview.md +58 -0
- docs/branches/crca-q/philosophy.md +60 -0
- docs/branches/crca-q/portfolio-optimization.md +66 -0
- docs/branches/crca-q/risk-management.md +102 -0
- docs/branches/crca-q/setup.md +65 -0
- docs/branches/crca-q/signal-generation.md +61 -0
- docs/branches/crca-q/signal-validation.md +43 -0
- docs/branches/crca-sd/core.md +84 -0
- docs/branches/crca-sd/governance.md +53 -0
- docs/branches/crca-sd/mpc-solver.md +65 -0
- docs/branches/crca-sd/overview.md +59 -0
- docs/branches/crca-sd/realtime.md +28 -0
- docs/branches/crca-sd/tui.md +20 -0
- docs/branches/general-agent/overview.md +37 -0
- docs/branches/general-agent/personality.md +36 -0
- docs/branches/general-agent/prompt-builder.md +30 -0
- docs/changelog/index.md +79 -0
- docs/contributing/code-style.md +69 -0
- docs/contributing/documentation.md +43 -0
- docs/contributing/overview.md +29 -0
- docs/contributing/testing.md +29 -0
- docs/core/crcagent/async-operations.md +65 -0
- docs/core/crcagent/automatic-extraction.md +107 -0
- docs/core/crcagent/batch-prediction.md +80 -0
- docs/core/crcagent/bayesian-inference.md +60 -0
- docs/core/crcagent/causal-graph.md +92 -0
- docs/core/crcagent/counterfactuals.md +96 -0
- docs/core/crcagent/deterministic-simulation.md +78 -0
- docs/core/crcagent/dual-mode-operation.md +82 -0
- docs/core/crcagent/initialization.md +88 -0
- docs/core/crcagent/optimization.md +65 -0
- docs/core/crcagent/overview.md +63 -0
- docs/core/crcagent/time-series.md +57 -0
- docs/core/schemas/annotation.md +30 -0
- docs/core/schemas/core-schemas.md +82 -0
- docs/core/schemas/overview.md +30 -0
- docs/core/schemas/policy.md +41 -0
- docs/core/templates/base-agent.md +31 -0
- docs/core/templates/feature-mixins.md +31 -0
- docs/core/templates/overview.md +29 -0
- docs/core/templates/templates-guide.md +75 -0
- docs/core/tools/mcp-client.md +34 -0
- docs/core/tools/overview.md +24 -0
- docs/core/utils/conversation.md +27 -0
- docs/core/utils/graph-reasoner.md +29 -0
- docs/core/utils/overview.md +27 -0
- docs/core/utils/router.md +27 -0
- docs/core/utils/utilities.md +97 -0
- docs/css/custom.css +84 -0
- docs/examples/basic-usage.md +57 -0
- docs/examples/general-agent/general-agent-examples.md +50 -0
- docs/examples/hybrid-agent/hybrid-agent-examples.md +56 -0
- docs/examples/image-annotation/image-annotation-examples.md +54 -0
- docs/examples/integration/integration-examples.md +58 -0
- docs/examples/overview.md +37 -0
- docs/examples/trading/trading-examples.md +46 -0
- docs/features/causal-reasoning/advanced-topics.md +101 -0
- docs/features/causal-reasoning/counterfactuals.md +43 -0
- docs/features/causal-reasoning/do-calculus.md +50 -0
- docs/features/causal-reasoning/overview.md +47 -0
- docs/features/causal-reasoning/structural-models.md +52 -0
- docs/features/hybrid-agent/advanced-components.md +55 -0
- docs/features/hybrid-agent/core-components.md +64 -0
- docs/features/hybrid-agent/overview.md +34 -0
- docs/features/image-annotation/engine.md +82 -0
- docs/features/image-annotation/features.md +113 -0
- docs/features/image-annotation/integration.md +75 -0
- docs/features/image-annotation/overview.md +53 -0
- docs/features/image-annotation/quickstart.md +73 -0
- docs/features/policy-engine/doctrine-ledger.md +105 -0
- docs/features/policy-engine/monitoring.md +44 -0
- docs/features/policy-engine/mpc-control.md +89 -0
- docs/features/policy-engine/overview.md +46 -0
- docs/getting-started/configuration.md +225 -0
- docs/getting-started/first-agent.md +164 -0
- docs/getting-started/installation.md +144 -0
- docs/getting-started/quickstart.md +137 -0
- docs/index.md +118 -0
- docs/js/mathjax.js +13 -0
- docs/lrm/discovery_proof_notes.md +25 -0
- docs/lrm/finetune_full.md +83 -0
- docs/lrm/math_appendix.md +120 -0
- docs/lrm/overview.md +32 -0
- docs/mkdocs.yml +238 -0
- docs/stylesheets/extra.css +21 -0
- docs_generated/crca_core/CounterfactualResult.md +12 -0
- docs_generated/crca_core/DiscoveryHypothesisResult.md +13 -0
- docs_generated/crca_core/DraftSpec.md +13 -0
- docs_generated/crca_core/EstimateResult.md +13 -0
- docs_generated/crca_core/IdentificationResult.md +17 -0
- docs_generated/crca_core/InterventionDesignResult.md +12 -0
- docs_generated/crca_core/LockedSpec.md +15 -0
- docs_generated/crca_core/RefusalResult.md +12 -0
- docs_generated/crca_core/ValidationReport.md +9 -0
- docs_generated/crca_core/index.md +13 -0
- examples/general_agent_example.py +277 -0
- examples/general_agent_quickstart.py +202 -0
- examples/general_agent_simple.py +92 -0
- examples/hybrid_agent_auto_extraction.py +84 -0
- examples/hybrid_agent_dictionary_demo.py +104 -0
- examples/hybrid_agent_enhanced.py +179 -0
- examples/hybrid_agent_general_knowledge.py +107 -0
- examples/image_annotation_quickstart.py +328 -0
- examples/test_hybrid_fixes.py +77 -0
- image_annotation/__init__.py +27 -0
- image_annotation/annotation_engine.py +2593 -0
- install_cuda_wsl2.sh +59 -0
- install_deepspeed.sh +56 -0
- install_deepspeed_simple.sh +87 -0
- mkdocs.yml +252 -0
- ollama/Modelfile +8 -0
- prompts/__init__.py +2 -1
- prompts/default_crca.py +9 -1
- prompts/general_agent.py +227 -0
- prompts/image_annotation.py +56 -0
- pyproject.toml +17 -2
- requirements-docs.txt +10 -0
- requirements.txt +21 -2
- schemas/__init__.py +26 -1
- schemas/annotation.py +222 -0
- schemas/conversation.py +193 -0
- schemas/hybrid.py +211 -0
- schemas/reasoning.py +276 -0
- schemas_export/crca_core/CounterfactualResult.schema.json +108 -0
- schemas_export/crca_core/DiscoveryHypothesisResult.schema.json +113 -0
- schemas_export/crca_core/DraftSpec.schema.json +635 -0
- schemas_export/crca_core/EstimateResult.schema.json +113 -0
- schemas_export/crca_core/IdentificationResult.schema.json +145 -0
- schemas_export/crca_core/InterventionDesignResult.schema.json +111 -0
- schemas_export/crca_core/LockedSpec.schema.json +646 -0
- schemas_export/crca_core/RefusalResult.schema.json +90 -0
- schemas_export/crca_core/ValidationReport.schema.json +62 -0
- scripts/build_lrm_dataset.py +80 -0
- scripts/export_crca_core_schemas.py +54 -0
- scripts/export_hf_lrm.py +37 -0
- scripts/export_ollama_gguf.py +45 -0
- scripts/generate_changelog.py +157 -0
- scripts/generate_crca_core_docs_from_schemas.py +86 -0
- scripts/run_crca_core_benchmarks.py +163 -0
- scripts/run_full_finetune.py +198 -0
- scripts/run_lrm_eval.py +31 -0
- templates/graph_management.py +29 -0
- tests/conftest.py +9 -0
- tests/test_core.py +2 -3
- tests/test_crca_core_discovery_tabular.py +15 -0
- tests/test_crca_core_estimate_dowhy.py +36 -0
- tests/test_crca_core_identify.py +18 -0
- tests/test_crca_core_intervention_design.py +36 -0
- tests/test_crca_core_linear_gaussian_scm.py +69 -0
- tests/test_crca_core_spec.py +25 -0
- tests/test_crca_core_timeseries_pcmci.py +15 -0
- tests/test_crca_llm_coauthor.py +12 -0
- tests/test_crca_llm_orchestrator.py +80 -0
- tests/test_hybrid_agent_llm_enhanced.py +556 -0
- tests/test_image_annotation_demo.py +376 -0
- tests/test_image_annotation_operational.py +408 -0
- tests/test_image_annotation_unit.py +551 -0
- tests/test_training_moe.py +13 -0
- training/__init__.py +42 -0
- training/datasets.py +140 -0
- training/deepspeed_zero2_0_5b.json +22 -0
- training/deepspeed_zero2_1_5b.json +22 -0
- training/deepspeed_zero3_0_5b.json +28 -0
- training/deepspeed_zero3_14b.json +28 -0
- training/deepspeed_zero3_h100_3gpu.json +20 -0
- training/deepspeed_zero3_offload.json +28 -0
- training/eval.py +92 -0
- training/finetune.py +516 -0
- training/public_datasets.py +89 -0
- training_data/react_train.jsonl +7473 -0
- utils/agent_discovery.py +311 -0
- utils/batch_processor.py +317 -0
- utils/conversation.py +78 -0
- utils/edit_distance.py +118 -0
- utils/formatter.py +33 -0
- utils/graph_reasoner.py +530 -0
- utils/rate_limiter.py +283 -0
- utils/router.py +2 -2
- utils/tool_discovery.py +307 -0
- webui/__init__.py +10 -0
- webui/app.py +229 -0
- webui/config.py +104 -0
- webui/static/css/style.css +332 -0
- webui/static/js/main.js +284 -0
- webui/templates/index.html +42 -0
- tests/test_crca_excel.py +0 -166
- tests/test_data_broker.py +0 -424
- tests/test_palantir.py +0 -349
- {crca-1.4.0.dist-info → crca-1.5.0.dist-info}/WHEEL +0 -0
- {crca-1.4.0.dist-info → crca-1.5.0.dist-info}/licenses/LICENSE +0 -0
install_cuda_wsl2.sh
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Install CUDA toolkit for WSL2 Ubuntu 24.04
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
echo "=== Installing CUDA toolkit for WSL2 ==="
|
|
7
|
+
|
|
8
|
+
# Check if CUDA keyring already exists
|
|
9
|
+
if [ -f "cuda-keyring_1.1-1_all.deb" ]; then
|
|
10
|
+
echo "CUDA keyring file found, using existing..."
|
|
11
|
+
else
|
|
12
|
+
echo "Downloading CUDA keyring..."
|
|
13
|
+
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
echo "Installing CUDA keyring..."
|
|
17
|
+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
|
|
18
|
+
sudo apt-get update
|
|
19
|
+
|
|
20
|
+
echo "Installing CUDA toolkit 12.x..."
|
|
21
|
+
# Try to install the latest 12.x version available
|
|
22
|
+
sudo apt-get install -y cuda-toolkit-12-6 || \
|
|
23
|
+
sudo apt-get install -y cuda-toolkit-12-5 || \
|
|
24
|
+
sudo apt-get install -y cuda-toolkit-12-4 || \
|
|
25
|
+
sudo apt-get install -y cuda-toolkit-12-3 || \
|
|
26
|
+
sudo apt-get install -y cuda-toolkit-12-2 || \
|
|
27
|
+
sudo apt-get install -y cuda-toolkit-12-1 || \
|
|
28
|
+
echo "Failed to install CUDA toolkit. Please check available versions with: apt-cache search cuda-toolkit"
|
|
29
|
+
|
|
30
|
+
# Set CUDA_HOME
|
|
31
|
+
if [ -d "/usr/local/cuda-12.6" ]; then
|
|
32
|
+
export CUDA_HOME=/usr/local/cuda-12.6
|
|
33
|
+
elif [ -d "/usr/local/cuda-12.5" ]; then
|
|
34
|
+
export CUDA_HOME=/usr/local/cuda-12.5
|
|
35
|
+
elif [ -d "/usr/local/cuda-12.4" ]; then
|
|
36
|
+
export CUDA_HOME=/usr/local/cuda-12.4
|
|
37
|
+
elif [ -d "/usr/local/cuda" ]; then
|
|
38
|
+
export CUDA_HOME=/usr/local/cuda
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
if [ -n "$CUDA_HOME" ]; then
|
|
42
|
+
echo "CUDA_HOME set to: $CUDA_HOME"
|
|
43
|
+
echo ""
|
|
44
|
+
echo "Add these to your ~/.bashrc:"
|
|
45
|
+
echo "export CUDA_HOME=$CUDA_HOME"
|
|
46
|
+
echo "export PATH=\$CUDA_HOME/bin:\$PATH"
|
|
47
|
+
echo "export LD_LIBRARY_PATH=\$CUDA_HOME/lib64:\$LD_LIBRARY_PATH"
|
|
48
|
+
|
|
49
|
+
# Add to current session
|
|
50
|
+
export PATH=$CUDA_HOME/bin:$PATH
|
|
51
|
+
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
|
|
52
|
+
else
|
|
53
|
+
echo "Warning: Could not determine CUDA_HOME"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
echo -e "\n=== Verifying CUDA installation ==="
|
|
57
|
+
nvcc --version || echo "nvcc not found in PATH (may need to restart shell or source ~/.bashrc)"
|
|
58
|
+
|
|
59
|
+
echo -e "\n=== CUDA toolkit installation complete! ==="
|
install_deepspeed.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# DeepSpeed installation script for WSL2 Ubuntu 24.04
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
VENV_DIR="${VENV_DIR:-venv}"
|
|
7
|
+
USE_VENV="${USE_VENV:-1}"
|
|
8
|
+
|
|
9
|
+
echo "=== Checking environment ==="
|
|
10
|
+
python3 -V || python3 --version
|
|
11
|
+
python3 -m pip --version || pip3 -V || pip3 --version
|
|
12
|
+
|
|
13
|
+
echo -e "\n=== Checking PyTorch installation ==="
|
|
14
|
+
python3 -c "import torch; print('PyTorch:', torch.__version__); print('CUDA available:', torch.cuda.is_available()); print('CUDA version:', torch.version.cuda if torch.cuda.is_available() else 'N/A')" 2>/dev/null || echo "PyTorch not installed"
|
|
15
|
+
|
|
16
|
+
if [ "$USE_VENV" = "1" ]; then
|
|
17
|
+
echo -e "\n=== Setting up virtual environment ==="
|
|
18
|
+
if [ ! -d "$VENV_DIR" ]; then
|
|
19
|
+
echo "Creating virtual environment in $VENV_DIR..."
|
|
20
|
+
python3 -m venv "$VENV_DIR"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
echo "Activating virtual environment..."
|
|
24
|
+
source "$VENV_DIR/bin/activate"
|
|
25
|
+
|
|
26
|
+
echo -e "\n=== Upgrading pip in virtual environment ==="
|
|
27
|
+
python3 -m pip install --upgrade pip setuptools wheel
|
|
28
|
+
else
|
|
29
|
+
echo -e "\n=== Upgrading pip (system-wide with --break-system-packages) ==="
|
|
30
|
+
python3 -m pip install --upgrade pip setuptools wheel --break-system-packages
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
echo -e "\n=== Installing build dependencies ==="
|
|
34
|
+
sudo apt-get update
|
|
35
|
+
sudo apt-get install -y build-essential python3-dev
|
|
36
|
+
|
|
37
|
+
echo -e "\n=== Installing DeepSpeed ==="
|
|
38
|
+
# Install DeepSpeed with CUDA support
|
|
39
|
+
# Disable custom CUDA ops building for WSL2 compatibility
|
|
40
|
+
if [ "$USE_VENV" = "1" ]; then
|
|
41
|
+
DS_BUILD_OPS=0 python3 -m pip install deepspeed --upgrade
|
|
42
|
+
else
|
|
43
|
+
DS_BUILD_OPS=0 python3 -m pip install deepspeed --upgrade --break-system-packages
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
echo -e "\n=== Verifying DeepSpeed installation ==="
|
|
47
|
+
python3 -c "import deepspeed; print('DeepSpeed version:', deepspeed.__version__)"
|
|
48
|
+
|
|
49
|
+
if [ "$USE_VENV" = "1" ]; then
|
|
50
|
+
echo -e "\n=== Virtual environment info ==="
|
|
51
|
+
echo "Virtual environment created at: $VENV_DIR"
|
|
52
|
+
echo "To activate it in the future, run: source $VENV_DIR/bin/activate"
|
|
53
|
+
deactivate
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
echo -e "\n=== Installation complete! ==="
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Simple DeepSpeed installation for WSL2 Ubuntu 24.04 (system-wide)
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
cd "$SCRIPT_DIR"
|
|
8
|
+
|
|
9
|
+
echo "=== Installing build dependencies ==="
|
|
10
|
+
sudo apt-get update
|
|
11
|
+
sudo apt-get install -y build-essential python3-dev
|
|
12
|
+
|
|
13
|
+
echo -e "\n=== Checking CUDA setup ==="
|
|
14
|
+
# Check if CUDA toolkit is installed
|
|
15
|
+
if ! command -v nvcc &> /dev/null; then
|
|
16
|
+
echo "CUDA toolkit not found. Installing CUDA toolkit for WSL2..."
|
|
17
|
+
|
|
18
|
+
# Use existing keyring file if available
|
|
19
|
+
if [ -f "cuda-keyring_1.1-1_all.deb" ]; then
|
|
20
|
+
echo "Using existing CUDA keyring file..."
|
|
21
|
+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
|
|
22
|
+
else
|
|
23
|
+
echo "Downloading CUDA keyring..."
|
|
24
|
+
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
|
|
25
|
+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
sudo apt-get update
|
|
29
|
+
|
|
30
|
+
# Try to install CUDA toolkit 12.x (matching PyTorch's CUDA 12.8)
|
|
31
|
+
echo "Installing CUDA toolkit 12.x..."
|
|
32
|
+
if sudo apt-get install -y cuda-toolkit-12-6 2>/dev/null; then
|
|
33
|
+
export CUDA_HOME=/usr/local/cuda-12.6
|
|
34
|
+
elif sudo apt-get install -y cuda-toolkit-12-5 2>/dev/null; then
|
|
35
|
+
export CUDA_HOME=/usr/local/cuda-12.5
|
|
36
|
+
elif sudo apt-get install -y cuda-toolkit-12-4 2>/dev/null; then
|
|
37
|
+
export CUDA_HOME=/usr/local/cuda-12.4
|
|
38
|
+
elif sudo apt-get install -y cuda-toolkit-12-3 2>/dev/null; then
|
|
39
|
+
export CUDA_HOME=/usr/local/cuda-12.3
|
|
40
|
+
elif [ -d "/usr/local/cuda" ]; then
|
|
41
|
+
export CUDA_HOME=/usr/local/cuda
|
|
42
|
+
else
|
|
43
|
+
echo "Warning: Could not install CUDA toolkit. DeepSpeed installation may fail."
|
|
44
|
+
echo "You may need to install CUDA toolkit manually or use a different installation method."
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
if [ -n "$CUDA_HOME" ] && [ -d "$CUDA_HOME" ]; then
|
|
48
|
+
export PATH=$CUDA_HOME/bin:$PATH
|
|
49
|
+
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
|
|
50
|
+
echo "CUDA_HOME set to: $CUDA_HOME"
|
|
51
|
+
echo "Add to ~/.bashrc:"
|
|
52
|
+
echo " export CUDA_HOME=$CUDA_HOME"
|
|
53
|
+
echo " export PATH=\$CUDA_HOME/bin:\$PATH"
|
|
54
|
+
echo " export LD_LIBRARY_PATH=\$CUDA_HOME/lib64:\$LD_LIBRARY_PATH"
|
|
55
|
+
fi
|
|
56
|
+
else
|
|
57
|
+
echo "CUDA toolkit found at: $(which nvcc)"
|
|
58
|
+
if [ -z "$CUDA_HOME" ]; then
|
|
59
|
+
# Try to find CUDA_HOME
|
|
60
|
+
NVCC_PATH=$(which nvcc)
|
|
61
|
+
CUDA_HOME=$(dirname $(dirname "$NVCC_PATH"))
|
|
62
|
+
export CUDA_HOME
|
|
63
|
+
echo "Setting CUDA_HOME to: $CUDA_HOME"
|
|
64
|
+
fi
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
echo -e "\n=== Installing DeepSpeed (system-wide) ==="
|
|
68
|
+
# Disable custom CUDA ops building for WSL2 compatibility
|
|
69
|
+
if [ -n "$CUDA_HOME" ] && [ -d "$CUDA_HOME" ]; then
|
|
70
|
+
echo "Installing DeepSpeed with CUDA_HOME=$CUDA_HOME"
|
|
71
|
+
DS_BUILD_OPS=0 python3 -m pip install deepspeed --upgrade --break-system-packages
|
|
72
|
+
else
|
|
73
|
+
echo "Warning: CUDA_HOME not set. Attempting installation with workaround..."
|
|
74
|
+
# Create a minimal CUDA_HOME structure to satisfy DeepSpeed's setup.py check
|
|
75
|
+
TMP_CUDA=/tmp/cuda_home
|
|
76
|
+
mkdir -p "$TMP_CUDA/bin" "$TMP_CUDA/include"
|
|
77
|
+
export CUDA_HOME=$TMP_CUDA
|
|
78
|
+
DS_BUILD_OPS=0 python3 -m pip install deepspeed --upgrade --break-system-packages || {
|
|
79
|
+
echo "Installation failed. Please install CUDA toolkit first using install_cuda_wsl2.sh"
|
|
80
|
+
exit 1
|
|
81
|
+
}
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
echo -e "\n=== Verifying DeepSpeed installation ==="
|
|
85
|
+
python3 -c "import deepspeed; print('DeepSpeed version:', deepspeed.__version__)"
|
|
86
|
+
|
|
87
|
+
echo -e "\n=== Installation complete! ==="
|
mkdocs.yml
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
site_name: CR-CA Documentation
|
|
2
|
+
site_description: Causal Reasoning and Counterfactual Analysis Framework
|
|
3
|
+
site_author: CR-CA Contributors
|
|
4
|
+
site_url: https://github.com/IlumCI/CR-CA
|
|
5
|
+
|
|
6
|
+
repo_name: IlumCI/CR-CA
|
|
7
|
+
repo_url: https://github.com/IlumCI/CR-CA
|
|
8
|
+
edit_uri: edit/main/docs/
|
|
9
|
+
|
|
10
|
+
copyright: Copyright © 2024-2026 CR-CA Contributors
|
|
11
|
+
|
|
12
|
+
theme:
|
|
13
|
+
name: material
|
|
14
|
+
palette:
|
|
15
|
+
- scheme: default
|
|
16
|
+
primary: indigo
|
|
17
|
+
accent: blue
|
|
18
|
+
toggle:
|
|
19
|
+
icon: material/brightness-7
|
|
20
|
+
name: Switch to dark mode
|
|
21
|
+
- scheme: slate
|
|
22
|
+
primary: indigo
|
|
23
|
+
accent: blue
|
|
24
|
+
toggle:
|
|
25
|
+
icon: material/brightness-4
|
|
26
|
+
name: Switch to light mode
|
|
27
|
+
font:
|
|
28
|
+
text: Inter
|
|
29
|
+
code: Roboto Mono
|
|
30
|
+
features:
|
|
31
|
+
- navigation.tabs
|
|
32
|
+
- navigation.sections
|
|
33
|
+
- navigation.expand
|
|
34
|
+
- navigation.top
|
|
35
|
+
- search.suggest
|
|
36
|
+
- search.highlight
|
|
37
|
+
- content.code.annotate
|
|
38
|
+
- content.tabs.link
|
|
39
|
+
- content.code.copy
|
|
40
|
+
icon:
|
|
41
|
+
repo: fontawesome/brands/github
|
|
42
|
+
|
|
43
|
+
markdown_extensions:
|
|
44
|
+
- pymdownx.arithmatex:
|
|
45
|
+
generic: true
|
|
46
|
+
- pymdownx.superfences:
|
|
47
|
+
custom_fences:
|
|
48
|
+
- name: mermaid
|
|
49
|
+
class: mermaid
|
|
50
|
+
format: !!python/name:pymdownx.superfences.fence_code_format
|
|
51
|
+
- pymdownx.highlight:
|
|
52
|
+
anchor_linenums: true
|
|
53
|
+
line_spans: __span
|
|
54
|
+
pygments_lang_class: true
|
|
55
|
+
- pymdownx.inlinehilite
|
|
56
|
+
- pymdownx.snippets
|
|
57
|
+
- pymdownx.tabbed:
|
|
58
|
+
alternate_style: true
|
|
59
|
+
- admonition
|
|
60
|
+
- pymdownx.details
|
|
61
|
+
- pymdownx.tasklist:
|
|
62
|
+
custom_checkbox: true
|
|
63
|
+
- attr_list
|
|
64
|
+
- md_in_html
|
|
65
|
+
- toc:
|
|
66
|
+
permalink: true
|
|
67
|
+
toc_depth: 3
|
|
68
|
+
|
|
69
|
+
plugins:
|
|
70
|
+
- search:
|
|
71
|
+
lang: en
|
|
72
|
+
- minify:
|
|
73
|
+
minify_html: true
|
|
74
|
+
- git-revision-date-localized:
|
|
75
|
+
enable_creation_date: true
|
|
76
|
+
type: date
|
|
77
|
+
- mermaid2
|
|
78
|
+
- mkdocstrings:
|
|
79
|
+
handlers:
|
|
80
|
+
python:
|
|
81
|
+
paths: [..]
|
|
82
|
+
selection:
|
|
83
|
+
docstring_style: google
|
|
84
|
+
rendering:
|
|
85
|
+
show_source: true
|
|
86
|
+
show_root_heading: true
|
|
87
|
+
show_root_toc_entry: true
|
|
88
|
+
|
|
89
|
+
extra_javascript:
|
|
90
|
+
- javascripts/mathjax.js
|
|
91
|
+
- https://polyfill.io/v3/polyfill.min.js?features=es6
|
|
92
|
+
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
|
|
93
|
+
|
|
94
|
+
extra_css:
|
|
95
|
+
- css/custom.css
|
|
96
|
+
- stylesheets/extra.css
|
|
97
|
+
|
|
98
|
+
nav:
|
|
99
|
+
- Home: index.md
|
|
100
|
+
- Getting Started:
|
|
101
|
+
- Installation: getting-started/installation.md
|
|
102
|
+
- Quickstart: getting-started/quickstart.md
|
|
103
|
+
- Configuration: getting-started/configuration.md
|
|
104
|
+
- First Agent: getting-started/first-agent.md
|
|
105
|
+
- Core Modules:
|
|
106
|
+
- CRCAAgent:
|
|
107
|
+
- Overview: core/crcagent/overview.md
|
|
108
|
+
- Initialization: core/crcagent/initialization.md
|
|
109
|
+
- Automatic Extraction: core/crcagent/automatic-extraction.md
|
|
110
|
+
- Dual-Mode Operation: core/crcagent/dual-mode-operation.md
|
|
111
|
+
- Causal Graph: core/crcagent/causal-graph.md
|
|
112
|
+
- Deterministic Simulation: core/crcagent/deterministic-simulation.md
|
|
113
|
+
- Counterfactuals: core/crcagent/counterfactuals.md
|
|
114
|
+
- Batch Prediction: core/crcagent/batch-prediction.md
|
|
115
|
+
- Async Operations: core/crcagent/async-operations.md
|
|
116
|
+
- Optimization: core/crcagent/optimization.md
|
|
117
|
+
- Time-Series: core/crcagent/time-series.md
|
|
118
|
+
- Bayesian Inference: core/crcagent/bayesian-inference.md
|
|
119
|
+
- Utils:
|
|
120
|
+
- Overview: core/utils/overview.md
|
|
121
|
+
- Router: core/utils/router.md
|
|
122
|
+
- Conversation: core/utils/conversation.md
|
|
123
|
+
- Graph Reasoner: core/utils/graph-reasoner.md
|
|
124
|
+
- Utilities: core/utils/utilities.md
|
|
125
|
+
- Templates:
|
|
126
|
+
- Overview: core/templates/overview.md
|
|
127
|
+
- Base Agent: core/templates/base-agent.md
|
|
128
|
+
- Feature Mixins: core/templates/feature-mixins.md
|
|
129
|
+
- Templates Guide: core/templates/templates-guide.md
|
|
130
|
+
- Schemas:
|
|
131
|
+
- Overview: core/schemas/overview.md
|
|
132
|
+
- Annotation: core/schemas/annotation.md
|
|
133
|
+
- Core Schemas: core/schemas/core-schemas.md
|
|
134
|
+
- Policy: core/schemas/policy.md
|
|
135
|
+
- Tools:
|
|
136
|
+
- Overview: core/tools/overview.md
|
|
137
|
+
- MCP Client: core/tools/mcp-client.md
|
|
138
|
+
- Branches:
|
|
139
|
+
- CRCA-Q:
|
|
140
|
+
- Overview: branches/crca-q/overview.md
|
|
141
|
+
- Philosophy: branches/crca-q/philosophy.md
|
|
142
|
+
- Architecture: branches/crca-q/architecture.md
|
|
143
|
+
- Market Data: branches/crca-q/market-data.md
|
|
144
|
+
- Alternative Data: branches/crca-q/alternative-data.md
|
|
145
|
+
- Signal Generation: branches/crca-q/signal-generation.md
|
|
146
|
+
- Causal Engine: branches/crca-q/causal-engine.md
|
|
147
|
+
- Signal Validation: branches/crca-q/signal-validation.md
|
|
148
|
+
- Portfolio Optimization: branches/crca-q/portfolio-optimization.md
|
|
149
|
+
- Risk Management: branches/crca-q/risk-management.md
|
|
150
|
+
- Execution: branches/crca-q/execution.md
|
|
151
|
+
- Backtesting: branches/crca-q/backtesting.md
|
|
152
|
+
- Setup: branches/crca-q/setup.md
|
|
153
|
+
- CRCA-SD:
|
|
154
|
+
- Overview: branches/crca-sd/overview.md
|
|
155
|
+
- Core: branches/crca-sd/core.md
|
|
156
|
+
- MPC Solver: branches/crca-sd/mpc-solver.md
|
|
157
|
+
- Governance: branches/crca-sd/governance.md
|
|
158
|
+
- Real-Time: branches/crca-sd/realtime.md
|
|
159
|
+
- TUI: branches/crca-sd/tui.md
|
|
160
|
+
- CRCA-CG:
|
|
161
|
+
- Overview: branches/crca-cg/overview.md
|
|
162
|
+
- CorporateSwarm: branches/crca-cg/corposwarm.md
|
|
163
|
+
- ESG Scoring: branches/crca-cg/esg-scoring.md
|
|
164
|
+
- Multi-Agent: branches/crca-cg/multi-agent.md
|
|
165
|
+
- General Agent:
|
|
166
|
+
- Overview: branches/general-agent/overview.md
|
|
167
|
+
- Personality: branches/general-agent/personality.md
|
|
168
|
+
- Prompt Builder: branches/general-agent/prompt-builder.md
|
|
169
|
+
- Features:
|
|
170
|
+
- Image Annotation:
|
|
171
|
+
- Overview: features/image-annotation/overview.md
|
|
172
|
+
- Quickstart: features/image-annotation/quickstart.md
|
|
173
|
+
- Engine: features/image-annotation/engine.md
|
|
174
|
+
- Features: features/image-annotation/features.md
|
|
175
|
+
- Integration: features/image-annotation/integration.md
|
|
176
|
+
- Policy Engine:
|
|
177
|
+
- Overview: features/policy-engine/overview.md
|
|
178
|
+
- Doctrine & Ledger: features/policy-engine/doctrine-ledger.md
|
|
179
|
+
- MPC & Control: features/policy-engine/mpc-control.md
|
|
180
|
+
- Monitoring & Drift Detection: features/policy-engine/monitoring.md
|
|
181
|
+
- Hybrid Agent:
|
|
182
|
+
- Overview: features/hybrid-agent/overview.md
|
|
183
|
+
- Core Components: features/hybrid-agent/core-components.md
|
|
184
|
+
- Advanced Components: features/hybrid-agent/advanced-components.md
|
|
185
|
+
- Causal Reasoning:
|
|
186
|
+
- Overview: features/causal-reasoning/overview.md
|
|
187
|
+
- Structural Models: features/causal-reasoning/structural-models.md
|
|
188
|
+
- Do-Calculus: features/causal-reasoning/do-calculus.md
|
|
189
|
+
- Counterfactuals: features/causal-reasoning/counterfactuals.md
|
|
190
|
+
- Advanced Topics: features/causal-reasoning/advanced-topics.md
|
|
191
|
+
- LRM:
|
|
192
|
+
- Overview: lrm/overview.md
|
|
193
|
+
- Full Finetune: lrm/finetune_full.md
|
|
194
|
+
- Math Appendix: lrm/math_appendix.md
|
|
195
|
+
- Discovery Proof Notes: lrm/discovery_proof_notes.md
|
|
196
|
+
- Examples:
|
|
197
|
+
- Overview: examples/overview.md
|
|
198
|
+
- Basic Usage: examples/basic-usage.md
|
|
199
|
+
- General Agent: examples/general-agent/general-agent-examples.md
|
|
200
|
+
- Hybrid Agent: examples/hybrid-agent/hybrid-agent-examples.md
|
|
201
|
+
- Image Annotation: examples/image-annotation/image-annotation-examples.md
|
|
202
|
+
- Trading: examples/trading/trading-examples.md
|
|
203
|
+
- Integration: examples/integration/integration-examples.md
|
|
204
|
+
- Architecture:
|
|
205
|
+
- Overview: architecture/overview.md
|
|
206
|
+
- Design Principles: architecture/design-principles.md
|
|
207
|
+
- Data Flow: architecture/data-flow.md
|
|
208
|
+
- Modular Structure: architecture/modular-structure.md
|
|
209
|
+
- Hybrid Agent:
|
|
210
|
+
- Overview: architecture/hybrid-agent/overview.md
|
|
211
|
+
- Components: architecture/hybrid-agent/components.md
|
|
212
|
+
- Consistency: architecture/hybrid-agent/consistency.md
|
|
213
|
+
- Reasoning: architecture/hybrid-agent/reasoning.md
|
|
214
|
+
- Causal Graphs: architecture/causal-graphs.md
|
|
215
|
+
- LLM Integration: architecture/llm-integration.md
|
|
216
|
+
- Policy Engine: architecture/policy-engine-arch.md
|
|
217
|
+
- API Reference:
|
|
218
|
+
- CRCAAgent:
|
|
219
|
+
- Overview: api/crca/overview.md
|
|
220
|
+
- Agent & Methods: api/crca/agent-methods.md
|
|
221
|
+
- Operations: api/crca/operations.md
|
|
222
|
+
- Utils:
|
|
223
|
+
- Overview: api/utils/overview.md
|
|
224
|
+
- Router: api/utils/router.md
|
|
225
|
+
- Conversation: api/utils/conversation.md
|
|
226
|
+
- Graph Reasoner: api/utils/graph-reasoner.md
|
|
227
|
+
- Utilities: api/utils/utilities.md
|
|
228
|
+
- Schemas:
|
|
229
|
+
- Overview: api/schemas/overview.md
|
|
230
|
+
- Annotation: api/schemas/annotation.md
|
|
231
|
+
- Core Schemas: api/schemas/core-schemas.md
|
|
232
|
+
- Policy: api/schemas/policy.md
|
|
233
|
+
- Branches:
|
|
234
|
+
- Overview: api/branches/overview.md
|
|
235
|
+
- CRCA-Q: api/branches/crca-q.md
|
|
236
|
+
- CRCA-SD: api/branches/crca-sd.md
|
|
237
|
+
- CRCA-CG: api/branches/crca-cg.md
|
|
238
|
+
- General Agent: api/branches/general-agent.md
|
|
239
|
+
- Image Annotation:
|
|
240
|
+
- Overview: api/image-annotation/overview.md
|
|
241
|
+
- Engine: api/image-annotation/engine.md
|
|
242
|
+
- Schema Contracts:
|
|
243
|
+
- Overview: ../docs_generated/crca_core/index.md
|
|
244
|
+
- DraftSpec: ../docs_generated/crca_core/DraftSpec.md
|
|
245
|
+
- LockedSpec: ../docs_generated/crca_core/LockedSpec.md
|
|
246
|
+
- IdentificationResult: ../docs_generated/crca_core/IdentificationResult.md
|
|
247
|
+
- DiscoveryHypothesisResult: ../docs_generated/crca_core/DiscoveryHypothesisResult.md
|
|
248
|
+
- InterventionDesignResult: ../docs_generated/crca_core/InterventionDesignResult.md
|
|
249
|
+
- CounterfactualResult: ../docs_generated/crca_core/CounterfactualResult.md
|
|
250
|
+
- EstimateResult: ../docs_generated/crca_core/EstimateResult.md
|
|
251
|
+
- Changelog: changelog/index.md
|
|
252
|
+
- Contributing: contributing/overview.md
|
ollama/Modelfile
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
FROM ./crca_lrm.gguf
|
|
2
|
+
|
|
3
|
+
TEMPLATE "<|im_start|>system\n{{ .System }}<|im_end|>\n<|im_start|>user\n{{ .Prompt }}<|im_end|>\n<|im_start|>assistant\n"
|
|
4
|
+
PARAMETER stop "<|im_end|>"
|
|
5
|
+
PARAMETER stop "<|im_start|>"
|
|
6
|
+
PARAMETER num_ctx 8192
|
|
7
|
+
|
|
8
|
+
SYSTEM "You are CR-CA LRM. Use tool-gated reasoning and refuse numeric causal outputs unless validated by crca_core."
|
prompts/__init__.py
CHANGED
|
@@ -5,6 +5,7 @@ Contains system prompts and instructions for LLM agents using CRCAAgent.
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from .default_crca import DEFAULT_CRCA_SYSTEM_PROMPT
|
|
8
|
+
from .image_annotation import RESTRICTED_LABELER_SYSTEM_PROMPT
|
|
8
9
|
|
|
9
|
-
__all__ = ['DEFAULT_CRCA_SYSTEM_PROMPT']
|
|
10
|
+
__all__ = ['DEFAULT_CRCA_SYSTEM_PROMPT', 'RESTRICTED_LABELER_SYSTEM_PROMPT']
|
|
10
11
|
|
prompts/default_crca.py
CHANGED
|
@@ -29,7 +29,15 @@ Your primary role is to help users perform causal reasoning, counterfactual anal
|
|
|
29
29
|
|
|
30
30
|
## Available Tools
|
|
31
31
|
|
|
32
|
-
You have access to
|
|
32
|
+
You have access to several specialized tools that you can call as functions:
|
|
33
|
+
|
|
34
|
+
### Image Annotation Tools (if available)
|
|
35
|
+
|
|
36
|
+
**annotate_image**: Annotate images with geometric primitives, semantic labels, and measurements. Automatically detects image type, tunes parameters, and extracts primitives. Use this when you need to analyze images, extract geometric features, or get structured annotations.
|
|
37
|
+
|
|
38
|
+
**query_image**: Answer specific queries about images using natural language. Use this when you need to find specific objects, measure dimensions, count items, or answer questions about image content.
|
|
39
|
+
|
|
40
|
+
### Causal Reasoning Tools
|
|
33
41
|
|
|
34
42
|
### 1. extract_causal_variables
|
|
35
43
|
**When to use:** When the causal graph is empty or you need to identify variables and relationships from a task description.
|