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

PrimitivesV2 schemas #14

Merged
merged 51 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ffd2781
Partial version of EstimatorV2 input schema
gadial Feb 28, 2024
183b361
Full EstimatorV2 schema
gadial Feb 29, 2024
299d7c2
Added SamplerV2 schema and added `seed_estimator` to estimator schema
gadial Feb 29, 2024
377e168
Updating the estimator schema after options changes in qiskit runtime
gadial Mar 11, 2024
3e046dd
Updated SamplerV2 schema
gadial Mar 11, 2024
c565ff8
Update schemas/estimator_v2_schema.json
gadial Mar 13, 2024
1849443
Update schemas/estimator_v2_schema.json
gadial Mar 13, 2024
18af181
Update schemas/estimator_v2_schema.json
gadial Mar 13, 2024
aed9bbe
Fixes according to PR review
gadial Mar 13, 2024
bcf6256
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
337867e
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
8d946fa
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
82609b6
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
255fcd7
Update schemas/sampler_v2_schema.json
gadial Apr 3, 2024
1886b62
Update schemas/sampler_v2_schema.json
gadial Apr 3, 2024
141f86c
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
158e3ff
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
a63eb71
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
1c1e6f8
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
126276d
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
e3c233b
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
3f284dc
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
9ce0aeb
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
5ccb378
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
420d814
Update schemas/estimator_v2_schema.json
gadial Apr 3, 2024
55a7c67
Starting to add tests
gadial Apr 3, 2024
6913d3d
Added a framework to test schema vs runtime validator
gadial Apr 3, 2024
54ab15d
Added dynamical decoupling tests and fixed some bugs in the framework
gadial Apr 4, 2024
7c1b9fc
Test for resilience boolean values and schema fix based on the test
gadial Apr 4, 2024
e3ff48a
Tests for zne options; extended the schema to validate correct number…
gadial Apr 5, 2024
ce5231b
Improving the test framework
gadial Apr 8, 2024
5b117e3
Updated the schema to verify zne implies zne_mitigation=True, and mea…
gadial Apr 8, 2024
0b361c3
Added pec options tests and updated the schema to require `pec_mitiga…
gadial Apr 23, 2024
520983b
Added noise learning tests
gadial Apr 23, 2024
ca09808
Added execution and twirling tests
gadial Apr 23, 2024
2cd2681
Added Sampler tests
gadial Apr 23, 2024
5cb7635
linting
gadial Apr 23, 2024
16f4322
Schema fix: `noise_gain` is inclusive minimum
gadial Apr 23, 2024
7387a4b
Added default shots/precision
gadial Apr 23, 2024
24579c4
Added `support_qiskit`
gadial Apr 23, 2024
7983a03
Additional data on PUBS
gadial Apr 24, 2024
34a6cb4
Allow longer line length with flake8
gadial Apr 24, 2024
74e3c83
linting
gadial Apr 24, 2024
167a74d
Switching to test against the `main` branch of `qiskit-ibm-runtime`
gadial Apr 25, 2024
ab2c1d4
use https instead of ssh
gadial Apr 25, 2024
1441aa2
Fixes
gadial Apr 25, 2024
7687e6e
Fixes
gadial Apr 25, 2024
7335f96
Fix shots
jyu00 May 20, 2024
f6304e8
Added `meas_type` to Sampler schema
gadial May 21, 2024
b9f8687
QuantumCircuit can be either object or string
gadial May 21, 2024
bbf4bd9
Change back to shots
jyu00 May 21, 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
270 changes: 270 additions & 0 deletions schemas/estimator_v2_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://www.qiskit.org/schemas/estimator_v2_schema.json",
"title": "EstimatorV2 input",
"description": "The input for an EstimatorV2 API call",
"version": "1.0.0",
"type": "object",
"required": ["pubs"],
"properties": {
"pubs": {
"type": "array",
"description": "Circuits/Observbles/Parameters to run",
"items": {
"type": "array",
jyu00 marked this conversation as resolved.
Show resolved Hide resolved
"minItems": 2,
"prefixItems": [
{"description": "The quantum circuit in base64-encoded QPY format. See https://docs.quantum.ibm.com/api/qiskit/qpy for more details on QPY.", "type": "object"},
{"description": "One or more observables.", "type": "array"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be helpful to point out the array elements need to be strings and/or show an example in the description.

{"description": "The parameter values", "type": "object"},
gadial marked this conversation as resolved.
Show resolved Hide resolved
{"description": "The precision for this specific pub", "type": "number"}
]
}
},
"options": {
"type": "object",
"description": "Options for V2 Estimator",
"properties": {
"seed_estimator": {
"description": "Seed used to control sampling",
"type": "integer"
},
"default_precision": {
"description": "The default precision to use for any PUB that does not specify one",
"type": "number"
gadial marked this conversation as resolved.
Show resolved Hide resolved
},
"default_shots": {
"description": "The total number of shots to use per circuit per configuration",
gadial marked this conversation as resolved.
Show resolved Hide resolved
"type": "integer"
gadial marked this conversation as resolved.
Show resolved Hide resolved
},
"dynamical_decoupling": {
"description": "Suboptions for dynamical decoupling",
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable dynamical decoupling.",
"type": "boolean"
},
"sequence_type": {
"description": "Which dynamical decoupling sequence to use",
"type": "string",
"enum": ["XX", "XpXm", "XY4"]
},
"extra_slack_distribution": {
"description": "Where to put extra timing delays due to rounding issues",
"type": "string",
"enum": ["middle", "edges"]
},
"scheduling_method": {
"description": "Whether to schedule gates as soon as ('asap') or as late as ('alap') possible",
"type": "string",
"enum": ["alap", "asap"]
}
}
},
"transpilation": {
"description": "Transpilation settings",
"type": "object",
"properties": {
"optimization_level": {
"description": "How much optimization to perform on the circuits",
"type": "integer",
"enum": [
0,
1
]
}
}
},
"resilience": {
"description": "Advanced resilience options to fine tune the resilience strategy",
"type": "object",
"properties": {
"measure_mitigation": {
"description": "Whether to enable measurement error mitigation method",
"type": "boolean"
},
"measure_noise_learning": {
"description": "Additional measurement noise learning options",
"type": "object",
"properties": {
"num_randomizations": {
"description": "The number of random circuits to draw for the measurement learning experiment",
"type": "integer"
gadial marked this conversation as resolved.
Show resolved Hide resolved
},
"shots_per_randomization": {
"description": "The number of shots to use for the learning experiment per random circuit.",
"oneOf": [{"type": "integer"}, {"enum": "auto"}]
gadial marked this conversation as resolved.
Show resolved Hide resolved
}
}
},
"zne_mitigation": {
"description": "Whether to turn on Zero Noise Extrapolation error mitigation method",
"type": "boolean"
},
"zne": {
"description": "Additional zero noise extrapolation mitigation options",
"type": "object",
"properties": {
"zne_noise_factors": {
"description": "Noise factors to use for noise amplification",
"type": "array",
"items": {
"type": "number"
}
},
"zne_extrapolator": {
"description": "Extrapolator(s) to try (in order) for extrapolating to zero noise",
"oneOf": [
{
"type": "array",
"items": {
"type": "string",
"enum": [
"linear",
"exponential",
"double_exponential",
"polynomial_degree_1",
"polynomial_degree_2",
"polynomial_degree_3",
"polynomial_degree_4",
"polynomial_degree_5",
"polynomial_degree_6",
"polynomial_degree_7"
]
}
},
{
"type": "string",
"enum": [
"linear",
"exponential",
"double_exponential",
"polynomial_degree_1",
"polynomial_degree_2",
"polynomial_degree_3",
"polynomial_degree_4",
"polynomial_degree_5",
"polynomial_degree_6",
"polynomial_degree_7"
]
}
]
}
}
},
"pec_mitigation": {
"description": "Whether to turn on Probabilistic Error Cancellation error mitigation method",
"type": "boolean"
},
"pec": {
"description": "Additional probabalistic error cancellation mitigation options",
"type": "object",
"properties": {
"max_overhead": {
"description": "The maximum circuit sampling overhead allowed",
"oneOf": [
{"type": "number"},
gadial marked this conversation as resolved.
Show resolved Hide resolved
{"type": "null"}
]
},
"noise_gain": {
"description": "The amount by which to scale the noise",
"oneOf": [
{"type": "numebr"},
gadial marked this conversation as resolved.
Show resolved Hide resolved
{"enum": ["auto"]}
]
}
}
},
"layer_noise_learning": {
"description": "Layer noise learning options",
"type": "object",
"properties": {
"max_layers_to_learn": {
"description": "The max number of unique layers to learn",
"type": "integer"
gadial marked this conversation as resolved.
Show resolved Hide resolved
},
"shots_per_randomization": {
"description": "The total number of shots to use per random learning circuit",
"type": "integer"
gadial marked this conversation as resolved.
Show resolved Hide resolved
},
"num_randomizations": {
"description": "The number of random circuits to use per learning circuit configuration",
"type": "integer"
gadial marked this conversation as resolved.
Show resolved Hide resolved
},
"layer_pair_depths": {
"description": "The circuit depths (measured in number of pairs) to use in learning experiments",
"type": "array",
"items": {
"type": "integer"
gadial marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}

}
},
"execution": {
"description": "Execution options",
"type": "object",
"properties": {
"init_qubits": {
"description": "Whether to reset the qubits to the ground state for each shot",
"type": "boolean"
},
"rep_delay": {
"description": "The delay between a measurement and the subsequent quantum circuit",
"type": "number"
}
}
},
"twirling": {
"description": "Twirling options",
"type": "object",
"properties": {
"enable_gates": {
"description": "Whether to apply 2-qubit gate twirling",
"type": "boolean"
},
"enable_measure": {
"description": "Whether to apply measurement twirling",
"type": "boolean"
},
"num_randomizations": {
"description": "The number of random samples to use when twirling or performing sampled mitigation",
"oneOf": [{"type": "integer"}, {"enum": ["auto"]}]
gadial marked this conversation as resolved.
Show resolved Hide resolved
},
"shots_per_randomization": {
"description": "The number of shots to run for each random sample",
"oneOf": [{"type": "integer"}, {"enum": ["auto"]}]
gadial marked this conversation as resolved.
Show resolved Hide resolved
},
"strategy": {
"description": "The strategy of twirling qubits in identified layers of 2-qubit twirled gates",
"type": "string",
"enum": [
"active",
"active-circuit",
"active-accum",
"all"
]
}
}
}
}
},
"resilience_level": {
"description": "How much resilience to build against errors",
"type": "integer",
"enum": [
0,
1,
2
]
},
"version": {
"description": "For EstimatorV2, version should always be 2",
"enum": [2]
}
}
}
jyu00 marked this conversation as resolved.
Show resolved Hide resolved
77 changes: 77 additions & 0 deletions schemas/sampler_v2_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://www.qiskit.org/schemas/sampler_v2_schema.json",
"title": "SamplerV2 input",
"description": "The input for an SamplerV2 API call",
"version": "1.0.0",
"type": "object",
"required": ["pubs"],
"properties": {
"pubs": {
"type": "array",
"description": "Circuits/Parameters to run",
"items": {
"type": "array",
"minItems": 1,
"prefixItems": [
{"description": "The quantum circuit", "type": "object"},
gadial marked this conversation as resolved.
Show resolved Hide resolved
{"description": "The parameter values", "type": "object"},
gadial marked this conversation as resolved.
Show resolved Hide resolved
{"description": "The numebr of shots to use in this pub", "type": "integer"}
]
}
},
"options": {
"type": "object",
"description": "Options for V2 Sampler",
"properties": {
"default_shots": {
"description": "The default number of shots to use if none are specified in the PUBs",
"type": "integer"
},
"dynamical_decoupling": {
"description": "Suboptions for dynamical decoupling",
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable DD as specified by the other options in this class",
"type": "boolean"
},
"sequence_type": {
"description": "Which dynamical decoupling sequence to use",
"type": "string",
"enum": ["XX", "XpXm", "XY4"]
},
"extra_slack_distribution": {
"description": "Where to put extra timing delays due to rounding issues",
"type": "string",
"enum": ["middle", "edges"]
},
"scheduling_method": {
"description": "Whether to schedule gates as soon as ('asap') or as late as ('alap') possible",
"type": "string",
"enum": ["alap", "asap"]
}
}
},
"execution": {
"description": "Execution options",
"type": "object",
"properties": {
"init_qubits": {
"description": "Whether to reset the qubits to the ground state for each shot",
"type": "boolean"
},
"rep_delay": {
"description": "The delay between a measurement and the subsequent quantum circuit",
"type": "number"
}
jyu00 marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
},
"version": {
"description": "For SamplerV2, version should always be 2",
"enum": [2]
}
}
}
jyu00 marked this conversation as resolved.
Show resolved Hide resolved
Loading