Skip to content

Commit 2bbb57c

Browse files
OkuyanBogaedoaltamuraFrancescaSchiavdeclanmillarwoodsp-ibm
authored
Added support for SamplerV2 primitives (#49)
* Migrating `qiskit_algorithms` (qiskit-community#817) * Update README.md * Generalize the Einstein summation signature * Add reno * Update Copyright * Rename and add test * Update Copyright * Add docstring for `test_get_einsum_signature` * Correct spelling * Disable spellcheck for comments * Add `docstring` in pylint dict * Delete example in docstring * Add Einstein in pylint dict * Add full use case in einsum dict * Spelling and type ignore * Spelling and type ignore * Spelling and type ignore * Spelling and type ignore * Spelling and type ignore * Remove for loop in einsum function and remove Literal arguments (1/2) * Remove for loop in einsum function and remove Literal arguments (1/2) * Remove for loop in einsum function and remove Literal arguments (2/2) * Update RuntimeError msg * Update RuntimeError msg - line too long * Trigger CI * Merge algos, globals.random to fix * Fixed `algorithms_globals` * Import /tests and run CI locally * Fix copyrights and some spellings * Ignore mypy in 8 instances * Merge spell dicts * Black reformatting * Black reformatting * Add reno * Lint sanitize * Pylint * Pylint * Pylint * Pylint * Fix relative imports in tutorials * Fix relative imports in tutorials * Remove algorithms from Jupyter magic methods * Temporarily disable "Run stable tutorials" tests * Change the docstrings with imports from qiskit_algorithms * Styling * Update qiskit_machine_learning/optimizers/gradient_descent.py Co-authored-by: Declan Millar <[email protected]> * Update qiskit_machine_learning/optimizers/optimizer_utils/learning_rate.py Co-authored-by: Declan Millar <[email protected]> * Add more tests for utils * Add more tests for optimizers: adam, bobyqa, gsls and imfil * Fix random seed for volatile optimizers * Fix random seed for volatile optimizers * Add more tests * Pylint dict * Activate scikit-quant-0.8.2 * Remove scikit-quant methods * Remove scikit-quant methods (2) * Edit the release notes and Qiskit version 1+ * Edit the release notes and Qiskit version 1+ * Add Qiskit 1.0 upgrade in reno * Add Qiskit 1.0 upgrade in reno * Add Qiskit 1.0 upgrade in reno * Apply line breaks * Restructure line breaks --------- Co-authored-by: FrancescaSchiav <[email protected]> Co-authored-by: M. Emre Sahin <[email protected]> Co-authored-by: Declan Millar <[email protected]> * Revamp readme pt2 (qiskit-community#822) * Restructure README.md --------- Co-authored-by: Steve Wood <[email protected]> * V2 Primitive Support for SamplerQNN and Gradients * Update base_sampler_gradient.py * Update qiskit_machine_learning/gradients/param_shift/param_shift_sampler_gradient.py Co-authored-by: Edoardo Altamura <[email protected]> * Update qiskit_machine_learning/gradients/spsa/spsa_sampler_gradient.py Co-authored-by: Edoardo Altamura <[email protected]> * Update qiskit_machine_learning/gradients/spsa/spsa_sampler_gradient.py Co-authored-by: Edoardo Altamura <[email protected]> * Update qiskit_machine_learning/neural_networks/sampler_qnn.py Co-authored-by: Edoardo Altamura <[email protected]> * Update qiskit_machine_learning/neural_networks/sampler_qnn.py Co-authored-by: Edoardo Altamura <[email protected]> * Update qiskit_machine_learning/neural_networks/sampler_qnn.py Co-authored-by: Edoardo Altamura <[email protected]> * Update qiskit_machine_learning/neural_networks/sampler_qnn.py Co-authored-by: Edoardo Altamura <[email protected]> * Update qiskit_machine_learning/neural_networks/sampler_qnn.py Co-authored-by: Edoardo Altamura <[email protected]> * Update qiskit_machine_learning/neural_networks/sampler_qnn.py Co-authored-by: Edoardo Altamura <[email protected]> * Fix lint errors due to Pylint 3.3.0 update in CI (qiskit-community#833) * disable=too-many-positional-arguments * Transfer pylint rc to toml * Transfer pylint rc to toml * Minor fixes * Remove Python 3.8 from CI (qiskit-community#824) (qiskit-community#826) * Remove Python 3.8 in CI (qiskit-community#824) * Correct `tmp` dirs (qiskit-community#818) * Correct unit py version (qiskit-community#818) * Add reno (qiskit-community#818) * Finalze removal of py38 (qiskit-community#818) * Spelling * Remove duplicate tmp folder * Updated the release note * Bump min pyversion in toml * Remove ipython constraints * Update reno * Updated test for test_sampler_qnn * Fix: output_shape * Adding optimisation level to TestSamplerQNN SamplerV2 option * Correcting the PUB prep for SamplerV2 by changing max iterator from n to len(job_param_values). Added a load of print statements to investigate behaviour when self._output_shape = (2, 3) - a tuple as this was failing tests due to a comparison in line 166. This has lead me to think that the way we are calculating QuasiDistribution is wrong as we need to know which real qubits the virtual qubits have been transpiled too to calculate the correct dist for SamplerV2. Following this up with IBM runtime. * Update sampler_qnn.py for correcting tuple output_shape when interpret is provided. * Adding ISA capabilities to gradients * Fix output shape and its default for V2 * Implement SamplerV2 for bayesian inference * Implement SamplerV2 for bayesian inference * Adding ISA capabilities to SamplerQNN and ParamShiftSamplerGradient * Removing unused backend * Removing failed merge conflicts * Removing residual merge conflicts * added SamplerV2 support for ComputeUncompute * Removing multiple tranpilations within same test * Formatting * Linting * Adding measure_all to setUp * removing default pm --------- Co-authored-by: Edoardo Altamura <[email protected]> Co-authored-by: FrancescaSchiav <[email protected]> Co-authored-by: Declan Millar <[email protected]> Co-authored-by: Steve Wood <[email protected]> Co-authored-by: oscar-wallis <[email protected]>
1 parent 9e53371 commit 2bbb57c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1150
-634
lines changed

.github/actions/run-tests/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2021, 2023.
3+
# (C) Copyright IBM 2021, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -36,7 +36,7 @@ runs:
3636
if [ "${{ inputs.event-name }}" == "schedule" ] || [ "${{ inputs.run-slow }}" == "true" ]; then
3737
export QISKIT_TESTS="run_slow"
3838
fi
39-
if [ "${{ inputs.os }}" == "ubuntu-latest" ] && [ "${{ inputs.python-version }}" == "3.8" ]; then
39+
if [ "${{ inputs.os }}" == "ubuntu-latest" ] && [ "${{ inputs.python-version }}" == "3.9" ]; then
4040
export PYTHON="coverage3 run --source qiskit_machine_learning --parallel-mode"
4141
fi
4242
stestr --test-path test run 2> >(tee /dev/stderr out.txt > /dev/null)

.github/workflows/deploy-code.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2021, 2023.
3+
# (C) Copyright IBM 2021, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -25,7 +25,7 @@ jobs:
2525
id-token: write
2626
strategy:
2727
matrix:
28-
python-version: [3.8]
28+
python-version: [3.9]
2929
steps:
3030
- uses: actions/checkout@v4
3131
- uses: actions/setup-python@v5

.github/workflows/deploy-docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2021, 2023.
3+
# (C) Copyright IBM 2021, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
strategy:
2727
matrix:
28-
python-version: [3.8]
28+
python-version: [3.9]
2929
steps:
3030
- uses: actions/checkout@v4
3131
with:

.github/workflows/main.yml

+15-19
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
matrix:
3737
os: [ubuntu-latest]
38-
python-version: [3.8]
38+
python-version: [3.9]
3939
steps:
4040
- name: Print Concurrency Group
4141
env:
@@ -112,14 +112,14 @@ jobs:
112112
fail-fast: false
113113
matrix:
114114
os: [ubuntu-latest]
115-
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
115+
python-version: [3.9, '3.10', 3.11, 3.12]
116116
include:
117117
- os: macos-latest
118-
python-version: 3.8
118+
python-version: 3.9
119119
- os: macos-latest
120120
python-version: 3.12
121121
- os: windows-latest
122-
python-version: 3.8
122+
python-version: 3.9
123123
- os: windows-latest
124124
python-version: 3.12
125125
# macos-14 is an Arm64 image
@@ -165,7 +165,7 @@ jobs:
165165
run: |
166166
coverage3 combine
167167
mv .coverage ./ci-artifact-data/ml.dat
168-
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == 3.8 }}
168+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 }}
169169
shell: bash
170170
- uses: actions/upload-artifact@v4
171171
with:
@@ -188,7 +188,7 @@ jobs:
188188
fail-fast: false
189189
matrix:
190190
os: [ubuntu-latest]
191-
python-version: [3.8, 3.12]
191+
python-version: [3.9, 3.12]
192192
steps:
193193
- uses: actions/checkout@v4
194194
with:
@@ -251,29 +251,25 @@ jobs:
251251
# cd docs/_build/html
252252
# mkdir artifacts
253253
# tar -zcvf artifacts/tutorials.tar.gz --exclude=./artifacts .
254-
# if: ${{ matrix.python-version == 3.8 && !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
254+
# if: ${{ matrix.python-version == 3.9 && !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
255255
# shell: bash
256256
# - name: Run upload stable tutorials
257257
# uses: actions/upload-artifact@v4
258258
# with:
259259
# name: tutorials-stable${{ matrix.python-version }}
260260
# path: docs/_build/html/artifacts/tutorials.tar.gz
261-
# if: ${{ matrix.python-version == 3.8 && !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
261+
# if: ${{ matrix.python-version == 3.9 && !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
262262
Deprecation_Messages_and_Coverage:
263263
needs: [Checks, MachineLearning, Tutorials]
264264
runs-on: ubuntu-latest
265265
strategy:
266266
matrix:
267-
python-version: [3.8]
267+
python-version: [3.9]
268268
steps:
269269
- uses: actions/checkout@v4
270270
- uses: actions/setup-python@v5
271271
with:
272272
python-version: ${{ matrix.python-version }}
273-
- uses: actions/download-artifact@v4
274-
with:
275-
name: ubuntu-latest-3.8
276-
path: /tmp/u38
277273
- uses: actions/download-artifact@v4
278274
with:
279275
name: ubuntu-latest-3.9
@@ -292,16 +288,16 @@ jobs:
292288
path: /tmp/u312
293289
- uses: actions/download-artifact@v4
294290
with:
295-
name: macos-latest-3.8
296-
path: /tmp/m38
291+
name: macos-latest-3.9
292+
path: /tmp/m39
297293
- uses: actions/download-artifact@v4
298294
with:
299295
name: macos-latest-3.12
300296
path: /tmp/m312
301297
- uses: actions/download-artifact@v4
302298
with:
303-
name: windows-latest-3.8
304-
path: /tmp/w38
299+
name: windows-latest-3.9
300+
path: /tmp/w39
305301
- uses: actions/download-artifact@v4
306302
with:
307303
name: windows-latest-3.12
@@ -319,10 +315,10 @@ jobs:
319315
shell: bash
320316
- name: Combined Deprecation Messages
321317
run: |
322-
sort -f -u /tmp/u38/ml.dep /tmp/u39/ml.dep /tmp/u310/ml.dep /tmp/u311/ml.dep /tmp/u312/ml.dep /tmp/m38/ml.dep /tmp/m312/ml.dep /tmp/w38/ml.dep /tmp/w312/ml.dep /tmp/a310/ml.dep /tmp/a312/ml.dep || true
318+
sort -f -u /tmp/u39/ml.dep /tmp/u310/ml.dep /tmp/u311/ml.dep /tmp/u312/ml.dep /tmp/m39/ml.dep /tmp/m312/ml.dep /tmp/w39/ml.dep /tmp/w312/ml.dep /tmp/a310/ml.dep /tmp/a312/ml.dep || true
323319
shell: bash
324320
- name: Coverage combine
325-
run: coverage3 combine /tmp/u38/ml.dat
321+
run: coverage3 combine /tmp/u39/ml.dat
326322
shell: bash
327323
- name: Upload to Coveralls
328324
env:

