SeldonIO / alibi-detect

Algorithms for outlier, adversarial and drift detection
https://docs.seldon.io/projects/alibi-detect/en/stable/
Other
2.25k stars 225 forks source link

Refactor torch device types out of od and into _types #829

Closed mauicv closed 1 year ago

mauicv commented 1 year ago

What is this:

Defines TorchDeviceTypes: TypeAlias = Optional[Union[Literal['cuda', 'gpu', 'cpu'], 'torch.device']] in _types.py and refactors the typing for the device in the detectors.

fixes #779, #679. Also fixes #763

codecov[bot] commented 1 year ago

Codecov Report

Merging #829 (a3519f3) into master (d19cf09) will increase coverage by 0.08%. The diff coverage is 94.84%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829/graphs/tree.svg?width=650&height=150&src=pr&token=gwntCwhaGT&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO)](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO) ```diff @@ Coverage Diff @@ ## master #829 +/- ## ========================================== + Coverage 81.90% 81.98% +0.08% ========================================== Files 159 159 Lines 10338 10375 +37 ========================================== + Hits 8467 8506 +39 + Misses 1871 1869 -2 ``` | [Files Changed](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO) | Coverage Δ | | |---|---|---| | [alibi\_detect/saving/schemas.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L3NhdmluZy9zY2hlbWFzLnB5) | `97.96% <86.84%> (-0.82%)` | :arrow_down: | | [alibi\_detect/cd/classifier.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL2NsYXNzaWZpZXIucHk=) | `100.00% <100.00%> (ø)` | | | [alibi\_detect/cd/context\_aware.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL2NvbnRleHRfYXdhcmUucHk=) | `97.50% <100.00%> (+0.06%)` | :arrow_up: | | [alibi\_detect/cd/keops/learned\_kernel.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL2tlb3BzL2xlYXJuZWRfa2VybmVsLnB5) | `94.20% <100.00%> (+0.04%)` | :arrow_up: | | [alibi\_detect/cd/keops/mmd.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL2tlb3BzL21tZC5weQ==) | `98.24% <100.00%> (+0.03%)` | :arrow_up: | | [alibi\_detect/cd/learned\_kernel.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL2xlYXJuZWRfa2VybmVsLnB5) | `100.00% <100.00%> (ø)` | | | [alibi\_detect/cd/lsdd.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL2xzZGQucHk=) | `97.14% <100.00%> (+0.08%)` | :arrow_up: | | [alibi\_detect/cd/lsdd\_online.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL2xzZGRfb25saW5lLnB5) | `93.75% <100.00%> (+0.13%)` | :arrow_up: | | [alibi\_detect/cd/mmd.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL21tZC5weQ==) | `97.77% <100.00%> (+0.05%)` | :arrow_up: | | [alibi\_detect/cd/mmd\_online.py](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO#diff-YWxpYmlfZGV0ZWN0L2NkL21tZF9vbmxpbmUucHk=) | `94.44% <100.00%> (+0.10%)` | :arrow_up: | | ... and [31 more](https://app.codecov.io/gh/SeldonIO/alibi-detect/pull/829?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=SeldonIO) | |