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

SamplerV2 options #1223

Merged
merged 43 commits into from
Nov 16, 2023
Merged
Changes from 2 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2785023
Add experimental options (#1067)
jyu00 Sep 20, 2023
cf0d816
Merge branch 'main' of https://github.com/Qiskit/qiskit-ibm-runtime i…
jyu00 Oct 27, 2023
989a321
fix merge issues
jyu00 Oct 27, 2023
5ab8a93
add pydantic
jyu00 Oct 30, 2023
11c30cc
black
jyu00 Oct 30, 2023
e6ef47f
lint
jyu00 Oct 30, 2023
e998b81
Merge branch 'fast_forward' of https://github.com/jyu00/qiskit-ibm-ru…
jyu00 Oct 31, 2023
3e0b4af
Fast forward experimental to latest main (#1178)
jyu00 Oct 31, 2023
b5c7100
v2 options
jyu00 Nov 1, 2023
3671b46
estimator options
jyu00 Nov 3, 2023
bf5a677
update test
jyu00 Nov 3, 2023
1d4b36e
lint
jyu00 Nov 3, 2023
1790d63
Merge branch 'experimental' of https://github.com/Qiskit/qiskit-ibm-r…
jyu00 Nov 3, 2023
4198fad
fix merge issues
jyu00 Nov 3, 2023
9c3e359
black
jyu00 Nov 3, 2023
4ec1b9e
fix noise model type
jyu00 Nov 3, 2023
3c9261c
lint again
jyu00 Nov 3, 2023
6369191
fix header
jyu00 Nov 6, 2023
548005a
fix mypy
jyu00 Nov 6, 2023
d05ce59
use v2 as default
jyu00 Nov 6, 2023
6745067
cleanup terra options
jyu00 Nov 6, 2023
7370b5d
black
jyu00 Nov 6, 2023
a19ccd4
options need not be callable
jyu00 Nov 6, 2023
52febc9
fix doc
jyu00 Nov 6, 2023
b29a4e5
fix tests
jyu00 Nov 6, 2023
1f8bd7c
fix version
jyu00 Nov 6, 2023
027e6ca
add sampler option
jyu00 Nov 7, 2023
260f7c8
lint
jyu00 Nov 7, 2023
a56cdf0
freeze constants
jyu00 Nov 7, 2023
5574264
Merge branch 'options_v2' of https://github.com/jyu00/qiskit-ibm-runt…
jyu00 Nov 7, 2023
6b47aea
freeze constants
jyu00 Nov 7, 2023
0131789
remove is_simulator
jyu00 Nov 7, 2023
665b881
make image work
jyu00 Nov 8, 2023
be5b35e
Merge branch 'options_v2' of https://github.com/jyu00/qiskit-ibm-runt…
jyu00 Nov 8, 2023
d2692ff
fix merge issues
jyu00 Nov 8, 2023
ef332ba
fix tests
jyu00 Nov 8, 2023
9439047
Merge branch 'main' of https://github.com/Qiskit/qiskit-ibm-runtime i…
jyu00 Nov 16, 2023
9dd2c7d
fix tests
jyu00 Nov 16, 2023
d987572
lint
jyu00 Nov 16, 2023
64ccc42
Merge branch 'options_v2' of https://github.com/jyu00/qiskit-ibm-runt…
jyu00 Nov 16, 2023
17c3fb7
add seed_estimator
jyu00 Nov 16, 2023
4c96863
Merge branch 'experimental-0.2' of https://github.com/Qiskit/qiskit-i…
jyu00 Nov 16, 2023
ab493e5
resolve merge issues
jyu00 Nov 16, 2023
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
29 changes: 1 addition & 28 deletions qiskit_ibm_runtime/options/options.py
Original file line number Diff line number Diff line change
@@ -251,40 +251,13 @@ def validate_options(options: dict) -> None:
if execution_time > Options._MAX_EXECUTION_TIME:
raise ValueError(
f"max_execution_time must be below " f"{Options._MAX_EXECUTION_TIME} seconds."
f"max_execution_time must be below " f"{Options._MAX_EXECUTION_TIME} seconds."
)

EnvironmentOptions(**options.get("environment", {}))
ExecutionOptions(**options.get("execution", {}))
SimulatorOptions(**options.get("simulator", {}))

@staticmethod
def _remove_none_values(options: dict) -> dict:
"""Remove `None` values from the options dictionary."""
new_options = {}
for key, value in options.items():
if value is not None:
if isinstance(value, dict):
new_suboptions = {}
for subkey, subvalue in value.items():
if subvalue is not None:
new_suboptions[subkey] = subvalue
new_options[key] = new_suboptions
else:
new_options[key] = value

return new_options

@staticmethod
def _set_default_resilience_options(options: dict) -> dict:
"""Set default resilience options for resilience level 2."""
if options["resilience_level"] == 2:
if not options["resilience"]["noise_factors"]:
options["resilience"]["noise_factors"] = (1, 3, 5)
if not options["resilience"]["extrapolator"]:
options["resilience"]["extrapolator"] = "LinearExtrapolator"

return options

@staticmethod
def _merge_options(old_options: dict, new_options: Optional[dict] = None) -> dict:
"""Merge current options with the new ones.
1 change: 1 addition & 0 deletions test/unit/test_estimator.py
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ def test_unsupported_values_for_estimator_options(self):
{"optimization_level": 4, "resilience_level": 2},
]


with Session(
service=FakeRuntimeService(channel="ibm_quantum", token="abc"),
backend="common_backend",