Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 4 characters in body
Source Link
Jin
  • 81
  • 4
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-17-16f293a93614> in <module>
----> 1 arm_resultresult = backend.run(rabi_qobj).result()

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-17-16f293a93614> in <module>
----> 1 arm_result = backend.run(rabi_qobj).result()

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-17-16f293a93614> in <module>
----> 1 result = backend.run(rabi_qobj).result()

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
deleted 2107 characters in body
Source Link
Jin
  • 81
  • 4

I'm trying to follow tutorial on pulse simulation described in qiskit.org. The generated PulseQobj is well executed with AER simulator, but it throws JSONDecodeError when using real backends (ex. ibmq-armonk). The The PulseQobj passed the validation (validate_qobj_against_schemavalidate_qobj_against_schema), so I'm struggling to find the reason. Qobj, generated by QuantumCircuit command, does not raise this error.

I connected to real device with APItoken, and qiskit version is up to date (qiskit 0.22.0). Below is the trial code with real device, and log after backend.run(PulseQobj)

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call%matplotlib last)inline
<ipython-input-17-16f293a93614> in <module>
---->import 1numpy arm_resultas =np
from backendqiskit.run(rabi_qobj)ignis.result()

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\ibmqbackendcharacterization.py in run(self, qobj, job_name,calibrations job_share_level,import job_tagsrabi_schedules, validate_qobj)RabiFitter
    175       from qiskit.pulse ifimport validate_qobj:DriveChannel
    176          from qiskit.compiler import validate_qobj_against_schema(qobj)assemble
