|
1 | 1 | # TorchDrift -- drift detection on PyTorch
|
2 | 2 |
|
| 3 | +TorchDrift lets you monitor your PyTorch models to see if the data |
| 4 | +matches what it has been trained for. We focus on practical application |
| 5 | +and strive to seamlessly integrate with PyTorch. |
3 | 6 |
|
| 7 | +# Installation |
| 8 | + |
| 9 | +To install the latest release version use |
| 10 | + |
| 11 | +``` |
| 12 | +pip install torchdrift |
| 13 | +``` |
| 14 | + |
| 15 | +To get the latest and greatest install from git with |
| 16 | +``` |
| 17 | +pip install git+https://github.com/torchdrift/torchdrift/ |
| 18 | +``` |
| 19 | + |
| 20 | +# Documentation |
| 21 | + |
| 22 | +Our documentation is at [TorchDrift.org](https://torchdrift.org/). |
| 23 | + |
| 24 | +# Examples |
| 25 | + |
| 26 | +Check out [our worked example](https://torchdrift.org/notebooks/drift_detection_on_images.html) with an ImageNet-type classifier. |
| 27 | + |
| 28 | +If you have a model (without head) as the feature extractor and a training dataloader you can fit the reference distribution as |
| 29 | + |
| 30 | +```python |
| 31 | +drift_detector = torchdrift.detectors.KernelMMDDriftDetector() |
| 32 | +torchdrift.utils.fit(train_dataloader, feature_extractor, drift_detector) |
| 33 | +``` |
| 34 | + |
| 35 | +and then check drifts with |
| 36 | + |
| 37 | +```python |
| 38 | +features = feature_extractor(inputs) |
| 39 | +score = drift_detector(features) |
| 40 | +p_val = drift_detector.compute_p_value(features) |
| 41 | + |
| 42 | +if p_val < 0.01: |
| 43 | + raise RuntimeError("Drifted Inputs") |
| 44 | +``` |
| 45 | + |
| 46 | +Also check out our [deployment example](https://torchdrift.org/notebooks/deployment_monitoring_example.html) for integration of TorchDrift into |
| 47 | +inference with a model. |
4 | 48 |
|
5 | 49 | # Authors
|
6 | 50 |
|
7 | 51 | TorchDrift is a joint project of Orobix Srl, Bergamo, Italy and
|
8 | 52 | MathInf GmbH, Garching b. München, Germany.
|
9 | 53 |
|
10 |
| -Authors: ... |
| 54 | +The TorchDrift Team: Thomas Viehmann, Luca Antiga, Daniele Cortinovis, Lisa Lozza |
11 | 55 |
|
12 | 56 | # Acknowledgements
|
13 | 57 |
|
|
0 commit comments