You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PulseDefaults.from_dict() would fail if the pulse defaults contain parametric pulse:
Traceback (most recent call last):
File "mod1.py", line 18, in <module>
new_defaults = PulseDefaults.from_dict(defaults_dict)
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/qiskit/validation/base.py", line 354, in from_dict
data = cls.schema.load(dict_)
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/marshmallow/schema.py", line 723, in load
data, many=many, partial=partial, unknown=unknown, postprocess=True
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/marshmallow/schema.py", line 897, in _do_load
partial=partial,
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/marshmallow/schema.py", line 1098, in _invoke_load_processors
partial=partial,
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/marshmallow/schema.py", line 1224, in _invoke_processors
data = processor(data, many=many, **kwargs)
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/qiskit/validation/base.py", line 163, in make_model
return self.model_cls(**data)
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/qiskit/validation/base.py", line 245, in _decorated
return init_method(self, **kwargs, validate=False)
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/qiskit/providers/models/pulsedefaults.py", line 146, in __init__
pulse_insts = [self.converter(inst) for inst in inst.sequence]
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/qiskit/providers/models/pulsedefaults.py", line 146, in <listcomp>
pulse_insts = [self.converter(inst) for inst in inst.sequence]
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/qiskit/qobj/converters/pulse_instruction.py", line 312, in __call__
return method(self, instruction)
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/qiskit/qobj/converters/pulse_instruction.py", line 476, in convert_parametric
command = ParametricPulseShapes[instruction.pulse_shape].value(**instruction.parameters)
File "/Users/jessieyu/.pyenv/versions/test_3.7.3/lib/python3.7/site-packages/qiskit/pulse/commands/parametric_pulses.py", line 295, in __init__
self._amp = complex(amp)
TypeError: complex() first argument must be a string or a number, not 'list'
Steps to reproduce the problem
Call PulseDefaults.from_dict(defaults_dict) where defaults_dict contains a parametric pulse. For example
which is probably why marshmallow didn't convert amp from list to complex (the _deserialize() for DictParameters doesn't do any conversion)
Given marshmallow has already been removed for PulseQobjInstructionSchema, the solution can be to just ignore it and tell people to upgrade if they encounter this issue.
The text was updated successfully, but these errors were encountered:
If I understand #7318 correctly, this technically isn't fixed, but the path being requested is obsolete. I'll close the issue now as stale, but if there's more to say, feel free to re-open.
Information
What is the current behavior?
PulseDefaults.from_dict()
would fail if the pulse defaults contain parametric pulse:Steps to reproduce the problem
Call
PulseDefaults.from_dict(defaults_dict)
wheredefaults_dict
contains a parametric pulse. For exampleExisting pulse defaults do not have parametric pulses, but that's being introduced.
What is the expected behavior?
PulseDefaults.from_dict()
loads correctly.Suggested solutions
The marshmallow schema for the
PulseQobjInstructionSchema
haswhich is probably why marshmallow didn't convert
amp
from list to complex (the_deserialize()
forDictParameters
doesn't do any conversion)Given marshmallow has already been removed for
PulseQobjInstructionSchema
, the solution can be to just ignore it and tell people to upgrade if they encounter this issue.The text was updated successfully, but these errors were encountered: