Skip to content

Commit c30e337

Browse files
feat: Remove support for PyTorch backend (#2611)
* Remove support for PyTorch from the codebase. - This is a breaking change. - Remove the PyTorch backend and optimize/opt_pytorch.py. * Remove use of PyTorch from the tests. - Remove PyTorch lower bounds from tests/constraints.txt. - Remove comparison of tensor library backends in tests/test_backend_consistency.py as there is only NumPy and JAX now. * Remove all docs and examples that mention or use PyTorch. * Remove mentions of PyTorch in all parts of the website and REAMDE except for historical purposes like the release notes, JOSS paper, and notes about early pyhf research in FAQs. - For abstract use term "automatic differentiation". * Update NumPy backend docstrings to accommodate NumPy v2.0 returns. Co-authored-by: Giordon Stark <[email protected]>
1 parent 7eda55b commit c30e337

32 files changed

+41
-1356
lines changed

.zenodo.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"fitting",
2929
"scipy",
3030
"numpy",
31-
"pytorch",
3231
"jax",
3332
"auto-differentiation"
3433
],

CITATION.cff

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ keywords:
2626
- fitting
2727
- scipy
2828
- numpy
29-
- pytorch
3029
- jax
3130
- auto-differentiation
3231
license: "Apache-2.0"
@@ -37,8 +36,8 @@ abstract: |
3736
of that statistical model for multi-bin histogram-based analysis and its
3837
interval estimation is based on the asymptotic formulas of "Asymptotic
3938
formulae for likelihood-based tests of new physics". pyhf supports modern
40-
computational graph libraries such as PyTorch and JAX in order
41-
to make use of features such as autodifferentiation and GPU acceleration.
39+
computational graph libraries such as JAX in order to make use of features
40+
such as automatic differentiation and GPU acceleration.
4241
references:
4342
- type: article
4443
authors:

README.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ multi-bin histogram-based analysis and its interval estimation is based
2828
on the asymptotic formulas of “Asymptotic formulae for likelihood-based
2929
tests of new physics”
3030
[`arXiv:1007.1727 <https://arxiv.org/abs/1007.1727>`__]. The aim is also
31-
to support modern computational graph libraries such as PyTorch and
32-
JAX in order to make use of features such as autodifferentiation
33-
and GPU acceleration.
31+
to support modern computational graph libraries such as JAX in order to
32+
make use of features such as automatic differentiation and GPU acceleration.
3433

3534
..
3635
Comment: JupyterLite segment goes here in docs
@@ -144,7 +143,6 @@ Implemented variations:
144143
145144
Computational Backends:
146145
- ☑ NumPy
147-
- ☑ PyTorch
148146
- ☑ JAX
149147
150148
Optimizers:

docker/gpu/install_backend.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ function get_JAXLIB_GPU_WHEEL {
1818
function install_backend() {
1919
# 1: the backend option name in setup.py
2020
local backend="${1}"
21-
if [[ "${backend}" == "torch" ]]; then
22-
# shellcheck disable=SC2102
23-
python3 -m pip install --no-cache-dir .[xmlio,torch]
24-
elif [[ "${backend}" == "jax" ]]; then
21+
if [[ "${backend}" == "jax" ]]; then
2522
python3 -m pip install --no-cache-dir .[xmlio]
2623
python3 -m pip install --no-cache-dir "$(get_JAXLIB_GPU_WHEEL)"
2724
python3 -m pip install --no-cache-dir jax

docs/api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ The computational backends that :code:`pyhf` provides interfacing for the vector
6565
:nosignatures:
6666

6767
numpy_backend.numpy_backend
68-
pytorch_backend.pytorch_backend
6968
jax_backend.jax_backend
7069

7170
Optimizers

docs/conf.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def setup(app):
146146
# today_fmt = '%B %d, %Y'
147147

148148
autodoc_mock_imports = [
149-
'torch',
150149
'jax',
151150
'iminuit',
152151
]
@@ -195,13 +194,11 @@ def setup(app):
195194
'examples/notebooks/StatError.ipynb',
196195
'examples/notebooks/histogrammar.ipynb',
197196
'examples/notebooks/histosys.ipynb',
198-
'examples/notebooks/histosys-pytorch.ipynb',
199197
'examples/notebooks/importxml.ipynb',
200198
'examples/notebooks/multichannel-coupled-normsys.ipynb',
201199
'examples/notebooks/multichannel-normsys.ipynb',
202200
'examples/notebooks/normsys.ipynb',
203201
'examples/notebooks/pullplot.ipynb',
204-
'examples/notebooks/pytorch_tests_onoff.ipynb',
205202
]
206203

207204
# The reST default role (used for this markup: `text`) to use for all

docs/examples/notebooks/histosys-pytorch.ipynb

Lines changed: 0 additions & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)