--> 177         returnfrom selfqiskit._submit_job(qobj,.utils job_name,import api_job_share_levelMeasLevel, job_tags)
    178 MeasReturnType
    179   from qiskit defimport _submit_job(IBMQ

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\ibmqbackendIBMQ.py in _submit_jobenable_account(selfAPItoken, qobj,proxies job_name,= job_share_levelProxyConfig, job_tags)
    213         try:
    214             qobj_dictverify = qobj.to_dict(certPath)
--> 215             submit_infoprovider = self._api_clientIBMQ.job_submitget_provider(
    216               hub=hub, group=group, backend_name=self.name(project=project),
    217               backend = qobj_dict=qobj_dict,

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\api\clients\accountprovider.py in job_submitget_backend(self, backend_name, qobj_dict, job_name, job_share_level, job_tagsdevice)
    217 
    218         # Upload the Qobj to objectqubit storage.list
--> 219         _qubits = job_api.put_object_storage(upload_url, qobj_dict)[0]
    220 
    221         # Notify the APIdrive viaamplitudes theto callback.
use
D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\api\rest\job.py in put_object_storage(self,num_exps url,= qobj_dict)64
    188         datadrive_amps = jsonnp.dumpslinspace(qobj_dict0, cls=json_encoder1.IQXJsonEncoder0, num_exps) 

# drive shape parameters
drive_duration 189= 2048
drive_sigma = 256

# list of drive channels
drive_channels = logger.debug[DriveChannel('Uploading to object storage.'0)]
--> 190     
# construct the schedules
rabi_schedules, responsexdata = self.session.putrabi_schedules(url, data=data, bare=Trueamp_list=drive_amps, timeout=600,
    191                                     headers={'Content-Type':qubits=qubits, 'application/json'})
    192         return response.text

D:\Anaconda3\lib\site-packages\requests\sessions.py in put(self, url, data, **kwargs)
    588         """
    589 
--> 590         return self.request('PUT', url, data=datapulse_width=drive_duration, **kwargs)
    591 
    592     def patch(self, url, data=None, **kwargs):

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\api\session.py in request(self, method, url, bare, **kwargs)
    284                 except (ValueErrorpulse_sigma=drive_sigma, KeyError):
    285                     # the response did not contain the expected json.
--> 286      drives=drive_channels,  
              message += ". {}".format(ex.response.json())
    287 
     288             if self.access_token:

D:\Anaconda3\lib\site-packages\requests\modelsinst_map=backend.py in jsondefaults(self).instruction_schedule_map, **kwargs)
    896                     # used.
    897                     pass
--> 898         return complexjsonmeas_map=backend.loadsconfiguration(self).text, **kwargsmeas_map)
    899 
    900     @property

D:\Anaconda3\lib\json\__init__.pyrabi_qobj in= loadsassemble(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hookrabi_schedules, **kw)
    355             parse_int is None and parse_float is None andbackend=backend,
    356             parse_constant is None and object_pairs_hook is None and notmeas_level=1, kw):
--> 357         return _default_decoder.decode(s)
    358     if cls is None:meas_return='avg',
    359         cls = JSONDecoder

D:\Anaconda3\lib\json\decoder.py in decode(self, s, _w)
    335 shots=512)
    336         """
--> 337         obj, endresult = selfbackend.raw_decode(s, idx=_wrun(s, 0rabi_qobj).endresult())
    338         end = _w(s, end).end()
    339      
---------------------------------------------------------------------------
JSONDecodeError   if end != len(s):

D:\Anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
    353             obj,Traceback end(most =recent self.scan_once(s,call idxlast)
    354         except StopIteration<ipython-input-17-16f293a93614> asin err:<module>
----> 355           1 arm_result raise= JSONDecodeErrorbackend.run("Expecting value", s, errrabi_qobj).valueresult() from None
    356         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I'm trying to follow tutorial on pulse simulation described in qiskit.org. The generated PulseQobj is well executed with AER simulator, but it throws JSONDecodeError when using real backends (ex. ibmq-armonk). The PulseQobj passed the validation (validate_qobj_against_schema), so I'm struggling to find the reason.

I connected to real device with APItoken, and qiskit version is up to date (qiskit 0.22.0). Below is the log after backend.run(PulseQobj)

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-17-16f293a93614> in <module>
----> 1 arm_result = backend.run(rabi_qobj).result()

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\ibmqbackend.py in run(self, qobj, job_name, job_share_level, job_tags, validate_qobj)
    175         if validate_qobj:
    176             validate_qobj_against_schema(qobj)
--> 177         return self._submit_job(qobj, job_name, api_job_share_level, job_tags)
    178 
    179     def _submit_job(

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\ibmqbackend.py in _submit_job(self, qobj, job_name, job_share_level, job_tags)
    213         try:
    214             qobj_dict = qobj.to_dict()
--> 215             submit_info = self._api_client.job_submit(
    216                 backend_name=self.name(),
    217                 qobj_dict=qobj_dict,

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\api\clients\account.py in job_submit(self, backend_name, qobj_dict, job_name, job_share_level, job_tags)
    217 
    218         # Upload the Qobj to object storage.
--> 219         _ = job_api.put_object_storage(upload_url, qobj_dict)
    220 
    221         # Notify the API via the callback.

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\api\rest\job.py in put_object_storage(self, url, qobj_dict)
    188         data = json.dumps(qobj_dict, cls=json_encoder.IQXJsonEncoder)
    189         logger.debug('Uploading to object storage.')
--> 190         response = self.session.put(url, data=data, bare=True, timeout=600,
    191                                     headers={'Content-Type': 'application/json'})
    192         return response.text

D:\Anaconda3\lib\site-packages\requests\sessions.py in put(self, url, data, **kwargs)
    588         """
    589 
--> 590         return self.request('PUT', url, data=data, **kwargs)
    591 
    592     def patch(self, url, data=None, **kwargs):

D:\Anaconda3\lib\site-packages\qiskit\providers\ibmq\api\session.py in request(self, method, url, bare, **kwargs)
    284                 except (ValueError, KeyError):
    285                     # the response did not contain the expected json.
--> 286                     message += ". {}".format(ex.response.json())
    287 
     288             if self.access_token:

D:\Anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs)
    896                     # used.
    897                     pass
--> 898         return complexjson.loads(self.text, **kwargs)
    899 
    900     @property

D:\Anaconda3\lib\json\__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    355             parse_int is None and parse_float is None and
    356             parse_constant is None and object_pairs_hook is None and not kw):
--> 357         return _default_decoder.decode(s)
    358     if cls is None:
    359         cls = JSONDecoder

D:\Anaconda3\lib\json\decoder.py in decode(self, s, _w)
    335 
    336         """
--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338         end = _w(s, end).end()
    339         if end != len(s):

D:\Anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
    353             obj, end = self.scan_once(s, idx)
    354         except StopIteration as err:
--> 355             raise JSONDecodeError("Expecting value", s, err.value) from None
    356         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I'm trying to follow tutorial on pulse simulation described in qiskit.org. The generated PulseQobj is well executed with AER simulator, but it throws JSONDecodeError when using real backends (ex. ibmq-armonk). The PulseQobj passed the validation (validate_qobj_against_schema), so I'm struggling to find the reason. Qobj, generated by QuantumCircuit command, does not raise this error.

I connected to real device with APItoken, and qiskit version is up to date (qiskit 0.22.0). Below is the trial code with real device, and log after backend.run(PulseQobj)

%matplotlib inline

import numpy as np
from qiskit.ignis.characterization.calibrations import rabi_schedules, RabiFitter
from qiskit.pulse import DriveChannel
from qiskit.compiler import assemble
from qiskit.qobj.utils import MeasLevel, MeasReturnType
from qiskit import IBMQ

IBMQ.enable_account(APItoken, proxies = ProxyConfig, verify = certPath)
provider = IBMQ.get_provider(hub=hub, group=group, project=project)
backend = provider.get_backend(device)

# qubit list
qubits = [0]

# drive amplitudes to use
num_exps = 64
drive_amps = np.linspace(0, 1.0, num_exps) 

# drive shape parameters
drive_duration = 2048
drive_sigma = 256

# list of drive channels
drive_channels = [DriveChannel(0)]

# construct the schedules
rabi_schedules, xdata = rabi_schedules(amp_list=drive_amps, 
                                       qubits=qubits, 
                                       pulse_width=drive_duration, 
                                       pulse_sigma=drive_sigma,
                                       drives=drive_channels,  
                                       inst_map=backend.defaults().instruction_schedule_map, 
                                       meas_map=backend.configuration().meas_map)

rabi_qobj = assemble(rabi_schedules, 
                     backend=backend,
                     meas_level=1, 
                     meas_return='avg',
                     shots=512)

result = backend.run(rabi_qobj).result()

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-17-16f293a93614> in <module>
----> 1 arm_result = backend.run(rabi_qobj).result()

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
edited tags
Link
glS
  • 26.9k
  • 6
  • 35
  • 121
Source Link
Jin
  • 81
  • 4
Loading