DeepFabric 4.4.1__tar.gz → 4.6.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.
- {deepfabric-4.4.1 → deepfabric-4.6.0}/.github/workflows/integration.yml +25 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/.gitignore +5 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/CLAUDE.md +2 -1
- deepfabric-4.6.0/Makefile +65 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/PKG-INFO +84 -177
- {deepfabric-4.4.1 → deepfabric-4.6.0}/README.md +81 -176
- deepfabric-4.6.0/assets/df-demo.gif +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/__init__.py +8 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/auth.py +8 -2
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/builders.py +2 -2
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/builders_agent.py +18 -6
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/cli.py +292 -13
- deepfabric-4.6.0/deepfabric/cloud_upload.py +884 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/config.py +47 -20
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/config_manager.py +2 -2
- deepfabric-4.6.0/deepfabric/dataset.py +302 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/backends/__init__.py +2 -0
- deepfabric-4.6.0/deepfabric/evaluation/backends/llm_eval_backend.py +527 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/backends/ollama_backend.py +3 -3
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/backends/tool_call_parsers.py +7 -7
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/backends/transformers_backend.py +73 -16
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/evaluator.py +41 -7
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/evaluators/builtin/tool_calling.py +13 -8
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/inference.py +77 -5
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/metrics.py +4 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/parser.py +8 -8
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/reporters/cloud_reporter.py +19 -6
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/exceptions.py +14 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/generator.py +8 -4
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/graph.py +38 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/hf_hub.py +1 -1
- deepfabric-4.6.0/deepfabric/loader.py +554 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/schemas.py +7 -7
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/topic_manager.py +4 -0
- deepfabric-4.6.0/deepfabric/training/__init__.py +54 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/training/callback.py +43 -1
- deepfabric-4.6.0/deepfabric/training/dataset_utils.py +223 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/training/metrics_sender.py +50 -16
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/tui.py +9 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/utils.py +14 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/validation.py +1 -1
- deepfabric-4.6.0/docs/cli/evaluate.md +64 -0
- deepfabric-4.6.0/docs/cli/generate.md +220 -0
- deepfabric-4.6.0/docs/cli/import-tools.md +347 -0
- deepfabric-4.6.0/docs/cli/index.md +136 -0
- deepfabric-4.6.0/docs/cli/info.md +37 -0
- deepfabric-4.6.0/docs/cli/upload-hf.md +99 -0
- deepfabric-4.6.0/docs/cli/upload-kaggle.md +86 -0
- deepfabric-4.6.0/docs/cli/validate.md +154 -0
- deepfabric-4.6.0/docs/cli/visualize.md +147 -0
- deepfabric-4.6.0/docs/dataset-generation/agent.md +245 -0
- deepfabric-4.6.0/docs/dataset-generation/basic.md +132 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/docs/dataset-generation/configuration.md +21 -16
- deepfabric-4.6.0/docs/dataset-generation/index.md +120 -0
- deepfabric-4.6.0/docs/dataset-generation/rate-limiting.md +218 -0
- deepfabric-4.6.0/docs/dataset-generation/reasoning.md +107 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/docs/evaluation/index.md +51 -5
- {deepfabric-4.4.1 → deepfabric-4.6.0}/docs/evaluation/metrics.md +40 -37
- deepfabric-4.6.0/docs/evaluation/running.md +318 -0
- deepfabric-4.6.0/docs/images/python-spin.png +0 -0
- deepfabric-4.6.0/docs/index.md +246 -0
- deepfabric-4.6.0/docs/tools/custom.md +443 -0
- deepfabric-4.6.0/docs/tools/index.md +162 -0
- deepfabric-4.6.0/docs/tools/mock.md +385 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/docs/tools/spin.md +68 -60
- deepfabric-4.6.0/docs/tools/tutorials/go.md +557 -0
- deepfabric-4.6.0/docs/tools/tutorials/index.md +59 -0
- deepfabric-4.6.0/docs/tools/tutorials/python.md +446 -0
- deepfabric-4.6.0/docs/tools/tutorials/rust.md +562 -0
- deepfabric-4.6.0/docs/tools/tutorials/typescript.md +458 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/docs/tools/vfs.md +28 -51
- {deepfabric-4.4.1 → deepfabric-4.6.0}/docs/training/chat-templates.md +38 -37
- deepfabric-4.6.0/docs/training/dataset-preparation.md +233 -0
- deepfabric-4.6.0/docs/training/frameworks.md +427 -0
- deepfabric-4.6.0/docs/training/index.md +119 -0
- deepfabric-4.6.0/docs/training/loading.md +275 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/agent-tools-multi.yaml +2 -2
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/agent-tools-single.yaml +1 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/basic-graph.yaml +3 -3
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/coding-agent.yaml +1 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/complete.yaml +2 -2
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/github-mock-tools.yaml +1 -1
- deepfabric-4.6.0/examples/mcp-adversarial-suite/README.md +269 -0
- deepfabric-4.6.0/examples/mcp-adversarial-suite/configs/all.yaml +213 -0
- deepfabric-4.6.0/examples/mcp-adversarial-suite/configs/driftlab.yaml +113 -0
- deepfabric-4.6.0/examples/mcp-adversarial-suite/configs/homoglyph.yaml +107 -0
- deepfabric-4.6.0/examples/mcp-adversarial-suite/configs/insecurefs.yaml +139 -0
- deepfabric-4.6.0/examples/mcp-adversarial-suite/configs/resource_trap.yaml +147 -0
- deepfabric-4.6.0/examples/mcp-adversarial-suite/configs/spoofbox.yaml +124 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/reasoning.yaml +4 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/spin-vfs-tools.yaml +1 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/tools-sdk-examples/blender/spin-blender.yaml +6 -5
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/tools-sdk-examples/figma/spin-figma.yaml +1 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/tools-sdk-examples/github/spin-github-tools.yaml +1 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/tools-sdk-examples/kubernetes/spin-kubernetes.yaml +1 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/mkdocs.yml +45 -23
- deepfabric-4.6.0/notebooks/ChatGPT Image Dec 27, 2025, 06_41_41 PM.png +0 -0
- deepfabric-4.6.0/notebooks/Train_and_Evaluate_Qwen3_4B_Thinking_as_a_Blender_MCP_Agent.ipynb +10442 -0
- deepfabric-4.6.0/notebooks/dataset-compatibility-check.ipynb +616 -0
- deepfabric-4.6.0/notebooks/evaluations.ipynb +161 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/pyproject.toml +7 -1
- deepfabric-4.6.0/tests/integration/conftest.py +42 -0
- deepfabric-4.6.0/tests/integration/test_generator_integration.py +160 -0
- deepfabric-4.6.0/tests/integration/test_graph_integration.py +150 -0
- deepfabric-4.6.0/tests/integration/test_llm_client_integration.py +141 -0
- deepfabric-4.6.0/tests/integration/test_spin_integration.py +149 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/integration/test_tree_integration.py +7 -5
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_cli.py +1 -1
- deepfabric-4.6.0/tests/unit/test_cloud_upload.py +359 -0
- deepfabric-4.6.0/tests/unit/test_dataset.py +345 -0
- deepfabric-4.6.0/tests/unit/test_llm_eval_backend.py +471 -0
- deepfabric-4.6.0/tests/unit/test_loader.py +593 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_modular_config.py +25 -25
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_schemas.py +10 -10
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_topic_graph.py +146 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_training_callback.py +1 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/github/README.md +1 -1
- {deepfabric-4.4.1 → deepfabric-4.6.0}/uv.lock +32 -1
- deepfabric-4.4.1/Makefile +0 -36
- deepfabric-4.4.1/assets/df-demo.gif +0 -0
- deepfabric-4.4.1/deepfabric/training/__init__.py +0 -35
- deepfabric-4.4.1/docs/api/config.md +0 -325
- deepfabric-4.4.1/docs/api/generator.md +0 -458
- deepfabric-4.4.1/docs/api/graph.md +0 -327
- deepfabric-4.4.1/docs/api/index.md +0 -135
- deepfabric-4.4.1/docs/api/tree.md +0 -283
- deepfabric-4.4.1/docs/cli/format.md +0 -240
- deepfabric-4.4.1/docs/cli/generate.md +0 -165
- deepfabric-4.4.1/docs/cli/import-tools.md +0 -323
- deepfabric-4.4.1/docs/cli/index.md +0 -89
- deepfabric-4.4.1/docs/cli/upload.md +0 -153
- deepfabric-4.4.1/docs/cli/validate.md +0 -144
- deepfabric-4.4.1/docs/cli/visualize.md +0 -115
- deepfabric-4.4.1/docs/dataset-generation/agent.md +0 -137
- deepfabric-4.4.1/docs/dataset-generation/basic.md +0 -92
- deepfabric-4.4.1/docs/dataset-generation/index.md +0 -60
- deepfabric-4.4.1/docs/dataset-generation/rate-limiting.md +0 -213
- deepfabric-4.4.1/docs/dataset-generation/reasoning.md +0 -99
- deepfabric-4.4.1/docs/evaluation/running.md +0 -179
- deepfabric-4.4.1/docs/getting-started/index.md +0 -98
- deepfabric-4.4.1/docs/index.md +0 -94
- deepfabric-4.4.1/docs/tools/custom.md +0 -223
- deepfabric-4.4.1/docs/tools/index.md +0 -91
- deepfabric-4.4.1/docs/tools/mcp.md +0 -165
- deepfabric-4.4.1/docs/tools/mock.md +0 -194
- deepfabric-4.4.1/docs/training/frameworks.md +0 -155
- deepfabric-4.4.1/docs/training/index.md +0 -60
- deepfabric-4.4.1/docs/training/loading.md +0 -115
- deepfabric-4.4.1/examples/tools-sdk-examples/blender/blender-mock-data.json +0 -915
- deepfabric-4.4.1/examples/tools-sdk-examples/figma/figma-mock-data.json +0 -586
- deepfabric-4.4.1/examples/tools-sdk-examples/github/github-mock-data.json +0 -542
- deepfabric-4.4.1/examples/tools-sdk-examples/kubernetes/kubernetes-mock-data.json +0 -1277
- deepfabric-4.4.1/examples/tools-sdk-examples/kubernetes/tools.json +0 -607
- deepfabric-4.4.1/notebooks/trl_sft_training.ipynb +0 -602
- {deepfabric-4.4.1 → deepfabric-4.6.0}/.github/config.yml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/.github/dependabot.yml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/.github/workflows/docs.yml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/.github/workflows/publish.yml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/.github/workflows/test.yml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/.github/workflows/tools-sdk-docker.yml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/LICENSE +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/assets/logo-light-hols.png +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/assets/logo-light.png +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/assets/star.gif +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/coverage.xml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/__main__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/constants.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/dataset_manager.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/error_codes.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/evaluators/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/evaluators/base.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/evaluators/builtin/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/evaluators/registry.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/reporters/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/reporters/base.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/reporters/file_reporter.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/evaluation/reporters/multi_reporter.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/factory.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/kaggle_hub.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/llm/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/llm/api_key_verifier.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/llm/client.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/llm/errors.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/llm/rate_limit_config.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/llm/rate_limit_detector.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/llm/retry_handler.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/metrics.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/progress.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/prompts.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/spin/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/spin/client.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/spin/models.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/stream_simulator.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/tools/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/tools/defaults.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/tools/loader.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/tools/mcp_client.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/topic_model.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/training/api_key_prompt.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/tree.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/deepfabric/update_checker.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/docs/images/logo-light.png +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/basic-anthropic.yaml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/basic-gemini.yaml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/basic-ollama.yaml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/basic-openai.yaml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/basic-openrouter.yaml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/basic-tree.yaml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/custom-tools.yaml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/tools-sdk-examples/blender/load-blender-mock-data.sh +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/tools-sdk-examples/figma/load-figma-mock-data.sh +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/tools-sdk-examples/github/load-github-mock-data.sh +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/examples/tools-sdk-examples/kubernetes/load-kubernetes-mock-data.sh +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/misc/test_update_manual.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/test-run/01-alpaca.txt +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/test-run/01-chatml.txt +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/test-run/01-grpo.txt +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/test-run/01-xlam_v2.txt +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/test-run/02-trl2.txt +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/test-run/02-xlam_v2.txt +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/test-run/04-agent-tool-conversations.jsnl +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/test-run/04-single-agent-tools +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/integration/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/__init__.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/conftest.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_api_key_validation.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_config.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_error_codes.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_gemini_schema.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_generator.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_hf_hub.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_kaggle_hub.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_rate_limiting.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_tool_call_parsers.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tests/unit/test_update_checker.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools/extract_messages.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools/function.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools/yaml_to_openai_tools.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/.dockerignore +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/Dockerfile +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/README.md +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/github/app.py +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/github/github.wasm +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/github/pyproject.toml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/github/requirements.txt +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/github/spin.toml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/github/uv.lock +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/mock/Cargo.lock +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/mock/Cargo.toml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/mock/README.md +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/mock/src/lib.rs +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/vfs/Cargo.lock +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/vfs/Cargo.toml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/components/vfs/src/lib.rs +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/docker-compose.yaml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/runtime-config.toml +0 -0
- {deepfabric-4.4.1 → deepfabric-4.6.0}/tools-sdk/spin.toml +0 -0
|
@@ -19,6 +19,12 @@ jobs:
|
|
|
19
19
|
name: Run integration tests (Python ${{ matrix.python-version }})
|
|
20
20
|
runs-on: ubuntu-latest
|
|
21
21
|
|
|
22
|
+
services:
|
|
23
|
+
spin:
|
|
24
|
+
image: ghcr.io/always-further/deepfabric/tools-sdk:latest
|
|
25
|
+
ports:
|
|
26
|
+
- 3000:3000
|
|
27
|
+
|
|
22
28
|
strategy:
|
|
23
29
|
fail-fast: false
|
|
24
30
|
matrix:
|
|
@@ -28,6 +34,23 @@ jobs:
|
|
|
28
34
|
- name: Checkout code
|
|
29
35
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5
|
|
30
36
|
|
|
37
|
+
- name: Wait for Spin service
|
|
38
|
+
run: |
|
|
39
|
+
echo "Waiting for Spin service to be ready..."
|
|
40
|
+
for i in {1..30}; do
|
|
41
|
+
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/vfs/execute -X POST \
|
|
42
|
+
-H "Content-Type: application/json" \
|
|
43
|
+
-d '{"session_id":"healthcheck","tool":"list_files","args":{"directory":"/"}}' 2>/dev/null || echo "000")
|
|
44
|
+
if [ "$response" = "200" ]; then
|
|
45
|
+
echo "Spin service is ready"
|
|
46
|
+
exit 0
|
|
47
|
+
fi
|
|
48
|
+
echo "Attempt $i: waiting... (HTTP $response)"
|
|
49
|
+
sleep 2
|
|
50
|
+
done
|
|
51
|
+
echo "Spin service failed to become ready"
|
|
52
|
+
exit 1
|
|
53
|
+
|
|
31
54
|
- name: Set up Python
|
|
32
55
|
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
|
|
33
56
|
with:
|
|
@@ -46,3 +69,5 @@ jobs:
|
|
|
46
69
|
run: make test-integration
|
|
47
70
|
env:
|
|
48
71
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
72
|
+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
|
73
|
+
SPIN_ENDPOINT: http://localhost:3000
|
|
@@ -97,4 +97,5 @@ deepfabric start config.yaml --model gpt-4 --temperature 0.8 --hf-repo user/data
|
|
|
97
97
|
- Bandit for security analysis
|
|
98
98
|
- Python 3.11+ required
|
|
99
99
|
- Google-style docstrings preferred
|
|
100
|
-
- do not place imports anywhere but the top of the file
|
|
100
|
+
- do not place imports anywhere but the top of the file
|
|
101
|
+
- When updating `docs/` documentation, if new Markdown files are added or removed, consider updating `mkdocs.yml`.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.PHONY: clean install format lint test-unit test-integration test-integration-verbose security build all
|
|
2
|
+
.PHONY: test-integration-openai test-integration-gemini test-integration-llm
|
|
3
|
+
.PHONY: test-integration-hubs test-integration-spin test-integration-quick
|
|
4
|
+
.PHONY: test-integration-graph test-integration-generator
|
|
5
|
+
|
|
6
|
+
# Base command for integration tests
|
|
7
|
+
PYTEST_INTEGRATION = uv run pytest tests/integration --tb=short -v
|
|
8
|
+
|
|
9
|
+
clean:
|
|
10
|
+
rm -rf build/
|
|
11
|
+
rm -rf dist/
|
|
12
|
+
rm -rf *.egg-info
|
|
13
|
+
rm -f .coverage
|
|
14
|
+
find . -type d -name '__pycache__' -exec rm -rf {} +
|
|
15
|
+
find . -type f -name '*.pyc' -delete
|
|
16
|
+
|
|
17
|
+
install:
|
|
18
|
+
uv sync --all-extras
|
|
19
|
+
|
|
20
|
+
format: ## Format code with ruff (parallel)
|
|
21
|
+
uv run ruff format deepfabric/ tests/
|
|
22
|
+
|
|
23
|
+
lint:
|
|
24
|
+
uv run ruff check . --exclude notebooks/
|
|
25
|
+
|
|
26
|
+
test-unit:
|
|
27
|
+
uv run pytest tests/unit/
|
|
28
|
+
|
|
29
|
+
test-integration:
|
|
30
|
+
$(PYTEST_INTEGRATION) --maxfail=1
|
|
31
|
+
|
|
32
|
+
test-integration-verbose:
|
|
33
|
+
uv run pytest tests/integration -v -rA --durations=10
|
|
34
|
+
|
|
35
|
+
test-integration-openai:
|
|
36
|
+
$(PYTEST_INTEGRATION) -m openai
|
|
37
|
+
|
|
38
|
+
test-integration-gemini:
|
|
39
|
+
$(PYTEST_INTEGRATION) -m gemini
|
|
40
|
+
|
|
41
|
+
test-integration-llm:
|
|
42
|
+
$(PYTEST_INTEGRATION) -m "openai or gemini"
|
|
43
|
+
|
|
44
|
+
test-integration-hubs:
|
|
45
|
+
$(PYTEST_INTEGRATION) -m huggingface
|
|
46
|
+
|
|
47
|
+
test-integration-spin:
|
|
48
|
+
$(PYTEST_INTEGRATION) -m spin
|
|
49
|
+
|
|
50
|
+
test-integration-quick:
|
|
51
|
+
$(PYTEST_INTEGRATION) -m "not huggingface"
|
|
52
|
+
|
|
53
|
+
test-integration-graph:
|
|
54
|
+
$(PYTEST_INTEGRATION) tests/integration/test_graph_integration.py
|
|
55
|
+
|
|
56
|
+
test-integration-generator:
|
|
57
|
+
$(PYTEST_INTEGRATION) tests/integration/test_generator_integration.py
|
|
58
|
+
|
|
59
|
+
security:
|
|
60
|
+
uv run bandit -r deepfabric/
|
|
61
|
+
|
|
62
|
+
build: clean test-unit
|
|
63
|
+
uv build
|
|
64
|
+
|
|
65
|
+
all: clean install format lint test-unit test-integration security build
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DeepFabric
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.6.0
|
|
4
4
|
Summary: Curate High Quality Datasets, Train, Evaluate and Ship
|
|
5
5
|
Author-email: Luke Hinds <luke@alwaysfurther.ai>
|
|
6
6
|
License-File: LICENSE
|
|
@@ -29,10 +29,12 @@ Requires-Dist: sentencepiece>=0.1.99
|
|
|
29
29
|
Requires-Dist: spin-sdk>=3.4.1
|
|
30
30
|
Requires-Dist: torch>=2.4.0
|
|
31
31
|
Requires-Dist: transformers>=4.57.1
|
|
32
|
+
Requires-Dist: trl>=0.26.2
|
|
32
33
|
Provides-Extra: dev
|
|
33
34
|
Requires-Dist: bandit>=1.7.10; extra == 'dev'
|
|
34
35
|
Requires-Dist: mermaid-py>=0.2.0; extra == 'dev'
|
|
35
36
|
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
|
|
36
38
|
Requires-Dist: pytest-mock>=3.10.0; extra == 'dev'
|
|
37
39
|
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
38
40
|
Requires-Dist: requests-mock>=1.11.0; extra == 'dev'
|
|
@@ -45,7 +47,7 @@ Description-Content-Type: text/markdown
|
|
|
45
47
|
<div align="center">
|
|
46
48
|
<picture>
|
|
47
49
|
<source media="(prefers-color-scheme: dark)" srcset="./assets/logo-light.png" />
|
|
48
|
-
<img alt="DeepFabric logo" src="./assets/logo-light
|
|
50
|
+
<img alt="DeepFabric logo" src="./assets/logo-light.png" style="width:40%;max-width:40%;height:auto;display:block;margin:0 auto;" />
|
|
49
51
|
</picture>
|
|
50
52
|
<h3>Training Model Behavior in Agentic Systems</h3>
|
|
51
53
|
|
|
@@ -77,6 +79,9 @@ Description-Content-Type: text/markdown
|
|
|
77
79
|
<a href="https://discord.gg/pPcjYzGvbS">
|
|
78
80
|
<img src="https://img.shields.io/discord/1384081906773131274?color=7289da&label=Discord&logo=discord&logoColor=white" alt="Discord"/>
|
|
79
81
|
</a>
|
|
82
|
+
<a href="https://www.reddit.com/r/deepfabric/">
|
|
83
|
+
<img src="https://img.shields.io/badge/Reddit-r%2Fdeepfabric-FF4500?logo=reddit&logoColor=white" alt="Reddit"/>
|
|
84
|
+
</a>
|
|
80
85
|
</p>
|
|
81
86
|
</div>
|
|
82
87
|
|
|
@@ -86,7 +91,7 @@ What sets DeepFabric apart from other dataset generation tools is its ability to
|
|
|
86
91
|
|
|
87
92
|
<img src="/assets/df-demo.gif" width="100%" height="100%"/>
|
|
88
93
|
|
|
89
|
-
Constrained decoding and response validation, along with real tool executions within isolated webassembly environments, ensure that generated samples strictly adhere to structured schema, variable constraints, and execution correctness, ensuring datasets have exact syntax and structure for use in model training pipelines. Tool definations can be either directly imported from MCP (Model Context Protocol) server schemas and automatically mocked, real life interfaces along with a standard set of common tools (`list_files()`, 'read_file()` etc)
|
|
94
|
+
Constrained decoding and response validation, along with real tool executions within isolated webassembly environments, ensure that generated samples strictly adhere to structured schema, variable constraints, and execution correctness, ensuring datasets have exact syntax and structure for use in model training pipelines. Tool definations can be either directly imported from MCP (Model Context Protocol) server schemas and automatically mocked, real life interfaces along with a standard set of common tools (`list_files()`, `'read_file()` etc)
|
|
90
95
|
|
|
91
96
|
Once your dataset is generated, it can be automatically uploaded to Hugging Face and directly imported into popular training frameworks like TRL, Unsloth, and Axolotl.
|
|
92
97
|
|
|
@@ -120,7 +125,15 @@ This generates a topic graph and creates 27 unique nodes, then generates 27 trai
|
|
|
120
125
|
|
|
121
126
|
## Configuration
|
|
122
127
|
|
|
123
|
-
DeepFabric also uses YAML configuration with three main sections and optional shared LLM defaults
|
|
128
|
+
DeepFabric also uses YAML configuration with three main sections and optional shared LLM defaults
|
|
129
|
+
|
|
130
|
+
> [!NOTE]
|
|
131
|
+
> The following uses mocked tool execution, so will require a runing Spin service, which we provide in a docker image:
|
|
132
|
+
```bash
|
|
133
|
+
docker run -d -p 3000:3000 ghcr.io/always-further/deepfabric/tools-sdk:latest`
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Save the following as `config.yaml`:
|
|
124
137
|
|
|
125
138
|
```yaml
|
|
126
139
|
# Optional: Shared LLM defaults (inherited by topics and generation)
|
|
@@ -143,34 +156,74 @@ topics:
|
|
|
143
156
|
# GENERATION: Create training samples from topics
|
|
144
157
|
generation:
|
|
145
158
|
system_prompt: |
|
|
146
|
-
You are an expert Python backend developer
|
|
159
|
+
You are an expert Python backend developer specializing in REST API design.
|
|
147
160
|
Create practical, production-ready code examples with clear explanations.
|
|
148
161
|
Include error handling, type hints, and follow PEP 8 conventions.
|
|
162
|
+
Use the following tools to read, write, and list files in the virtual filesystem:
|
|
163
|
+
- read_file
|
|
164
|
+
- write_file
|
|
165
|
+
- list_files
|
|
149
166
|
|
|
150
167
|
# Additional instructions for sample generation
|
|
151
168
|
instructions: |
|
|
152
|
-
Focus on real-world scenarios developers encounter daily.
|
|
169
|
+
Focus on real-world scenarios developers encounter daily when building REST APIs with Python.
|
|
153
170
|
Include both happy path and edge case handling.
|
|
154
|
-
Provide context on when and why to use specific patterns.
|
|
171
|
+
Provide context on when and why to use specific patterns or libraries.
|
|
172
|
+
Ensure code is modular, testable, and maintainable.
|
|
155
173
|
|
|
156
174
|
conversation:
|
|
157
|
-
type:
|
|
158
|
-
reasoning_style: agent # freetext | agent (for
|
|
175
|
+
type: cot # basic | cot
|
|
176
|
+
reasoning_style: agent # freetext | agent (for cot)
|
|
159
177
|
agent_mode: single_turn # single_turn | multi_turn (for agent)
|
|
160
178
|
|
|
161
179
|
# Tool configuration (required for agent modes)
|
|
162
180
|
tools:
|
|
163
181
|
spin_endpoint: "http://localhost:3000" # Spin service for tool execution
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
182
|
+
components: # Map component name to tool names
|
|
183
|
+
builtin: # Routes to /vfs/execute
|
|
184
|
+
- read_file
|
|
185
|
+
- write_file
|
|
186
|
+
- list_files
|
|
168
187
|
max_per_query: 3 # Maximum tools per query
|
|
169
188
|
max_agent_steps: 5 # Max ReAct reasoning iterations
|
|
170
189
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
190
|
+
# Optional: Seed initial files into the spin before generation, used for tool calling
|
|
191
|
+
scenario_seed:
|
|
192
|
+
files:
|
|
193
|
+
"Dockerfile": |
|
|
194
|
+
FROM python:3.13
|
|
195
|
+
WORKDIR /usr/local/app
|
|
196
|
+
|
|
197
|
+
# Install the application dependencies
|
|
198
|
+
COPY requirements.txt ./
|
|
199
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
200
|
+
|
|
201
|
+
# Copy in the source code
|
|
202
|
+
COPY src ./src
|
|
203
|
+
EXPOSE 8080
|
|
204
|
+
|
|
205
|
+
# Setup an app user so the container doesn't run as the root user
|
|
206
|
+
RUN useradd app
|
|
207
|
+
USER app
|
|
208
|
+
|
|
209
|
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
|
|
210
|
+
"main.py": |
|
|
211
|
+
def greet(name):
|
|
212
|
+
return f"Hello, {name}!"
|
|
213
|
+
|
|
214
|
+
if __name__ == "__main__":
|
|
215
|
+
print(greet("World"))
|
|
216
|
+
"config.json": |
|
|
217
|
+
{
|
|
218
|
+
"version": "1.0.0",
|
|
219
|
+
"debug": true,
|
|
220
|
+
"max_retries": 3
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
# Generation control and retry settings
|
|
224
|
+
max_retries: 3 # Retries for failed generations
|
|
225
|
+
sample_retries: 2 # Retries for validation failures
|
|
226
|
+
max_tokens: 2000 # Max tokens per generation
|
|
174
227
|
|
|
175
228
|
# Optional: Override shared LLM settings
|
|
176
229
|
llm:
|
|
@@ -190,13 +243,13 @@ output:
|
|
|
190
243
|
batch_size: 3 # Parallel generation batch size
|
|
191
244
|
save_as: "api-dataset.jsonl"
|
|
192
245
|
|
|
193
|
-
|
|
194
|
-
huggingface:
|
|
195
|
-
|
|
196
|
-
|
|
246
|
+
Optional: Upload to Hugging Face
|
|
247
|
+
huggingface:
|
|
248
|
+
repository: "your-username/api-dataset-training-name"
|
|
249
|
+
tags: ["python", "programming"]
|
|
197
250
|
```
|
|
198
251
|
|
|
199
|
-
Run
|
|
252
|
+
Run generation by sourcing the `config.yaml`:
|
|
200
253
|
|
|
201
254
|
```bash
|
|
202
255
|
deepfabric generate config.yaml
|
|
@@ -206,6 +259,14 @@ deepfabric generate config.yaml
|
|
|
206
259
|
|
|
207
260
|
DeepFabric returns standard HuggingFace datasets, making it easy to integrate with any training framework.
|
|
208
261
|
|
|
262
|
+
### Colab Notebooks:
|
|
263
|
+
|
|
264
|
+
A quick way of seeing DeepFabric in action is via our notebooks in the [notebooks/](./notebooks/) folder or on Google Colab:
|
|
265
|
+
|
|
266
|
+
**Qwen4b Blender MCP**:
|
|
267
|
+
|
|
268
|
+
[](https://colab.research.google.com/drive/1EG1V40v5xkJKLf6Ra6W4378vYqlZNVWqb)
|
|
269
|
+
|
|
209
270
|
### 1. Generate Dataset
|
|
210
271
|
|
|
211
272
|
```bash
|
|
@@ -215,7 +276,7 @@ deepfabric generate config.yaml --output-save-as dataset.jsonl
|
|
|
215
276
|
Or upload to HuggingFace Hub:
|
|
216
277
|
|
|
217
278
|
```bash
|
|
218
|
-
deepfabric upload dataset.jsonl --repo your-username/my-dataset
|
|
279
|
+
deepfabric upload-hf dataset.jsonl --repo your-username/my-dataset
|
|
219
280
|
```
|
|
220
281
|
|
|
221
282
|
### 2. Load and Split for Training
|
|
@@ -324,7 +385,6 @@ config = EvaluatorConfig(
|
|
|
324
385
|
model_path="Qwen/Qwen2.5-7B-Instruct", # Base model
|
|
325
386
|
adapter_path="./output/lora-adapter", # LoRA adapter path
|
|
326
387
|
backend="transformers",
|
|
327
|
-
use_unsloth=True, # Use Unsloth for adapters trained with Unsloth
|
|
328
388
|
load_in_4bit=True, # 4-bit quantization
|
|
329
389
|
max_seq_length=2048,
|
|
330
390
|
),
|
|
@@ -415,159 +475,6 @@ evaluator = Evaluator(config)
|
|
|
415
475
|
results = evaluator.evaluate(dataset=eval_dataset)
|
|
416
476
|
```
|
|
417
477
|
|
|
418
|
-
## Training Metrics
|
|
419
|
-
|
|
420
|
-
DeepFabric provides a training callback that automatically logs metrics to the DeepFabric cloud during model training. This enables real-time monitoring and tracking of training runs.
|
|
421
|
-
|
|
422
|
-
### Basic Usage with HuggingFace Trainer
|
|
423
|
-
|
|
424
|
-
```python
|
|
425
|
-
from transformers import Trainer, TrainingArguments
|
|
426
|
-
from deepfabric import DeepFabricCallback
|
|
427
|
-
|
|
428
|
-
# Set up training arguments
|
|
429
|
-
training_args = TrainingArguments(
|
|
430
|
-
output_dir="./output",
|
|
431
|
-
num_train_epochs=3,
|
|
432
|
-
per_device_train_batch_size=4,
|
|
433
|
-
logging_steps=10,
|
|
434
|
-
)
|
|
435
|
-
|
|
436
|
-
# Create trainer
|
|
437
|
-
trainer = Trainer(
|
|
438
|
-
model=model,
|
|
439
|
-
args=training_args,
|
|
440
|
-
train_dataset=train_dataset,
|
|
441
|
-
eval_dataset=eval_dataset,
|
|
442
|
-
)
|
|
443
|
-
|
|
444
|
-
# Add DeepFabric callback for metrics logging
|
|
445
|
-
trainer.add_callback(DeepFabricCallback(trainer))
|
|
446
|
-
|
|
447
|
-
# Train - metrics are automatically logged
|
|
448
|
-
trainer.train()
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
### Usage with TRL SFTTrainer
|
|
452
|
-
|
|
453
|
-
```python
|
|
454
|
-
from trl import SFTTrainer, SFTConfig
|
|
455
|
-
from deepfabric import DeepFabricCallback
|
|
456
|
-
|
|
457
|
-
trainer = SFTTrainer(
|
|
458
|
-
model=model,
|
|
459
|
-
tokenizer=tokenizer,
|
|
460
|
-
train_dataset=train_dataset,
|
|
461
|
-
args=SFTConfig(
|
|
462
|
-
output_dir="./output",
|
|
463
|
-
num_train_epochs=3,
|
|
464
|
-
logging_steps=10,
|
|
465
|
-
),
|
|
466
|
-
)
|
|
467
|
-
|
|
468
|
-
# Add callback - works with any Trainer-compatible class
|
|
469
|
-
trainer.add_callback(DeepFabricCallback(trainer))
|
|
470
|
-
trainer.train()
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
### Configuration Options
|
|
474
|
-
|
|
475
|
-
```python
|
|
476
|
-
from deepfabric import DeepFabricCallback
|
|
477
|
-
|
|
478
|
-
callback = DeepFabricCallback(
|
|
479
|
-
trainer=trainer, # Optional: Trainer instance
|
|
480
|
-
api_key="your-api-key", # Or set DEEPFABRIC_API_KEY env var
|
|
481
|
-
endpoint="https://api.deepfabric.ai", # Custom endpoint (optional)
|
|
482
|
-
enabled=True, # Disable to skip logging
|
|
483
|
-
)
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
### Environment Variables
|
|
487
|
-
|
|
488
|
-
```bash
|
|
489
|
-
# API key for authentication
|
|
490
|
-
export DEEPFABRIC_API_KEY="your-api-key"
|
|
491
|
-
|
|
492
|
-
# Custom API endpoint (optional)
|
|
493
|
-
export DEEPFABRIC_API_URL="https://api.deepfabric.ai"
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
### Logged Metrics
|
|
497
|
-
|
|
498
|
-
The callback automatically captures and logs:
|
|
499
|
-
|
|
500
|
-
| Metric Type | Examples |
|
|
501
|
-
|-------------|----------|
|
|
502
|
-
| Training | `loss`, `learning_rate`, `epoch`, `global_step` |
|
|
503
|
-
| Throughput | `train_runtime`, `train_samples_per_second` |
|
|
504
|
-
| Evaluation | `eval_loss`, `eval_accuracy` (when evaluation is run) |
|
|
505
|
-
| TRL-specific | `rewards/chosen`, `rewards/rejected`, `kl_divergence` |
|
|
506
|
-
| Checkpoints | Checkpoint save events with step numbers |
|
|
507
|
-
|
|
508
|
-
### Callback Events
|
|
509
|
-
|
|
510
|
-
```python
|
|
511
|
-
# The callback hooks into these Trainer events:
|
|
512
|
-
# - on_train_begin: Logs run start with training configuration
|
|
513
|
-
# - on_log: Logs training metrics (loss, lr, etc.)
|
|
514
|
-
# - on_evaluate: Logs evaluation metrics
|
|
515
|
-
# - on_save: Logs checkpoint events
|
|
516
|
-
# - on_train_end: Logs run completion and flushes pending metrics
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
### Non-Blocking Design
|
|
520
|
-
|
|
521
|
-
The callback uses a background thread to send metrics asynchronously, ensuring training is never blocked by network operations:
|
|
522
|
-
|
|
523
|
-
```python
|
|
524
|
-
from deepfabric.training import MetricsSender
|
|
525
|
-
|
|
526
|
-
# Direct access to sender for advanced use cases
|
|
527
|
-
sender = MetricsSender(
|
|
528
|
-
endpoint="https://api.deepfabric.ai",
|
|
529
|
-
api_key="your-key",
|
|
530
|
-
batch_size=10, # Batch metrics before sending
|
|
531
|
-
flush_interval=5.0, # Auto-flush every 5 seconds
|
|
532
|
-
max_queue_size=1000, # Queue capacity
|
|
533
|
-
)
|
|
534
|
-
|
|
535
|
-
# Manually send metrics
|
|
536
|
-
sender.send_metrics({"custom_metric": 0.95, "step": 100})
|
|
537
|
-
|
|
538
|
-
# Flush pending metrics (blocking)
|
|
539
|
-
sender.flush(timeout=30.0)
|
|
540
|
-
|
|
541
|
-
# Check sender statistics
|
|
542
|
-
print(sender.stats)
|
|
543
|
-
# {'metrics_sent': 150, 'metrics_dropped': 0, 'send_errors': 0, 'queue_size': 0}
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
### Interactive API Key Prompt
|
|
547
|
-
|
|
548
|
-
When running in an interactive environment (Jupyter notebook, terminal) without an API key configured, the callback will prompt for authentication:
|
|
549
|
-
|
|
550
|
-
```python
|
|
551
|
-
from deepfabric import DeepFabricCallback
|
|
552
|
-
|
|
553
|
-
# If DEEPFABRIC_API_KEY is not set, prompts for login
|
|
554
|
-
callback = DeepFabricCallback(trainer)
|
|
555
|
-
# > DeepFabric API key not found. Log in to enable cloud metrics.
|
|
556
|
-
# > Visit: https://app.deepfabric.ai/signup
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
### Disabling Metrics Logging
|
|
560
|
-
|
|
561
|
-
```python
|
|
562
|
-
# Disable via constructor
|
|
563
|
-
callback = DeepFabricCallback(trainer, enabled=False)
|
|
564
|
-
|
|
565
|
-
# Or set API key to None
|
|
566
|
-
callback = DeepFabricCallback(trainer, api_key=None)
|
|
567
|
-
|
|
568
|
-
# Or don't set DEEPFABRIC_API_KEY environment variable
|
|
569
|
-
```
|
|
570
|
-
|
|
571
478
|
## Providers
|
|
572
479
|
|
|
573
480
|
| Provider | Local/Cloud | Best For |
|
|
@@ -625,7 +532,7 @@ Enable tool tracing in your YAML config:
|
|
|
625
532
|
```yaml
|
|
626
533
|
generation:
|
|
627
534
|
conversation:
|
|
628
|
-
type:
|
|
535
|
+
type: cot
|
|
629
536
|
reasoning_style: agent
|
|
630
537
|
agent_mode: single_turn
|
|
631
538
|
|