Metadata-Version: 2.5
Name: denpex-mlflow
Version: 0.1.2
Summary: Attach Denpex GPU and training-failure diagnoses to your MLflow runs in one line.
Project-URL: Homepage, https://denpex.com
Project-URL: Documentation, https://denpex.com/docs/integrations
Project-URL: API Reference, https://denpex.com/docs/api
Project-URL: Python Agent & CLI, https://denpex.com/docs/agent
Project-URL: VS Code Extension, https://denpex.com/vscode
Project-URL: Open VSX Extension, https://denpex.com/openvsx
Project-URL: GPU Failure Encyclopedia, https://denpex.com/failures
Project-URL: Free GPU Debugging Tools, https://denpex.com/tools
Project-URL: Changelog, https://denpex.com/changelog
Project-URL: Repository, https://github.com/Denpex/gpu-failure-cheatsheet
Project-URL: Issue Tracker, https://denpex.com/contact
Author: Denpex
License: MIT
Keywords: cuda,denpex,diagnosis,gpu,mlflow,nccl,pytorch,training
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Requires-Dist: mlflow>=2.0
Description-Content-Type: text/markdown

# denpex-mlflow

Attach **[Denpex](https://denpex.com)** GPU and training-failure diagnoses to your **MLflow** runs in one line.

When a run crashes, Denpex reads the traceback (and optionally your log file), diagnoses
the root cause (NCCL, Xid, CUDA, OOM, checkpoint, etc.), and writes the **root cause + fix** back
onto the active MLflow run as tags and a `denpex_diagnosis.md` artifact, then re-raises
your original exception so nothing is hidden.

## Install
```bash
pip install denpex-mlflow
```

## Use
```python
import mlflow
import denpex_mlflow as denpex

with mlflow.start_run():
    with denpex.watch(job_name="llama-7b-sft"):
        train()          # if this raises, Denpex diagnoses it and tags the run
```

Decorator form:
```python
@denpex.watch_run("llama-7b-sft")
def main():
    train()
```

One-shot (no MLflow needed):
```python
diag = denpex.diagnose(open("train.err").read())
print(diag.failure_type, diag.confidence, diag.action)
```

## Auth
Set an API key (create one at **[denpex.com/dashboard](https://denpex.com/dashboard)** under API keys):
```bash
export DENPEX_API_KEY=dpx_...
# optional, for self-hosted / staging:
export DENPEX_API_URL=https://api.denpex.com
```

## What gets written to the run
| MLflow tag | Value |
|---|---|
| `denpex.failure_type` | e.g. `NCCL_TIMEOUT`, `CUDA_OOM`, `GPU_XID_ECC` |
| `denpex.confidence` | 0 to 100 |
| `denpex.fix_summary` | the root cause (truncated) |
| `denpex.diagnosis_id` | link back to [denpex.com/dashboard](https://denpex.com/dashboard) |
| artifact `denpex_diagnosis.md` | full root cause + fix |

## Notes
- **Best-effort & non-masking:** if Denpex is unreachable, unauthenticated, or over the
  free-plan quota, it logs one line to stderr and still re-raises your real error.
- `KeyboardInterrupt` / `SystemExit` are passed through undiagnosed.
- The diagnosis runs through the same `/api/diagnose` endpoint as the rest of Denpex, so
  it also lands in your dashboard history and fires your configured alert channels.
- Pass `logfile="train.err"` to `watch()` to include the tail of a log file alongside the
  traceback.

---

## Official Denpex Ecosystem & Documentation

| Resource | Description | Link |
| :--- | :--- | :--- |
| **Denpex Platform** | Deterministic GPU and ML training failure diagnostics | [denpex.com](https://denpex.com) |
| **Documentation Hub** | Quickstart guides, architecture, and operational reference | [denpex.com/docs](https://denpex.com/docs) |
| **Python Agent & CLI** | On-host monitoring, evidence capture, and zero-egress CLI | [denpex.com/docs/agent](https://denpex.com/docs/agent) |
| **REST API Reference** | Programmatic `/api/diagnose` and preflight endpoints | [denpex.com/docs/api](https://denpex.com/docs/api) |
| **VS Code Extension** | Offline GPU crash diagnostics in VS Code | [denpex.com/vscode](https://denpex.com/vscode) |
| **Open VSX Extension** | Extension for Cursor, Windsurf, VSCodium, and Gitpod | [denpex.com/openvsx](https://denpex.com/openvsx) |
| **Failure Encyclopedia** | 500+ documented CUDA, NCCL, Xid, Slurm, and vLLM failures | [denpex.com/failures](https://denpex.com/failures) |
| **Free GPU Tools** | VRAM, NCCL, DeepSpeed ZeRO, and Slurm calculators | [denpex.com/tools](https://denpex.com/tools) |
| **NVIDIA Xid Reference** | Hardware vs software Xid fault routing table | [denpex.com/xid](https://denpex.com/xid) |
| **Release Changelog** | Platform, agent, SDK, and extension release notes | [denpex.com/changelog](https://denpex.com/changelog) |