.mergify.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
queue_rules:
22
- name: automerge
33
conditions:
4-
- check-success=Deprecation_Messages_and_Coverage (3.8)
4+
- check-success=Deprecation_Messages_and_Coverage (3.9)
55

66
pull_request_rules:
77
- name: automatic merge on CI success and review
88
conditions:
9-
- check-success=Deprecation_Messages_and_Coverage (3.8)
9+
- check-success=Deprecation_Messages_and_Coverage (3.9)
1010
- "#approved-reviews-by>=1"
1111
- label=automerge
1212
- label!=on hold

.pylintdict

+12-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ armijo
2323
arxiv
2424
asmatrix
2525
aspuru
26+
assertraises
2627
async
2728
autoencoder
2829
autoencoders
@@ -136,6 +137,7 @@ elif
136137
endian
137138
entangler
138139
enum
140+
eol
139141
eps
140142
estimatorqnn
141143
et
@@ -158,6 +160,7 @@ farhi
158160
farrokh
159161
fi
160162
fidelities
163+
fidelity
161164
fidelityquantumkernel
162165
filippo
163166
fletcher
@@ -201,13 +204,15 @@ hadfield
201204
hamiltonian
202205
hamiltonians
203206
hao
207+
hartree
204208
hashable
205209
hatano
206210
havlíček
207211
heidelberg
208212
hessians
209213
hilbert
210214
hoc
215+
homebrew
211216
hopkins
212217
hoyer
213218
html
@@ -259,6 +264,7 @@ kwargs
259264
labelled
260265
lagrange
261266
langle
267+
linux
262268
larrañaga
263269
lcu
264270
len
@@ -347,6 +353,7 @@ o'brien
347353
objval
348354
observables
349355
oct
356+
october
350357
olson
351358
onboarding
352359
onodera
@@ -452,10 +459,12 @@ rhs
452459
rightarrow
453460
robert
454461
romero
462+
rosenbrock
455463
rosen
456464
runarsson
457465
runtime
458466
runtimes
467+
RuntimeError
459468
rx
460469
ry
461470
rz
@@ -495,6 +504,9 @@ sqrt
495504
statefn
496505
statevector
497506
statevectors
507+
stdlib
508+
stdout
509+
stfc
498510
stddev
499511
stdlib
500512
stdout
@@ -594,7 +606,3 @@ zz
594606
θ
595607
ψ
596608
ω
597-
assertRaises
598-
RuntimeError
599-
Rosenbrock
600-
fidelities

0 commit comments

Comments
 (0)