tensorcode 0.1.0a1__tar.gz → 0.4.0a3__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.
- tensorcode-0.4.0a3/.gitignore +18 -0
- tensorcode-0.4.0a3/CHANGELOG.md +76 -0
- tensorcode-0.4.0a3/PKG-INFO +194 -0
- tensorcode-0.4.0a3/README.md +127 -0
- tensorcode-0.4.0a3/docs/README.md +66 -0
- tensorcode-0.4.0a3/docs/cognition.md +352 -0
- tensorcode-0.4.0a3/docs/latent-models.md +196 -0
- tensorcode-0.4.0a3/docs/migration.md +62 -0
- tensorcode-0.4.0a3/docs/operations.md +264 -0
- tensorcode-0.4.0a3/docs/pretrained.md +140 -0
- tensorcode-0.4.0a3/docs/quickstart.md +100 -0
- tensorcode-0.4.0a3/docs/results/README.md +85 -0
- tensorcode-0.4.0a3/docs/results/action-outcomes.json +47 -0
- tensorcode-0.4.0a3/docs/results/augmented-native-foundation-evidence-controls.json +2193 -0
- tensorcode-0.4.0a3/docs/results/augmented-native-foundation-quality-development.json +868 -0
- tensorcode-0.4.0a3/docs/results/banking77-in-process.json +30 -0
- tensorcode-0.4.0a3/docs/results/banking77-restart.json +112 -0
- tensorcode-0.4.0a3/docs/results/bounded-foundation-evidence-controls.json +2146 -0
- tensorcode-0.4.0a3/docs/results/bounded-foundation-quality-development.json +605 -0
- tensorcode-0.4.0a3/docs/results/bounded-workspace-quality-development.json +436 -0
- tensorcode-0.4.0a3/docs/results/candidate-ranking-development.json +1392 -0
- tensorcode-0.4.0a3/docs/results/chatbot-hotpot.json +736 -0
- tensorcode-0.4.0a3/docs/results/claim-verbalization-development.json +130 -0
- tensorcode-0.4.0a3/docs/results/cognition-diagnostic.json +13073 -0
- tensorcode-0.4.0a3/docs/results/cognition-hotpot.json +14427 -0
- tensorcode-0.4.0a3/docs/results/cognition-xl-development.json +538 -0
- tensorcode-0.4.0a3/docs/results/cognition-xl-source-development.json +438 -0
- tensorcode-0.4.0a3/docs/results/cognition-xl-stage-diagnosis.json +2070 -0
- tensorcode-0.4.0a3/docs/results/cognitive-coverage-development.json +720 -0
- tensorcode-0.4.0a3/docs/results/foundation-quality-development.json +479 -0
- tensorcode-0.4.0a3/docs/results/foundation-scale-development.json +2053 -0
- tensorcode-0.4.0a3/docs/results/generative-quality-development.json +120 -0
- tensorcode-0.4.0a3/docs/results/hypotheses-qa2d.json +10948 -0
- tensorcode-0.4.0a3/docs/results/investigator-hotpot.json +1555 -0
- tensorcode-0.4.0a3/docs/results/joint-evidence-diagnostic.json +76 -0
- tensorcode-0.4.0a3/docs/results/latent-foundations-a2.json +652 -0
- tensorcode-0.4.0a3/docs/results/latent-foundations.json +276 -0
- tensorcode-0.4.0a3/docs/results/multimodal-qwen3-vl-2b.json +57 -0
- tensorcode-0.4.0a3/docs/results/multimodal-smolvlm-256m.json +41 -0
- tensorcode-0.4.0a3/docs/results/mutag.json +240 -0
- tensorcode-0.4.0a3/docs/results/native-foundation-evidence-controls.json +2146 -0
- tensorcode-0.4.0a3/docs/results/native-foundation-quality-development.json +681 -0
- tensorcode-0.4.0a3/docs/results/output-encoding-learning.json +57 -0
- tensorcode-0.4.0a3/docs/results/planner-hotpot.json +1555 -0
- tensorcode-0.4.0a3/docs/results/pretrained-configuration-refresh.json +80 -0
- tensorcode-0.4.0a3/docs/results/pretrained-releases.json +330 -0
- tensorcode-0.4.0a3/docs/results/quality-collapse-diagnostic.json +122 -0
- tensorcode-0.4.0a3/docs/results/quality-gates-development.json +1316 -0
- tensorcode-0.4.0a3/docs/results/quality-scope-development.json +2271 -0
- tensorcode-0.4.0a3/docs/results/realization-qa2d.json +1780 -0
- tensorcode-0.4.0a3/docs/results/response-quality-comparisons.json +247 -0
- tensorcode-0.4.0a3/docs/results/response-quality-pilot.json +1468 -0
- tensorcode-0.4.0a3/docs/results/response-quality-v2.json +952 -0
- tensorcode-0.4.0a3/docs/results/scene-language.json +6237 -0
- tensorcode-0.4.0a3/docs/results/scene-vsr.json +262 -0
- tensorcode-0.4.0a3/docs/results/typed-decisions-flan-t5-base.json +139 -0
- tensorcode-0.4.0a3/docs/results/verifier-snli.json +6328 -0
- tensorcode-0.4.0a3/docs/results/workspace-quality-development.json +245 -0
- tensorcode-0.4.0a3/docs/tools.md +284 -0
- tensorcode-0.4.0a3/docs/training.md +260 -0
- tensorcode-0.4.0a3/docs/troubleshooting.md +43 -0
- tensorcode-0.4.0a3/docs/validation.md +490 -0
- tensorcode-0.4.0a3/examples/README.md +531 -0
- tensorcode-0.4.0a3/examples/banking77_restart.py +187 -0
- tensorcode-0.4.0a3/examples/compare_cognitive_verifiers.py +258 -0
- tensorcode-0.4.0a3/examples/document_search.py +180 -0
- tensorcode-0.4.0a3/examples/evaluate_cognition.py +292 -0
- tensorcode-0.4.0a3/examples/evaluate_scene_language.py +97 -0
- tensorcode-0.4.0a3/examples/evaluate_typed_decisions.py +186 -0
- tensorcode-0.4.0a3/examples/hypothesis_learning.py +218 -0
- tensorcode-0.4.0a3/examples/image_inspection.py +128 -0
- tensorcode-0.4.0a3/examples/learn_action_outcomes.py +151 -0
- tensorcode-0.4.0a3/examples/local_multimodal.py +77 -0
- tensorcode-0.4.0a3/examples/output_encoding_learning.py +86 -0
- tensorcode-0.4.0a3/examples/owned_vector_lifecycle.py +69 -0
- tensorcode-0.4.0a3/examples/plan_learning.py +199 -0
- tensorcode-0.4.0a3/examples/prepare_response_quality.py +219 -0
- tensorcode-0.4.0a3/examples/pretrained_chatbot.py +35 -0
- tensorcode-0.4.0a3/examples/pretrained_latent_lifecycle.py +181 -0
- tensorcode-0.4.0a3/examples/research_assistant.py +191 -0
- tensorcode-0.4.0a3/examples/support_triage.py +132 -0
- tensorcode-0.4.0a3/examples/train_chatbot.py +206 -0
- tensorcode-0.4.0a3/examples/train_cognitive_tools.py +209 -0
- tensorcode-0.4.0a3/examples/train_hypotheses.py +419 -0
- tensorcode-0.4.0a3/examples/train_realization.py +277 -0
- tensorcode-0.4.0a3/examples/train_response_quality.py +499 -0
- tensorcode-0.4.0a3/examples/train_scene.py +118 -0
- tensorcode-0.4.0a3/examples/train_verifier.py +251 -0
- tensorcode-0.4.0a3/pyproject.toml +54 -0
- tensorcode-0.4.0a3/src/tensorcode/__init__.py +5 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/__init__.py +1 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/cognition/__init__.py +1 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/cognition/locking.py +60 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/cognition/policy.py +69 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/cognition/session.py +410 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/cognition/state.py +153 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/execution/__init__.py +1 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/execution/action_loop.py +78 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/execution/planning.py +258 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/latent_ops.py +69 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/memory/__init__.py +1 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/memory/episodic.py +99 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/memory/json.py +291 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/memory/learned.py +142 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/memory/messages.py +104 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/operation_config.py +85 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/pretrained.py +229 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/proposals.py +119 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/ranking.py +272 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/response_quality.py +316 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/retrieval.py +171 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/sessions/__init__.py +1 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/sessions/chat.py +97 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/sessions/ranking.py +126 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/text/__init__.py +1 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/text/native.py +164 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/text/owned.py +198 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/text/realization.py +34 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/tracing.py +434 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/training/__init__.py +1 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/training/_tensor_store.py +103 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/training/checkpoint.py +164 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/training/persistence.py +318 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/training/tool.py +189 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/training/trainer.py +112 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/__init__.py +1 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/adapter.py +71 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/diffusion.py +295 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/owned.py +274 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/patch.py +168 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/sequence.py +46 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/text.py +410 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/vision.py +210 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/vec/vocabulary.py +58 -0
- tensorcode-0.4.0a3/src/tensorcode/_internal/workspace.py +90 -0
- tensorcode-0.4.0a3/src/tensorcode/integrations/__init__.py +21 -0
- tensorcode-0.4.0a3/src/tensorcode/integrations/_http.py +79 -0
- tensorcode-0.4.0a3/src/tensorcode/integrations/jev.py +195 -0
- tensorcode-0.4.0a3/src/tensorcode/integrations/local.py +119 -0
- tensorcode-0.4.0a3/src/tensorcode/integrations/openai.py +215 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/__init__.py +4 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/base.py +36 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/__init__.py +20 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/_symbolic.py +34 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/classify.py +16 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/decide.py +33 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/decode.py +27 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/encode.py +27 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/representation.py +200 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/retrieve.py +16 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/score.py +16 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/graph/transform.py +16 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/__init__.py +39 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/_structured.py +294 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/ask.py +77 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/classify.py +120 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/decide.py +83 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/decode.py +21 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/encode.py +67 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/messages.py +67 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/model.py +73 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/retrieve.py +141 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/score.py +128 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/text/transform.py +50 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/__init__.py +41 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/_configuration.py +138 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/candidates.py +104 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/classify.py +45 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/decide.py +80 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/decode.py +28 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/encode.py +40 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/latent.py +141 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/retrieve.py +84 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/score.py +133 -0
- tensorcode-0.4.0a3/src/tensorcode/ops/vec/transform.py +9 -0
- tensorcode-0.4.0a3/src/tensorcode/tools/__init__.py +14 -0
- tensorcode-0.4.0a3/src/tensorcode/tools/actions.py +53 -0
- tensorcode-0.4.0a3/src/tensorcode/tools/chatbot.py +585 -0
- tensorcode-0.4.0a3/src/tensorcode/tools/cognition.py +119 -0
- tensorcode-0.4.0a3/src/tensorcode/tools/decision/__init__.py +14 -0
- tensorcode-0.4.0a3/src/tensorcode/tools/investigator.py +396 -0
- tensorcode-0.4.0a3/src/tensorcode/tools/planner.py +133 -0
- tensorcode-0.4.0a3/src/tensorcode/tools/scene.py +566 -0
- tensorcode-0.4.0a3/src/tensorcode/training/__init__.py +110 -0
- tensorcode-0.4.0a3/src/tensorcode/training/calibration.py +151 -0
- tensorcode-0.4.0a3/tests/README.md +18 -0
- tensorcode-0.4.0a3/tests/core/test_async_operations.py +134 -0
- tensorcode-0.4.0a3/tests/examples/conftest.py +25 -0
- tensorcode-0.4.0a3/tests/examples/test_assess_quality_gate.py +139 -0
- tensorcode-0.4.0a3/tests/examples/test_compare_cognitive_verifiers.py +79 -0
- tensorcode-0.4.0a3/tests/examples/test_diagnose_quality_collapse.py +128 -0
- tensorcode-0.4.0a3/tests/examples/test_document_search.py +177 -0
- tensorcode-0.4.0a3/tests/examples/test_evaluate_cognition.py +67 -0
- tensorcode-0.4.0a3/tests/examples/test_evaluate_generator_replacement.py +41 -0
- tensorcode-0.4.0a3/tests/examples/test_evaluate_quality_evidence_controls.py +170 -0
- tensorcode-0.4.0a3/tests/examples/test_hypothesis_learning.py +95 -0
- tensorcode-0.4.0a3/tests/examples/test_image_inspection.py +67 -0
- tensorcode-0.4.0a3/tests/examples/test_learn_action_outcomes.py +38 -0
- tensorcode-0.4.0a3/tests/examples/test_output_encoding_learning.py +41 -0
- tensorcode-0.4.0a3/tests/examples/test_plan_learning.py +101 -0
- tensorcode-0.4.0a3/tests/examples/test_prepare_quality_augmentation.py +133 -0
- tensorcode-0.4.0a3/tests/examples/test_prepare_response_quality.py +62 -0
- tensorcode-0.4.0a3/tests/examples/test_probe_claim_verbalization.py +30 -0
- tensorcode-0.4.0a3/tests/examples/test_probe_foundation_scale.py +105 -0
- tensorcode-0.4.0a3/tests/examples/test_probe_generative_quality.py +218 -0
- tensorcode-0.4.0a3/tests/examples/test_probe_native_quality.py +113 -0
- tensorcode-0.4.0a3/tests/examples/test_probe_quality_scope.py +104 -0
- tensorcode-0.4.0a3/tests/examples/test_quality_interventions.py +115 -0
- tensorcode-0.4.0a3/tests/examples/test_research_assistant.py +145 -0
- tensorcode-0.4.0a3/tests/examples/test_support_triage.py +149 -0
- tensorcode-0.4.0a3/tests/examples/test_train_candidate_ranking.py +127 -0
- tensorcode-0.4.0a3/tests/examples/test_train_chatbot.py +33 -0
- tensorcode-0.4.0a3/tests/examples/test_train_cognitive_tools.py +44 -0
- tensorcode-0.4.0a3/tests/examples/test_train_hypotheses.py +98 -0
- tensorcode-0.4.0a3/tests/examples/test_train_realization.py +70 -0
- tensorcode-0.4.0a3/tests/examples/test_train_response_quality.py +207 -0
- tensorcode-0.4.0a3/tests/examples/test_train_verifier.py +41 -0
- tensorcode-0.4.0a3/tests/examples/test_verify_config_refresh.py +113 -0
- tensorcode-0.4.0a3/tests/examples/test_verify_generative_quality_reload.py +197 -0
- tensorcode-0.4.0a3/tests/graph/test_representation.py +57 -0
- tensorcode-0.4.0a3/tests/graph/test_symbolic_contracts.py +66 -0
- tensorcode-0.4.0a3/tests/integration/test_operation_boundaries.py +57 -0
- tensorcode-0.4.0a3/tests/integration/test_public_operations.py +38 -0
- tensorcode-0.4.0a3/tests/integration/test_regressions.py +84 -0
- tensorcode-0.4.0a3/tests/integration/test_text_namespace.py +34 -0
- tensorcode-0.4.0a3/tests/models/test_chatbot_model.py +355 -0
- tensorcode-0.4.0a3/tests/models/test_cognitive_chatbot.py +471 -0
- tensorcode-0.4.0a3/tests/models/test_cognitive_tools.py +181 -0
- tensorcode-0.4.0a3/tests/models/test_investigation.py +311 -0
- tensorcode-0.4.0a3/tests/models/test_output_encoding.py +120 -0
- tensorcode-0.4.0a3/tests/models/test_planning_feedback.py +218 -0
- tensorcode-0.4.0a3/tests/models/test_pretrained.py +319 -0
- tensorcode-0.4.0a3/tests/models/test_public_tool_boundaries.py +104 -0
- tensorcode-0.4.0a3/tests/models/test_response_quality.py +241 -0
- tensorcode-0.4.0a3/tests/models/test_retrieval_encoder.py +126 -0
- tensorcode-0.4.0a3/tests/models/test_scene.py +184 -0
- tensorcode-0.4.0a3/tests/models/test_scene_language.py +177 -0
- tensorcode-0.4.0a3/tests/models/test_workspace.py +77 -0
- tensorcode-0.4.0a3/tests/runtime/test_action_loop.py +121 -0
- tensorcode-0.4.0a3/tests/runtime/test_basic_compositions.py +8 -0
- tensorcode-0.4.0a3/tests/runtime/test_cognition.py +452 -0
- tensorcode-0.4.0a3/tests/runtime/test_cognitive_state.py +85 -0
- tensorcode-0.4.0a3/tests/runtime/test_decision.py +55 -0
- tensorcode-0.4.0a3/tests/runtime/test_episodic.py +43 -0
- tensorcode-0.4.0a3/tests/runtime/test_memory.py +133 -0
- tensorcode-0.4.0a3/tests/runtime/test_runtime_message_memory.py +28 -0
- tensorcode-0.4.0a3/tests/text/test_http_providers.py +323 -0
- tensorcode-0.4.0a3/tests/text/test_likelihood_and_questions.py +210 -0
- tensorcode-0.4.0a3/tests/text/test_local_model.py +84 -0
- tensorcode-0.4.0a3/tests/text/test_messages.py +68 -0
- tensorcode-0.4.0a3/tests/text/test_owned_operations.py +151 -0
- tensorcode-0.4.0a3/tests/text/test_structured_operations.py +305 -0
- tensorcode-0.4.0a3/tests/tracing/test_sessions.py +112 -0
- tensorcode-0.4.0a3/tests/training/test_calibration.py +68 -0
- tensorcode-0.4.0a3/tests/training/test_experience_persistence.py +249 -0
- tensorcode-0.4.0a3/tests/training/test_operation_identity.py +42 -0
- tensorcode-0.4.0a3/tests/training/test_public_training_boundaries.py +139 -0
- tensorcode-0.4.0a3/tests/training/test_tool_training.py +383 -0
- tensorcode-0.4.0a3/tests/training/test_trainers.py +127 -0
- tensorcode-0.4.0a3/tests/vec/test_candidates.py +236 -0
- tensorcode-0.4.0a3/tests/vec/test_config_lifecycle.py +44 -0
- tensorcode-0.4.0a3/tests/vec/test_configuration.py +201 -0
- tensorcode-0.4.0a3/tests/vec/test_image_decode.py +227 -0
- tensorcode-0.4.0a3/tests/vec/test_image_encoding.py +199 -0
- tensorcode-0.4.0a3/tests/vec/test_latent.py +100 -0
- tensorcode-0.4.0a3/tests/vec/test_latent_operation.py +38 -0
- tensorcode-0.4.0a3/tests/vec/test_learning_and_hooks.py +69 -0
- tensorcode-0.4.0a3/tests/vec/test_native_configuration_contracts.py +17 -0
- tensorcode-0.4.0a3/tests/vec/test_owned_vector_operations.py +177 -0
- tensorcode-0.4.0a3/tests/vec/test_pretrained_text.py +467 -0
- tensorcode-0.4.0a3/tests/vec/test_pretrained_vision.py +174 -0
- tensorcode-0.4.0a3/tests/vec/test_selector_configuration.py +39 -0
- tensorcode-0.4.0a3/tests/vec/test_text_encoding.py +26 -0
- tensorcode-0.1.0a1/.gitignore +0 -165
- tensorcode-0.1.0a1/PKG-INFO +0 -196
- tensorcode-0.1.0a1/README.md +0 -156
- tensorcode-0.1.0a1/pyproject.toml +0 -54
- tensorcode-0.1.0a1/src/tensorcode/__init__.py +0 -84
- tensorcode-0.1.0a1/src/tensorcode/actions.py +0 -137
- tensorcode-0.1.0a1/src/tensorcode/answer_type.py +0 -222
- tensorcode-0.1.0a1/src/tensorcode/awareness.py +0 -344
- tensorcode-0.1.0a1/src/tensorcode/backends/__init__.py +0 -0
- tensorcode-0.1.0a1/src/tensorcode/backends/builtin.py +0 -167
- tensorcode-0.1.0a1/src/tensorcode/backends/hf_local.py +0 -89
- tensorcode-0.1.0a1/src/tensorcode/backends/linear.py +0 -133
- tensorcode-0.1.0a1/src/tensorcode/backends/neural.py +0 -361
- tensorcode-0.1.0a1/src/tensorcode/causal.py +0 -262
- tensorcode-0.1.0a1/src/tensorcode/change.py +0 -566
- tensorcode-0.1.0a1/src/tensorcode/chunking.py +0 -195
- tensorcode-0.1.0a1/src/tensorcode/cognition.py +0 -311
- tensorcode-0.1.0a1/src/tensorcode/context.py +0 -97
- tensorcode-0.1.0a1/src/tensorcode/control.py +0 -291
- tensorcode-0.1.0a1/src/tensorcode/cues.py +0 -192
- tensorcode-0.1.0a1/src/tensorcode/expectation.py +0 -270
- tensorcode-0.1.0a1/src/tensorcode/frames.py +0 -232
- tensorcode-0.1.0a1/src/tensorcode/language/__init__.py +0 -36
- tensorcode-0.1.0a1/src/tensorcode/language/chart.py +0 -558
- tensorcode-0.1.0a1/src/tensorcode/language/discourse.py +0 -132
- tensorcode-0.1.0a1/src/tensorcode/language/domains/__init__.py +0 -0
- tensorcode-0.1.0a1/src/tensorcode/language/domains/desktop.py +0 -552
- tensorcode-0.1.0a1/src/tensorcode/language/english.py +0 -459
- tensorcode-0.1.0a1/src/tensorcode/language/features.py +0 -112
- tensorcode-0.1.0a1/src/tensorcode/language/generate.py +0 -574
- tensorcode-0.1.0a1/src/tensorcode/language/grammar.py +0 -893
- tensorcode-0.1.0a1/src/tensorcode/language/semantics.py +0 -349
- tensorcode-0.1.0a1/src/tensorcode/learning/__init__.py +0 -30
- tensorcode-0.1.0a1/src/tensorcode/learning/certificate.py +0 -148
- tensorcode-0.1.0a1/src/tensorcode/learning/induce.py +0 -304
- tensorcode-0.1.0a1/src/tensorcode/learning/library.py +0 -217
- tensorcode-0.1.0a1/src/tensorcode/learning/literals.py +0 -126
- tensorcode-0.1.0a1/src/tensorcode/learning/verify.py +0 -253
- tensorcode-0.1.0a1/src/tensorcode/memory.py +0 -303
- tensorcode-0.1.0a1/src/tensorcode/metacognition.py +0 -351
- tensorcode-0.1.0a1/src/tensorcode/ops.py +0 -207
- tensorcode-0.1.0a1/src/tensorcode/outcomes.py +0 -99
- tensorcode-0.1.0a1/src/tensorcode/permanence.py +0 -376
- tensorcode-0.1.0a1/src/tensorcode/priming.py +0 -191
- tensorcode-0.1.0a1/src/tensorcode/quantity.py +0 -311
- tensorcode-0.1.0a1/src/tensorcode/records.py +0 -728
- tensorcode-0.1.0a1/src/tensorcode/relation.py +0 -771
- tensorcode-0.1.0a1/src/tensorcode/runtime.py +0 -471
- tensorcode-0.1.0a1/src/tensorcode/semantics_bridge.py +0 -308
- tensorcode-0.1.0a1/src/tensorcode/social.py +0 -380
- tensorcode-0.1.0a1/src/tensorcode/temporal.py +0 -189
- tensorcode-0.1.0a1/src/tensorcode/wants.py +0 -185
- {tensorcode-0.1.0a1 → tensorcode-0.4.0a3}/LICENSE +0 -0
- {tensorcode-0.1.0a1 → tensorcode-0.4.0a3}/src/tensorcode/py.typed +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Local environments, credentials and editor preferences
|
|
2
|
+
.venv/
|
|
3
|
+
.env
|
|
4
|
+
.env.*
|
|
5
|
+
.vscode/
|
|
6
|
+
.idea/
|
|
7
|
+
|
|
8
|
+
# Python/build/test artifacts
|
|
9
|
+
__pycache__/
|
|
10
|
+
*.py[cod]
|
|
11
|
+
*.egg-info/
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.ruff_cache/
|
|
14
|
+
.mypy_cache/
|
|
15
|
+
.coverage
|
|
16
|
+
htmlcov/
|
|
17
|
+
build/
|
|
18
|
+
dist/
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `tensorcode` Python package. Versions follow
|
|
4
|
+
[PEP 440](https://peps.python.org/pep-0440/); alpha releases may break APIs.
|
|
5
|
+
See [updating development code](docs/migration.md) for import changes.
|
|
6
|
+
|
|
7
|
+
## 0.4.0a3 (unreleased)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Text operations (`Classify`, `Decide`, `Score`, `Retrieve`) accept
|
|
12
|
+
`decoding='likelihood'`, which scores every authored alternative in one
|
|
13
|
+
encoder pass and returns a full distribution instead of generated JSON.
|
|
14
|
+
- `tensorcode.ops.text.ask` / `aask` ask several named structured questions
|
|
15
|
+
about the same messages; a shared external model that implements
|
|
16
|
+
`complete_questions` answers them in one request.
|
|
17
|
+
- `tensorcode.integrations.JevModel`, an explicit HTTP adapter for typed
|
|
18
|
+
classification, decision and rubric-score requests.
|
|
19
|
+
- `tensorcode.training` calibration utilities: `TemperatureCalibration`,
|
|
20
|
+
`evaluate_calibration` and `fit_threshold`, fitted only on held-out scores.
|
|
21
|
+
- `readout='output_encoding'` for owned text and image encoders: an owned
|
|
22
|
+
trainable token appended after the context.
|
|
23
|
+
- Investigator `verification_scope='joint'` checks a hypothesis against the
|
|
24
|
+
combined evidence and keeps each per-source check.
|
|
25
|
+
- `Investigator.new_cognitive_session(...)` / `load_cognitive_session(...)`,
|
|
26
|
+
`Planner.new_executor(...)` and `tools.actions.action_loop(...)` factories.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Public boundaries are smaller. The session, memory, cognition, execution and
|
|
31
|
+
tracing machinery moved under `tensorcode._internal`. Use root
|
|
32
|
+
`tensorcode.trace`, `Trace`, `InputRef` and `OutputRef`;
|
|
33
|
+
`training.Trainer.from_tool(...)` / `Trainer.from_ops(...)`; and
|
|
34
|
+
`training.load_experience(...)`. `tensorcode.runtime` and
|
|
35
|
+
`tensorcode.tracing` are removed without compatibility aliases.
|
|
36
|
+
- Public operations are constructed from JSON configuration. They own their
|
|
37
|
+
weights and persist with `save_pretrained` / `from_pretrained`. Supplied
|
|
38
|
+
implementations use the explicit `from_module` (vector) and `from_model`
|
|
39
|
+
(text) factories.
|
|
40
|
+
- The Chatbot workspace uses a bounded (`relative_rms_bounded`) memory update.
|
|
41
|
+
Artifacts must match the current architecture exactly.
|
|
42
|
+
- Public records, operations, tools and trainer properties now have
|
|
43
|
+
docstrings. Every `ops.vec` submodule declares `__all__`, so internal
|
|
44
|
+
helpers no longer leak through star imports.
|
|
45
|
+
- Package metadata now includes classifiers, keywords and project, docs and
|
|
46
|
+
changelog URLs. The sdist includes only the documented top-level paths.
|
|
47
|
+
- Tests of the repository's internal `.development` experiments skip, rather
|
|
48
|
+
than fail, when run from the unpacked sdist, which does not ship that tree.
|
|
49
|
+
|
|
50
|
+
### Removed
|
|
51
|
+
|
|
52
|
+
- `DecisionPipeline`, `runtime.*` session/memory/storage classes, the free
|
|
53
|
+
checkpoint functions and `training.ToolTrainer`. See the
|
|
54
|
+
[migration table](docs/migration.md).
|
|
55
|
+
|
|
56
|
+
## 0.4.0a2
|
|
57
|
+
|
|
58
|
+
- Vector APIs are organized by operation. Concrete encoders live in
|
|
59
|
+
`tensorcode.ops.vec.encode` and decoders in `tensorcode.ops.vec.decode`.
|
|
60
|
+
Backend modules are private.
|
|
61
|
+
- Alpha model artifacts were recreated with the current public operation
|
|
62
|
+
identities.
|
|
63
|
+
|
|
64
|
+
## 0.4.0a1
|
|
65
|
+
|
|
66
|
+
- Added owned pretrained vector operations: transformer `TextEncoder` and
|
|
67
|
+
`ImageEncoder`, a seq2seq `TextDecoder` and a latent-diffusion
|
|
68
|
+
`ImageDecoder` (`tensorcode[diffusion]`).
|
|
69
|
+
|
|
70
|
+
## 0.3.0
|
|
71
|
+
|
|
72
|
+
- Added the owned pretrained tool lifecycle (`save_pretrained`,
|
|
73
|
+
`from_pretrained`, Hugging Face Hub loading) and the learned evidence
|
|
74
|
+
workspace shared by Chatbot, Investigator, Planner, Decision and Scene.
|
|
75
|
+
Built distributions are attached to the
|
|
76
|
+
[GitHub release](https://github.com/TensaCo/tensacode-py/releases/tag/v0.3.0).
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: tensorcode
|
|
3
|
+
Version: 0.4.0a3
|
|
4
|
+
Summary: Composable cognitive operations and traceable, trainable Python programs
|
|
5
|
+
Project-URL: Homepage, https://tensorcode.dev
|
|
6
|
+
Project-URL: Documentation, https://tensorcode.dev/docs/
|
|
7
|
+
Project-URL: Source, https://github.com/TensaCo/tensacode-py
|
|
8
|
+
Project-URL: Issues, https://github.com/TensaCo/tensacode-py/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/TensaCo/tensacode-py/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Jacob Valdez <jacob.valdez@tensaco.ai>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agents,cognitive-architecture,llm,machine-learning,pytorch,tracing,training,transformers
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
29
|
+
Requires-Dist: pillow>=10; extra == 'dev'
|
|
30
|
+
Requires-Dist: pyarrow>=18; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
32
|
+
Provides-Extra: diffusion
|
|
33
|
+
Requires-Dist: diffusers<1,>=0.40; extra == 'diffusion'
|
|
34
|
+
Requires-Dist: huggingface-hub>=0.34; extra == 'diffusion'
|
|
35
|
+
Requires-Dist: pillow>=10; extra == 'diffusion'
|
|
36
|
+
Requires-Dist: safetensors>=0.4; extra == 'diffusion'
|
|
37
|
+
Requires-Dist: tokenizers>=0.21; extra == 'diffusion'
|
|
38
|
+
Requires-Dist: torch>=2.4; extra == 'diffusion'
|
|
39
|
+
Requires-Dist: torchvision>=0.19; extra == 'diffusion'
|
|
40
|
+
Requires-Dist: transformers<6,>=5.0; extra == 'diffusion'
|
|
41
|
+
Provides-Extra: local
|
|
42
|
+
Requires-Dist: pillow>=10; extra == 'local'
|
|
43
|
+
Requires-Dist: torch>=2.4; extra == 'local'
|
|
44
|
+
Requires-Dist: torchvision>=0.19; extra == 'local'
|
|
45
|
+
Requires-Dist: transformers<6,>=5.0; extra == 'local'
|
|
46
|
+
Provides-Extra: pretrained
|
|
47
|
+
Requires-Dist: huggingface-hub>=0.34; extra == 'pretrained'
|
|
48
|
+
Requires-Dist: pillow>=10; extra == 'pretrained'
|
|
49
|
+
Requires-Dist: safetensors>=0.4; extra == 'pretrained'
|
|
50
|
+
Requires-Dist: tokenizers>=0.21; extra == 'pretrained'
|
|
51
|
+
Requires-Dist: torch>=2.4; extra == 'pretrained'
|
|
52
|
+
Requires-Dist: torchvision>=0.19; extra == 'pretrained'
|
|
53
|
+
Requires-Dist: transformers<6,>=5.0; extra == 'pretrained'
|
|
54
|
+
Provides-Extra: tools
|
|
55
|
+
Requires-Dist: huggingface-hub>=0.34; extra == 'tools'
|
|
56
|
+
Requires-Dist: pillow>=10; extra == 'tools'
|
|
57
|
+
Requires-Dist: safetensors>=0.4; extra == 'tools'
|
|
58
|
+
Requires-Dist: tokenizers>=0.21; extra == 'tools'
|
|
59
|
+
Requires-Dist: torch>=2.4; extra == 'tools'
|
|
60
|
+
Requires-Dist: torchvision>=0.19; extra == 'tools'
|
|
61
|
+
Requires-Dist: transformers<6,>=5.0; extra == 'tools'
|
|
62
|
+
Provides-Extra: vec
|
|
63
|
+
Requires-Dist: numpy>=1.26; extra == 'vec'
|
|
64
|
+
Requires-Dist: safetensors>=0.4; extra == 'vec'
|
|
65
|
+
Requires-Dist: torch>=2.4; extra == 'vec'
|
|
66
|
+
Description-Content-Type: text/markdown
|
|
67
|
+
|
|
68
|
+
# TensorCode
|
|
69
|
+
|
|
70
|
+
**Website:** [tensorcode.dev](https://tensorcode.dev) ·
|
|
71
|
+
**Docs:** [tensorcode.dev/docs](https://tensorcode.dev/docs/) ·
|
|
72
|
+
**Source:** [GitHub](https://github.com/TensaCo/tensacode-py) ·
|
|
73
|
+
[Changelog](https://github.com/TensaCo/tensacode-py/blob/main/CHANGELOG.md)
|
|
74
|
+
|
|
75
|
+
TensorCode builds trainable Python programs from callable operations and small
|
|
76
|
+
tools that own their models. You compose encoders, scorers and decoders
|
|
77
|
+
(`tensorcode.ops`), or use a complete tool such as `Investigator`, `Planner` or
|
|
78
|
+
`Chatbot` (`tensorcode.tools`). You collect reviewed feedback with explicit
|
|
79
|
+
provenance, train with PyTorch, and save everything as a data-only artifact that
|
|
80
|
+
reloads in a fresh process or from the Hugging Face Hub. Tracing records which
|
|
81
|
+
operation produced which value, so supervised local tensor paths can be replayed
|
|
82
|
+
and trained. It does not make arbitrary Python or remote model calls
|
|
83
|
+
differentiable.
|
|
84
|
+
|
|
85
|
+
> **Status: 0.4.0 alpha.** APIs may change between alphas. The core package has
|
|
86
|
+
> no dependencies and importing it does not import PyTorch or touch the network.
|
|
87
|
+
> Measured behavior and its limits are in [validation](docs/validation.md).
|
|
88
|
+
> Consistent benefits of the learned cognitive workspace are not yet established.
|
|
89
|
+
|
|
90
|
+
## Install
|
|
91
|
+
|
|
92
|
+
Python 3.11+. PyPI currently hosts only an older 0.1 alpha, so install 0.4 from
|
|
93
|
+
GitHub:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
python -m pip install "tensorcode[tools] @ git+https://github.com/TensaCo/tensacode-py"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
From a checkout, use `python -m pip install -e '.[tools]'`. Choose the extras
|
|
100
|
+
for the interfaces you use:
|
|
101
|
+
|
|
102
|
+
| Extra | Adds |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `tools` | Owned models, training and Hugging Face loading (PyTorch, Transformers) |
|
|
105
|
+
| `vec` | Vector operations only (PyTorch, NumPy, safetensors) |
|
|
106
|
+
| `local` | Adapter for a local multimodal Transformers model |
|
|
107
|
+
| `diffusion` | `tools` plus diffusers for image decoders |
|
|
108
|
+
| `pretrained` | Alias of `tools` |
|
|
109
|
+
| `dev` | pytest, build, Pillow and PyArrow; the full test suite also needs `diffusion` |
|
|
110
|
+
|
|
111
|
+
## 30-second example
|
|
112
|
+
|
|
113
|
+
This trains an `Investigator` to rank two supplied hypotheses from log evidence.
|
|
114
|
+
It saves the model and reloads it. It runs offline on CPU in a few seconds.
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import torch
|
|
118
|
+
from tensorcode import training
|
|
119
|
+
from tensorcode.tools.investigator import Investigator
|
|
120
|
+
|
|
121
|
+
torch.manual_seed(0)
|
|
122
|
+
model = Investigator({"vocabulary": ["database", "network", "connection", "refused", "packet", "loss"],
|
|
123
|
+
"dimensions": 16, "slots": 2, "steps": 1})
|
|
124
|
+
trainer = training.Trainer.from_tool(model, optimizer=torch.optim.AdamW(model.parameters(), lr=0.01))
|
|
125
|
+
|
|
126
|
+
hypotheses = [{"id": "database", "text": "database connection refused"},
|
|
127
|
+
{"id": "network", "text": "network packet loss"}]
|
|
128
|
+
|
|
129
|
+
def case(log_line):
|
|
130
|
+
return {"question": "which component failed",
|
|
131
|
+
"evidence": [{"source_id": "log:1", "text": log_line}],
|
|
132
|
+
"hypotheses": hypotheses}
|
|
133
|
+
|
|
134
|
+
# Reviewed feedback, with explicit provenance, becomes training experience.
|
|
135
|
+
experiences = [trainer.capture(case("connection refused"), "database", source="review:1"),
|
|
136
|
+
trainer.capture(case("packet loss"), "network", source="review:2")]
|
|
137
|
+
losses = trainer.fit(experiences, epochs=30)
|
|
138
|
+
|
|
139
|
+
model.save_pretrained("./investigator")
|
|
140
|
+
restored = Investigator.from_pretrained("./investigator")
|
|
141
|
+
print(restored(case("packet loss"))["selected_id"]) # network
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Two authored cases show the lifecycle. They do not show that the model can
|
|
145
|
+
investigate anything. The result also includes every candidate's score and the
|
|
146
|
+
source-linked evidence. Probabilities are uncalibrated. The
|
|
147
|
+
[quickstart](docs/quickstart.md) extends this to persisted experience files,
|
|
148
|
+
resumable training checkpoints and loading in a fresh process.
|
|
149
|
+
|
|
150
|
+
## What is inside
|
|
151
|
+
|
|
152
|
+
- **`tensorcode.ops.vec`, `ops.text`, `ops.graph`**: operations with one calling
|
|
153
|
+
convention, `op(value, *, context=None)`. Operations are built from JSON
|
|
154
|
+
configuration, and learned vector operations own their weights. Text
|
|
155
|
+
operations wrap an owned seq2seq model or an explicit external provider.
|
|
156
|
+
Graph operations are reserved symbolic interfaces that raise
|
|
157
|
+
`NotImplementedError`.
|
|
158
|
+
- **`tensorcode.tools`**: `Chatbot`, `Investigator`, `Decision`, `Planner` and
|
|
159
|
+
`Scene`, complete trainable models with `save_pretrained` / `from_pretrained`.
|
|
160
|
+
- **`tensorcode.trace()` and `tensorcode.training`**: dependency capture,
|
|
161
|
+
explicit supervision, `Trainer.from_tool` / `Trainer.from_ops`, portable
|
|
162
|
+
experience and complete checkpoints.
|
|
163
|
+
- **`tensorcode.integrations`**: explicit adapters for OpenAI-compatible
|
|
164
|
+
endpoints, local Transformers models and Jev.
|
|
165
|
+
|
|
166
|
+
Generated hypotheses are not evidence, and generated plans are not executable
|
|
167
|
+
code. Evidence, policies and actions stay explicit in your code.
|
|
168
|
+
|
|
169
|
+
## Guides
|
|
170
|
+
|
|
171
|
+
- [Quickstart](docs/quickstart.md): a runnable offline training lifecycle.
|
|
172
|
+
- [Developer documentation](docs/README.md): operation and model contracts.
|
|
173
|
+
- [Pretrained checkpoints](docs/pretrained.md): hosted tools and their measured
|
|
174
|
+
scope. Saved artifacts must match the current architecture exactly: the hosted
|
|
175
|
+
Chatbot and cognitive Investigator checkpoints need source commit `6607a8b`;
|
|
176
|
+
only the Hotpot Investigator and Decision have refreshed revisions verified on
|
|
177
|
+
current source.
|
|
178
|
+
- [Evidence and cognition](docs/cognition.md): hypotheses, revisions, memory and outcome feedback.
|
|
179
|
+
- [Training](docs/training.md): tracing, replay and resumable checkpoints.
|
|
180
|
+
- [Examples](examples/README.md): learning agents and practical applications.
|
|
181
|
+
- [Validation](docs/validation.md): measured behavior and limitations.
|
|
182
|
+
- [Updating development code](docs/migration.md): import changes since earlier alphas.
|
|
183
|
+
|
|
184
|
+
## Development
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
python -m pip install -e '.[tools,diffusion,dev]'
|
|
188
|
+
python -m pytest -q
|
|
189
|
+
python -m build
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Library code lives in `src/tensorcode`. See the [test guide](tests/README.md) for
|
|
193
|
+
how the suite is organized. This alpha API replaces the former provider-owned
|
|
194
|
+
tools, and there is no legacy compatibility layer. [MIT license](LICENSE).
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# TensorCode
|
|
2
|
+
|
|
3
|
+
**Website:** [tensorcode.dev](https://tensorcode.dev) ·
|
|
4
|
+
**Docs:** [tensorcode.dev/docs](https://tensorcode.dev/docs/) ·
|
|
5
|
+
**Source:** [GitHub](https://github.com/TensaCo/tensacode-py) ·
|
|
6
|
+
[Changelog](https://github.com/TensaCo/tensacode-py/blob/main/CHANGELOG.md)
|
|
7
|
+
|
|
8
|
+
TensorCode builds trainable Python programs from callable operations and small
|
|
9
|
+
tools that own their models. You compose encoders, scorers and decoders
|
|
10
|
+
(`tensorcode.ops`), or use a complete tool such as `Investigator`, `Planner` or
|
|
11
|
+
`Chatbot` (`tensorcode.tools`). You collect reviewed feedback with explicit
|
|
12
|
+
provenance, train with PyTorch, and save everything as a data-only artifact that
|
|
13
|
+
reloads in a fresh process or from the Hugging Face Hub. Tracing records which
|
|
14
|
+
operation produced which value, so supervised local tensor paths can be replayed
|
|
15
|
+
and trained. It does not make arbitrary Python or remote model calls
|
|
16
|
+
differentiable.
|
|
17
|
+
|
|
18
|
+
> **Status: 0.4.0 alpha.** APIs may change between alphas. The core package has
|
|
19
|
+
> no dependencies and importing it does not import PyTorch or touch the network.
|
|
20
|
+
> Measured behavior and its limits are in [validation](docs/validation.md).
|
|
21
|
+
> Consistent benefits of the learned cognitive workspace are not yet established.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Python 3.11+. PyPI currently hosts only an older 0.1 alpha, so install 0.4 from
|
|
26
|
+
GitHub:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python -m pip install "tensorcode[tools] @ git+https://github.com/TensaCo/tensacode-py"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
From a checkout, use `python -m pip install -e '.[tools]'`. Choose the extras
|
|
33
|
+
for the interfaces you use:
|
|
34
|
+
|
|
35
|
+
| Extra | Adds |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `tools` | Owned models, training and Hugging Face loading (PyTorch, Transformers) |
|
|
38
|
+
| `vec` | Vector operations only (PyTorch, NumPy, safetensors) |
|
|
39
|
+
| `local` | Adapter for a local multimodal Transformers model |
|
|
40
|
+
| `diffusion` | `tools` plus diffusers for image decoders |
|
|
41
|
+
| `pretrained` | Alias of `tools` |
|
|
42
|
+
| `dev` | pytest, build, Pillow and PyArrow; the full test suite also needs `diffusion` |
|
|
43
|
+
|
|
44
|
+
## 30-second example
|
|
45
|
+
|
|
46
|
+
This trains an `Investigator` to rank two supplied hypotheses from log evidence.
|
|
47
|
+
It saves the model and reloads it. It runs offline on CPU in a few seconds.
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import torch
|
|
51
|
+
from tensorcode import training
|
|
52
|
+
from tensorcode.tools.investigator import Investigator
|
|
53
|
+
|
|
54
|
+
torch.manual_seed(0)
|
|
55
|
+
model = Investigator({"vocabulary": ["database", "network", "connection", "refused", "packet", "loss"],
|
|
56
|
+
"dimensions": 16, "slots": 2, "steps": 1})
|
|
57
|
+
trainer = training.Trainer.from_tool(model, optimizer=torch.optim.AdamW(model.parameters(), lr=0.01))
|
|
58
|
+
|
|
59
|
+
hypotheses = [{"id": "database", "text": "database connection refused"},
|
|
60
|
+
{"id": "network", "text": "network packet loss"}]
|
|
61
|
+
|
|
62
|
+
def case(log_line):
|
|
63
|
+
return {"question": "which component failed",
|
|
64
|
+
"evidence": [{"source_id": "log:1", "text": log_line}],
|
|
65
|
+
"hypotheses": hypotheses}
|
|
66
|
+
|
|
67
|
+
# Reviewed feedback, with explicit provenance, becomes training experience.
|
|
68
|
+
experiences = [trainer.capture(case("connection refused"), "database", source="review:1"),
|
|
69
|
+
trainer.capture(case("packet loss"), "network", source="review:2")]
|
|
70
|
+
losses = trainer.fit(experiences, epochs=30)
|
|
71
|
+
|
|
72
|
+
model.save_pretrained("./investigator")
|
|
73
|
+
restored = Investigator.from_pretrained("./investigator")
|
|
74
|
+
print(restored(case("packet loss"))["selected_id"]) # network
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Two authored cases show the lifecycle. They do not show that the model can
|
|
78
|
+
investigate anything. The result also includes every candidate's score and the
|
|
79
|
+
source-linked evidence. Probabilities are uncalibrated. The
|
|
80
|
+
[quickstart](docs/quickstart.md) extends this to persisted experience files,
|
|
81
|
+
resumable training checkpoints and loading in a fresh process.
|
|
82
|
+
|
|
83
|
+
## What is inside
|
|
84
|
+
|
|
85
|
+
- **`tensorcode.ops.vec`, `ops.text`, `ops.graph`**: operations with one calling
|
|
86
|
+
convention, `op(value, *, context=None)`. Operations are built from JSON
|
|
87
|
+
configuration, and learned vector operations own their weights. Text
|
|
88
|
+
operations wrap an owned seq2seq model or an explicit external provider.
|
|
89
|
+
Graph operations are reserved symbolic interfaces that raise
|
|
90
|
+
`NotImplementedError`.
|
|
91
|
+
- **`tensorcode.tools`**: `Chatbot`, `Investigator`, `Decision`, `Planner` and
|
|
92
|
+
`Scene`, complete trainable models with `save_pretrained` / `from_pretrained`.
|
|
93
|
+
- **`tensorcode.trace()` and `tensorcode.training`**: dependency capture,
|
|
94
|
+
explicit supervision, `Trainer.from_tool` / `Trainer.from_ops`, portable
|
|
95
|
+
experience and complete checkpoints.
|
|
96
|
+
- **`tensorcode.integrations`**: explicit adapters for OpenAI-compatible
|
|
97
|
+
endpoints, local Transformers models and Jev.
|
|
98
|
+
|
|
99
|
+
Generated hypotheses are not evidence, and generated plans are not executable
|
|
100
|
+
code. Evidence, policies and actions stay explicit in your code.
|
|
101
|
+
|
|
102
|
+
## Guides
|
|
103
|
+
|
|
104
|
+
- [Quickstart](docs/quickstart.md): a runnable offline training lifecycle.
|
|
105
|
+
- [Developer documentation](docs/README.md): operation and model contracts.
|
|
106
|
+
- [Pretrained checkpoints](docs/pretrained.md): hosted tools and their measured
|
|
107
|
+
scope. Saved artifacts must match the current architecture exactly: the hosted
|
|
108
|
+
Chatbot and cognitive Investigator checkpoints need source commit `6607a8b`;
|
|
109
|
+
only the Hotpot Investigator and Decision have refreshed revisions verified on
|
|
110
|
+
current source.
|
|
111
|
+
- [Evidence and cognition](docs/cognition.md): hypotheses, revisions, memory and outcome feedback.
|
|
112
|
+
- [Training](docs/training.md): tracing, replay and resumable checkpoints.
|
|
113
|
+
- [Examples](examples/README.md): learning agents and practical applications.
|
|
114
|
+
- [Validation](docs/validation.md): measured behavior and limitations.
|
|
115
|
+
- [Updating development code](docs/migration.md): import changes since earlier alphas.
|
|
116
|
+
|
|
117
|
+
## Development
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
python -m pip install -e '.[tools,diffusion,dev]'
|
|
121
|
+
python -m pytest -q
|
|
122
|
+
python -m build
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Library code lives in `src/tensorcode`. See the [test guide](tests/README.md) for
|
|
126
|
+
how the suite is organized. This alpha API replaces the former provider-owned
|
|
127
|
+
tools, and there is no legacy compatibility layer. [MIT license](LICENSE).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# TensorCode documentation
|
|
2
|
+
|
|
3
|
+
TensorCode separates callable operations, owned trainable models, application
|
|
4
|
+
runtime state and durable training experience. Start with the
|
|
5
|
+
[quickstart](quickstart.md) for a complete offline model lifecycle.
|
|
6
|
+
|
|
7
|
+
| Guide | Contents |
|
|
8
|
+
|---|---|
|
|
9
|
+
| [Pretrained checkpoints](pretrained.md) | Hosted tool catalog, pinned loading, scope and publication |
|
|
10
|
+
| [Quickstart](quickstart.md) | Install, initialize, collect feedback, train, save and reload |
|
|
11
|
+
| [Operations](operations.md) | Vector/message contracts, encoders, decoders and symbolic graph interfaces |
|
|
12
|
+
| [Pretrained vector models](latent-models.md) | Transformer encoding, text/diffusion decoding, training, canonical imports and owned configuration |
|
|
13
|
+
| [Tools](tools.md) | Owned models, shared workspace, pretrained artifacts and sessions |
|
|
14
|
+
| [Cognition](cognition.md) | Sourced evidence, generated proposals, verification, revision and action feedback |
|
|
15
|
+
| [Training](training.md) | Tool objectives, tracing, replay and resumable checkpoints |
|
|
16
|
+
| [Examples](../examples/README.md) | Learning agents and applications with explicit inputs |
|
|
17
|
+
| [Validation](validation.md) | Measured behavior, pretrained provenance and remaining gaps |
|
|
18
|
+
| [Evaluation records](results/README.md) | Machine-readable measurements |
|
|
19
|
+
| [Troubleshooting](troubleshooting.md) | Loading, gradients, replay and session errors |
|
|
20
|
+
| [Updating development code](migration.md) | New public imports, tool factories and saved-data continuity |
|
|
21
|
+
|
|
22
|
+
## Public boundaries
|
|
23
|
+
|
|
24
|
+
`tensorcode.ops.{vec,text,graph}` contains callable operations. Developers assign
|
|
25
|
+
names for cognitive roles; the same transform can participate in interpretation,
|
|
26
|
+
revision or response formulation. Representation contracts matter: equal tensor
|
|
27
|
+
shapes do not make independently trained encoders interchangeable. Concrete vector
|
|
28
|
+
encoders live in `tensorcode.ops.vec.encode`, and decoders in
|
|
29
|
+
`tensorcode.ops.vec.decode`; root exports are conveniences. Backend modules are
|
|
30
|
+
private. See the [operation API](operations.md) and
|
|
31
|
+
[owned operation contracts](latent-models.md#public-paths-and-owned-configuration).
|
|
32
|
+
|
|
33
|
+
Learned operation constructors accept JSON configuration and own their model
|
|
34
|
+
parameters. Explicit `from_foundation` factories initialize supported pretrained
|
|
35
|
+
architectures; `save_pretrained`/`from_pretrained` persist owned artifacts.
|
|
36
|
+
Advanced vector `from_module` and text `from_model` factories integrate supplied
|
|
37
|
+
implementations with explicit reconstruction limits. Weightless operations accept
|
|
38
|
+
optional configuration; graph calls still raise `NotImplementedError`.
|
|
39
|
+
|
|
40
|
+
`tensorcode.tools` contains owned PyTorch models: Chatbot, Investigator, Planner,
|
|
41
|
+
Decision and Scene. Scene combines image patches and text through the shared
|
|
42
|
+
workspace to rank supplied descriptions or, with an owned language foundation,
|
|
43
|
+
produce explicitly unverified image interpretations. Neither mode constructs
|
|
44
|
+
symbolic scene graphs. Constructors initialize all
|
|
45
|
+
parameters; `from_pretrained` loads complete model artifacts from a local directory
|
|
46
|
+
or the Hugging Face Hub. An external foundation model can bootstrap training, but
|
|
47
|
+
its inherited competence does not establish that a new workspace has learned.
|
|
48
|
+
|
|
49
|
+
Tools construct their sessions and execution helpers. `tools.cognition` exposes
|
|
50
|
+
evidence and interpretation records; `tools.actions` exposes action callback
|
|
51
|
+
records and an explicit bounded-loop factory. Planner exposes structured plan
|
|
52
|
+
contracts and `new_executor(...)`. Evidence, policies and action implementations
|
|
53
|
+
remain explicit, while memory storage and state transitions stay internal.
|
|
54
|
+
Generated hypotheses are not source evidence; generated plans are not executable
|
|
55
|
+
action code. The general core supplies no domain ontology or implicit authority.
|
|
56
|
+
|
|
57
|
+
Root `tensorcode.trace()` and `tensorcode.training` capture operation dependencies and
|
|
58
|
+
train supported local tensor paths independently of an agent harness. Tracing does
|
|
59
|
+
not make arbitrary Python, remote model calls or discrete choices differentiable.
|
|
60
|
+
Graph operations currently declare symbolic interfaces without implementations.
|
|
61
|
+
|
|
62
|
+
Choose `training.Trainer.from_tool(model)` for a declared model objective, or
|
|
63
|
+
`training.Trainer.from_ops(operations, losses=...)` for a composed program. Load
|
|
64
|
+
saved experience through `training.load_experience(...)`; save optimization state
|
|
65
|
+
through the trainer's checkpoint methods. Root `Trace`, `InputRef` and `OutputRef`
|
|
66
|
+
provide public trace types without exposing the implementation modules.
|