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
This causes _pickle.PicklingError: Can't pickle typing.Union[qiskit.circuit.parameterexpression.ParameterExpression, float]: it's not the same object as typing.Union and hangs the parallel map. This is the blocker of #6759 .
I was thinking this is fork issue and tried to deep copy the inst_map, but seems like this is a different problem.
Currently inst map depends on the builtin inspect module, because the map accepts both callback function and Schedule with Parameter to define a template schedule. From InstructionScheduleMap.get method, these programs look like a function that has several named arguments (i.e. pulse parameters), but can have default values and also partially assigned if the program is Schedule. To support this complicated behavior, we implemented parameter signature management and assignment logic with instpect.Signature. For example,
There is an similar issue here huggingface/transformers#8212
Seems like the solution is to upgrade Python (drop py36 test) or change implementation of InstructionScheduleMap.
Information
What is the current behavior?
This causes
_pickle.PicklingError: Can't pickle typing.Union[qiskit.circuit.parameterexpression.ParameterExpression, float]: it's not the same object as typing.Union
and hangs the parallel map. This is the blocker of #6759 .I was thinking this is fork issue and tried to deep copy the inst_map, but seems like this is a different problem.
Note
To test above code, a part of #6759 is needed (the master uses lambda function here but this cannot be pickled).
https://github.com/Qiskit/qiskit-terra/blob/0f9aa882b8cbdcef4614b94031ddd3244832d8d6/qiskit/pulse/instruction_schedule_map.py#L73-L76
What is the expected behavior?
Currently inst map depends on the builtin inspect module, because the map accepts both callback function and
Schedule
withParameter
to define a template schedule. FromInstructionScheduleMap.get
method, these programs look like a function that has several named arguments (i.e. pulse parameters), but can have default values and also partially assigned if the program isSchedule
. To support this complicated behavior, we implemented parameter signature management and assignment logic withinstpect.Signature
. For example,https://github.com/Qiskit/qiskit-terra/blob/a34b2ab002c0e0935d02691026ae676ee0adf90b/qiskit/pulse/instruction_schedule_map.py#L190-L197
This object cannot be dropped unless we find alternative approach.
Suggested solutions
No idea. Seems like a defect of python3.6.
The text was updated successfully, but these errors were encountered: