Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PennyLane is compatible with JAX 0.4.28 #6255

Merged
merged 76 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
c471f5b
bring changes from prep_for_np2 branch
EmilianoG-byte Aug 1, 2024
c3e011e
change from rc to released version
EmilianoG-byte Aug 2, 2024
6ffb5e5
Merge branch 'master' into compatible-np-2.0
EmilianoG-byte Aug 2, 2024
c8b7d91
add scipy<= 1.13 on ci requirements to become np 2.0 compatible
EmilianoG-byte Aug 6, 2024
e54eeef
pin autograd to major 1.7.0 version
EmilianoG-byte Aug 27, 2024
0c0d5a6
Merge branch 'master' into compatible-np-2.0
EmilianoG-byte Aug 27, 2024
b3ab335
set numpy print options to legacy for scalars and change np.NaN to np…
EmilianoG-byte Aug 27, 2024
ef47609
Revert "set numpy print options to legacy for scalars and change np.N…
EmilianoG-byte Aug 27, 2024
9a88660
change NaN for nan
EmilianoG-byte Aug 27, 2024
f523d32
increase version of scipy used with jax
EmilianoG-byte Aug 27, 2024
236b3f5
change to use context manager for legacy and check against older vers…
EmilianoG-byte Aug 27, 2024
d94d30c
add legacy print option context manager to torch and prepselprep tests
EmilianoG-byte Aug 27, 2024
2d8db14
add legacy printing solution to data-tests
EmilianoG-byte Aug 27, 2024
f9322a7
change regex for probabilities not adding 1 from numpy
EmilianoG-byte Aug 27, 2024
50711df
use legacy context manager on default qubit legacy
EmilianoG-byte Aug 27, 2024
e0bcd0a
Merge branch 'master' into compatible-np-2.0
EmilianoG-byte Aug 28, 2024
1793a03
check numpy version to check dtype in test_apply_global_phase
EmilianoG-byte Aug 28, 2024
d55a614
move context manager to only affect asserts related to representation
EmilianoG-byte Aug 29, 2024
e728c25
ping numpy in requirements
EmilianoG-byte Aug 29, 2024
f1ff64e
Resolving CodeFactor issues
PietropaoloFrisoni Sep 6, 2024
fdca824
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 6, 2024
0f04e84
Using isort:skip to resolve conflict (between CodeFactor and isort) a…
PietropaoloFrisoni Sep 6, 2024
32815d4
Replacing isort:skip with isort:skip_file
PietropaoloFrisoni Sep 6, 2024
c9c148b
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 6, 2024
b229b92
Unpinning numpy in requirements-ci.txt
PietropaoloFrisoni Sep 6, 2024
18702ff
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 9, 2024
61a2d42
Running torch tests with numpy 2.0 and without it
PietropaoloFrisoni Sep 9, 2024
68fbdf7
Re-pinning numpy in reqs-CI and running torch tests with numpy 2 as t…
PietropaoloFrisoni Sep 9, 2024
928fdb5
Remove pin from scipy and numpy. Running torch tests only with numpy-…
PietropaoloFrisoni Sep 9, 2024
e4abd05
Running numpy-2 tests for autograd
PietropaoloFrisoni Sep 9, 2024
0b34222
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 9, 2024
6f77e21
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 9, 2024
61d09d2
Correct typo in `actionyml` (numpy 2.0 was not installed as originall…
PietropaoloFrisoni Sep 10, 2024
3820765
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 10, 2024
a0d37e4
Testing `torch` with 2 versions (fake test) with separate artifacts
PietropaoloFrisoni Sep 10, 2024
6a9c708
Weak pin on scipy and removed pin from autograd
PietropaoloFrisoni Sep 11, 2024
3ffcc33
Weak pin to numpy 1.x in requirements-CI (numpy 2.0 is installed sepa…
PietropaoloFrisoni Sep 11, 2024
6f5c228
Extending double numpy tests to all interfaces
PietropaoloFrisoni Sep 11, 2024
515a910
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 11, 2024
0ea7f12
E.C.
PietropaoloFrisoni Sep 11, 2024
30115a6
Upgrade to `jax 0.4.26`
PietropaoloFrisoni Sep 11, 2024
50e3021
Update torch in GPU tests to 2.3.0 and increasing tolerance for faili…
PietropaoloFrisoni Sep 11, 2024
3fda59e
Removing torch upgrade and increasing tolerance even more in test
PietropaoloFrisoni Sep 11, 2024
9d0178e
Bumping to 0.4.28 (expecting several failures)
PietropaoloFrisoni Sep 12, 2024
3d06af0
Removing tests for Numpy 2.0 in some jobs (those with tensorflow and …
PietropaoloFrisoni Sep 12, 2024
3086d98
Merge branch 'master' into compatible-np-2.0
PietropaoloFrisoni Sep 12, 2024
6ce96cd
Removing empty spaces (causing issues with CI)
PietropaoloFrisoni Sep 12, 2024
0f6ec70
changing number of runners
PietropaoloFrisoni Sep 12, 2024
0649eb5
Merge branch 'compatible-np-2.0' of https://github.com/PennyLaneAI/pe…
PietropaoloFrisoni Sep 12, 2024
55cf72e
Fixing some tests
PietropaoloFrisoni Sep 12, 2024
eca800f
Running full test CI suite
PietropaoloFrisoni Sep 12, 2024
815bd44
Using pytest.xfail instead of pytest.mark.xfail
PietropaoloFrisoni Sep 12, 2024
8bdd625
Increasing tolerance in test
PietropaoloFrisoni Sep 12, 2024
81eb977
Marking tests with xfail
PietropaoloFrisoni Sep 12, 2024
0905f7a
Forgot one xfail
PietropaoloFrisoni Sep 13, 2024
331ad27
Increasing numberical tolerance in test
PietropaoloFrisoni Sep 13, 2024
77ee483
Increasing tolerance
PietropaoloFrisoni Sep 13, 2024
c6b3ed0
Testing with version 0.4.31
PietropaoloFrisoni Sep 13, 2024
26735e9
changing back to version 0.4.28 [ci skip]
PietropaoloFrisoni Sep 13, 2024
9e48ecc
Increasing core runners
PietropaoloFrisoni Sep 13, 2024
7964bc9
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 13, 2024
8b09bc3
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 15, 2024
3604c45
Removing double Numpy tests
PietropaoloFrisoni Sep 15, 2024
3f9567e
Updating changelog
PietropaoloFrisoni Sep 15, 2024
1b27526
fix JAX test of `fuse_rot_angles` in `tests/transforms/test_optimizat…
dwierichs Sep 16, 2024
5aa49f8
Removing pin in `requirements-ci.txt` (not useful since the pin <=2.0…
PietropaoloFrisoni Sep 16, 2024
591671d
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 16, 2024
c481f4a
Merge branch 'compatible-np-2.0' of https://github.com/PennyLaneAI/pe…
PietropaoloFrisoni Sep 16, 2024
efff146
Removing double NumPy testing
PietropaoloFrisoni Sep 16, 2024
6312af6
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 16, 2024
0b480d9
Updating changelog
PietropaoloFrisoni Sep 16, 2024
090504f
[ci skip]
PietropaoloFrisoni Sep 16, 2024
a6e7e13
Triggering CI
PietropaoloFrisoni Sep 16, 2024
1e6eddc
Added comment with clarification
PietropaoloFrisoni Sep 16, 2024
bd44fe6
Updating changelog
PietropaoloFrisoni Sep 17, 2024
5eed998
Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…
PietropaoloFrisoni Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .github/workflows/install_deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,40 @@ inputs:
description: The version of Python to use in order to run unit tests
required: false
default: '3.10'
install_numpy_2:
description: Indicate if numpy 2.0+ should be installed or not
required: false
type: boolean
default: false
numpy_2_version:
description: The version of numpy 2.0 to use in order to run unit tests
required: false
type: string
default: '2.0.0'
install_jax:
description: Indicate if JAX should be installed or not
required: false
default: 'true'
jax_version:
description: The version of JAX to install for any job that requires JAX
required: false
default: 0.4.23
default: '0.4.26'
PietropaoloFrisoni marked this conversation as resolved.
Show resolved Hide resolved
install_tensorflow:
description: Indicate if TensorFlow should be installed or not
required: false
default: 'true'
tensorflow_version:
description: The version of TensorFlow to install for any job that requires TensorFlow
required: false
default: 2.16.0
default: '2.16.0'
install_pytorch:
description: Indicate if PyTorch should be installed or not
required: false
default: 'true'
pytorch_version:
description: The version of PyTorch to install for any job that requires PyTorch
required: false
default: 2.3.0
default: '2.3.0'
install_pennylane_lightning_master:
description: Indicate if PennyLane-Lightning should be installed from the master branch
required: false
Expand Down Expand Up @@ -67,6 +77,13 @@ runs:
pip install -r requirements-ci.txt --upgrade
pip install -r requirements-dev.txt --upgrade

- name: Install numpy 2.0 version
shell: bash
if: inputs.install_numpy_2 == 'true'
env:
NUMPY2_VERSION: ${{ inputs.numpy_2_version != '' && format('~={0}', inputs.numpy_2_version) || '' }}
run: pip install "numpy${{ env.NUMPY2_VERSION }}"

- name: Install PyTorch
shell: bash
if: inputs.install_pytorch == 'true'
Expand All @@ -86,7 +103,7 @@ runs:
if: inputs.install_jax == 'true'
env:
JAX_VERSION: ${{ inputs.jax_version != '' && format('=={0}', inputs.jax_version) || '' }}
run: pip install "jax${{ env.JAX_VERSION}}" "jaxlib${{ env.JAX_VERSION }}" scipy~=1.12.0
run: pip install "jax${{ env.JAX_VERSION}}" "jaxlib${{ env.JAX_VERSION }}"

- name: Install additional PIP packages
shell: bash
Expand Down
72 changes: 48 additions & 24 deletions .github/workflows/interface-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).torch-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'torch-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: torch-tests (${{ matrix.python-version }})
job_name: torch-tests (${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-torch-${{ matrix.python-version }}
coverage_artifact_name: core-interfaces-coverage-torch-${{ matrix.python-version }}-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: false
install_tensorflow: false
install_pytorch: true
Expand All @@ -185,14 +187,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).autograd-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'autograd-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: autograd-tests (${{ matrix.python-version }})
job_name: autograd-tests (${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-autograd-${{ matrix.python-version }}
coverage_artifact_name: core-interfaces-coverage-autograd-${{ matrix.python-version }}-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: false
install_tensorflow: false
install_pytorch: false
Expand All @@ -218,14 +222,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).tf-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'tf-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: tf-tests (${{ matrix.group }}, ${{ matrix.python-version }})
job_name: tf-tests (${{ matrix.group }}, ${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-tf-${{ matrix.python-version }}-${{ matrix.group }}
coverage_artifact_name: core-interfaces-coverage-tf-${{ matrix.python-version }}-${{ matrix.group }}-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: false
install_tensorflow: true
install_pytorch: false
Expand Down Expand Up @@ -256,14 +262,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).jax-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'jax-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: jax-tests (${{ matrix.group }}, ${{ matrix.python-version }})
job_name: jax-tests (${{ matrix.group }}, ${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-jax-${{ matrix.python-version }}-${{ matrix.group }}
coverage_artifact_name: core-interfaces-coverage-jax-${{ matrix.python-version }}-${{ matrix.group }}-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: true
install_tensorflow: false
install_pytorch: false
Expand Down Expand Up @@ -294,14 +302,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).core-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'core-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: core-tests (${{ matrix.group }}, ${{ matrix.python-version }})
job_name: core-tests (${{ matrix.group }}, ${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: core-interfaces-coverage-core-${{ matrix.python-version }}-${{ matrix.group }}
coverage_artifact_name: core-interfaces-coverage-core-${{ matrix.python-version }}-${{ matrix.group }}-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: false
install_tensorflow: false
install_pytorch: false
Expand Down Expand Up @@ -331,14 +341,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).all-interfaces-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'all-interfaces-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: all-interfaces-tests (${{ matrix.python-version }})
job_name: all-interfaces-tests (${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: all-interfaces-coverage
coverage_artifact_name: all-interfaces-coverage-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: true
install_tensorflow: true
install_pytorch: true
Expand All @@ -364,14 +376,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).external-libraries-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'external-libraries-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: external-libraries-tests (${{ matrix.python-version }})
job_name: external-libraries-tests (${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: external-libraries-tests-coverage
coverage_artifact_name: external-libraries-tests-coverage-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: true
install_tensorflow: true
install_pytorch: false
Expand Down Expand Up @@ -403,14 +417,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).qcut-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'qcut-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: qcut-tests (${{ matrix.python-version }})
job_name: qcut-tests (${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: qcut-coverage
coverage_artifact_name: qcut-coverage-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: true
install_tensorflow: true
install_pytorch: true
Expand All @@ -436,14 +452,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).qchem-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'qchem-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: qchem-tests (${{ matrix.python-version }})
job_name: qchem-tests (${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: qchem-coverage
coverage_artifact_name: qchem-coverage-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: false
install_tensorflow: false
install_pytorch: false
Expand Down Expand Up @@ -471,14 +489,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).gradients-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'gradients-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: gradients-tests (${{ matrix.config.suite }}, ${{ matrix.python-version }})
job_name: gradients-tests (${{ matrix.config.suite }}, ${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: gradients-${{ matrix.config.suite }}-coverage
coverage_artifact_name: gradients-${{ matrix.config.suite }}-coverage-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: true
install_tensorflow: true
install_pytorch: true
Expand All @@ -503,14 +523,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).data-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'data-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: data-tests (${{ matrix.python-version }})
job_name: data-tests (${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: data-coverage-${{ matrix.python-version }}
coverage_artifact_name: data-coverage-${{ matrix.python-version }}-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: false
install_tensorflow: false
install_pytorch: false
Expand Down Expand Up @@ -543,14 +565,16 @@ jobs:
fromJSON(needs.setup-ci-load.outputs.python-version).device-tests
|| fromJSON(needs.setup-ci-load.outputs.python-version).default
}}
numpy-2-install: [true, false]
if: ${{ !contains(fromJSON(needs.setup-ci-load.outputs.jobs-to-skip), 'device-tests') }}
uses: ./.github/workflows/unit-test.yml
with:
job_name: device-tests (${{ matrix.config.device }}, ${{ matrix.config.shots }}, ${{ matrix.python-version }})
job_name: device-tests (${{ matrix.config.device }}, ${{ matrix.config.shots }}, ${{ matrix.python-version }}, numpy 2.0 ${{ matrix.numpy-2-install }})
branch: ${{ inputs.branch }}
coverage_artifact_name: devices-coverage-${{ matrix.config.device }}-${{ matrix.config.shots }}
coverage_artifact_name: devices-coverage-${{ matrix.config.device }}-${{ matrix.config.shots }}-${{ matrix.numpy-2-install }}
python_version: ${{ matrix.python-version }}
pipeline_mode: ${{ inputs.pipeline_mode }}
install_numpy_2: ${{ matrix.numpy-2-install }}
install_jax: ${{ !contains(matrix.config.skip_interface, 'jax') }}
install_tensorflow: ${{ !contains(matrix.config.skip_interface, 'tf') }}
install_pytorch: ${{ !contains(matrix.config.skip_interface, 'torch') }}
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ on:
required: false
type: string
default: '3.10'
install_numpy_2:
description: Indicate if numpy 2.0+ should be installed or not
required: false
type: boolean
default: false
numpy_2_version:
description: The version of numpy 2.0 to use in order to run unit tests
required: false
type: string
default: '2.0'
pipeline_mode:
description: The pipeline mode can be unit-tests, benchmarks, or reference-benchmark
required: false
Expand Down Expand Up @@ -158,6 +168,8 @@ jobs:
uses: ./.github/workflows/install_deps
with:
python_version: ${{ inputs.python_version }}
numpy_2_version: ${{ inputs.numpy_2_version }}
install_numpy_2: ${{ inputs.install_numpy_2 }}
install_pytorch: ${{ inputs.install_pytorch }}
install_tensorflow: ${{ inputs.install_tensorflow }}
install_jax: ${{ inputs.install_jax }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ config.toml
qml_debug.log
datasets/*
.benchmarks/*
*.h5
*.hdf5
5 changes: 3 additions & 2 deletions pennylane/numpy/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@
it works with the PennyLane :class:`~.tensor` class.
"""

from autograd.numpy import random as _random
# isort: skip_file
from numpy import __version__ as np_version
from numpy.random import MT19937, PCG64, SFC64, Philox # pylint: disable=unused-import
from autograd.numpy import random as _random
from packaging.specifiers import SpecifierSet
from packaging.version import Version

from .wrapper import tensor_wrapper, wrap_arrays

wrap_arrays(_random.__dict__, globals())


if Version(np_version) in SpecifierSet(">=0.17.0"):

# pylint: disable=too-few-public-methods
# pylint: disable=missing-class-docstring
class Generator(_random.Generator):
Expand Down
4 changes: 2 additions & 2 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
numpy
scipy<1.13.0
numpy~=1.26
scipy<=1.13.0
cvxpy
cvxopt
networkx
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
version = f.readlines()[-1].split()[-1].strip("\"'")

requirements = [
"numpy<2.0",
"numpy<=2.0",
"scipy",
"networkx",
"rustworkx>=0.14.0",
Expand Down
Loading
Loading