-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add disable_validation option to SymbolicPulse #11029
Conversation
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 6602984928
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TsafrirA Sorry about slow response. My main concern here is having a class variable in the constructor. Could you please reconsider? Also I need new-feature reno to approve.
@@ -390,6 +390,8 @@ def Sawtooth(duration, amp, freq, name): | |||
"_valid_amp_conditions", | |||
) | |||
|
|||
disable_validation = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since argument is called constraints
, something like ignore_constraints
is more intuitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkanazawa1989
The function is called validate_parameters
so I went with that. Note that the function also validates the amplitude, and not just the constraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TsafrirA this looks good to me.
Summary
A
disable_validation
option was added to theSymbolicPulse
class. This option improves the JAX compatibility of Qiskit Pulse, which is important for Qiskit Dynamics users.Background
Qiskit Dynamics relies on JAX to massively improve run times. However, this improvement comes at a cost - the code has to be JAX compatible, and mundane operations become problematic. The parameter validation of
SymbolicPulse
objects falls under this problematic category and limits the ability to use Qiskit Pulse with Qiskit Dynamics. For example, this Qiskit Dynamics tutorial defines from scratch a Gaussian pulse, simply to avoid the parameter validation.Details and comments
A
disable_validation
option was added toSymbolicPulse
class. The option can be set the class attributedisable_validation
. For example, the following pulse will trigger the validation automatically and fail it:however, this will not:
The triggering of the
validate_parameters
method was moved from individual library pulses, directly into the instantiation ofSymbolicPulse
object. As all library pulses triggered the validation, this will not have any effect on them. However, user definedSymbolicPulses
s which did not trigger the validation, will now trigger it, potentially causing a disruption. It will be an easy fix though.With the Qiskit Pulse compiler coming along (#10759 ) it was likely that the validation would be delegated to the compiler anyway. In that sense, disabling the validation is not far off from what we are going for anyway.
I've taken the liberty to remove some
limit_amplitude
tests, which were redundant.