QuEraComputing / bloqade-python

QuEra's Neutral Atom SDK for Analog QPUs
https://bloqade.quera.com/
Other
54 stars 14 forks source link

Bloqade101 tutorial aquila run_async submission validation exception #861

Closed ryanhill1 closed 8 months ago

ryanhill1 commented 8 months ago

Describe the bug

Following Bloqade101 tutorial. Configured AWS credentials and copied code in exactly, but got exception trying to submit program to Aquila.

Minimal broken example

from bloqade import start

program = (
    start.add_position((0, 0))
    .rydberg.detuning.uniform.constant(10, 1.1)
    .amplitude.uniform.piecewise_linear([0.05, 1.0, 0.05], [0, 15, 15, 0])
)

result = program.braket.aquila().run_async(100)
---------------------------------------------------------------------------
SubmissionException                       Traceback (most recent call last)
Cell In[3], line 1
----> 1 result = program.braket.aquila().run_async(100)

File <@beartype(bloqade.ir.routine.braket.BraketHardwareRoutine.run_async) at 0x40979ce4c0>:104, in run_async(__beartype_func, __beartype_conf, __beartype_get_violation, __beartype_object_277184783488, __beartype_getrandbits, __beartype_object_277421535360, __beartype_object_277421220640, *args, **kwargs)

File /opt/conda/lib/python3.9/site-packages/bloqade/ir/routine/braket.py:112, in BraketHardwareRoutine.run_async(self, shots, args, name, shuffle, **kwargs)
     93 """
     94 Compile to a RemoteBatch, which contain
     95 Braket backend specific tasks, and run_async to Braket.
   (...)
    108 
    109 """
    111 batch = self._compile(shots, args, name)
--> 112 batch._submit(shuffle, **kwargs)
    113 return batch

File /opt/conda/lib/python3.9/site-packages/bloqade/task/batch.py:534, in RemoteBatch._submit(self, shuffle_submit_order, ignore_submission_error, **kwargs)
    526         warnings.warn(
    527             "One or more error(s) occured during submission, please see "
    528             "the following files for more information:\n"
   (...)
    531             RuntimeWarning,
    532         )
    533     else:
--> 534         raise RemoteBatch.SubmissionException(
    535             str(errors)
    536             + "\n"
    537             + "One or more error(s) occured during submission, please see "
    538             "the following files for more information:\n"
    539             f"  - {os.path.join(cwd, future_file)}\n"
    540             f"  - {os.path.join(cwd, error_file)}\n"
    541         )
    543 else:
    544     # TODO: think about if we should automatically save successful submissions
    545     #       as well.
    546     pass

SubmissionException: Task 0 failed to submit with error: ValidationException
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/bloqade/task/batch.py", line 491, in _submit
    task.submit(**kwargs)
  ...
  ...
  File "/opt/conda/lib/python3.9/site-packages/botocore/client.py", line 1009, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the CreateQuantumTask operation: 1 validation error for DrivingFieldValidator
__root__
  For the amplitude field, rate of change of values (between the 0-th and the 1-th times) is 3.000000E+14, more than 250000000000000.0 (type=value_error)

One or more error(s) occured during submission, please see the following files for more information:
  - /home/jovyan/partial-batch-future-2024-01-11 18:48:40.250896.json
  - /home/jovyan/partial-batch-errors-2024-01-11 18:48:40.250896.json

Expected behavior

If tutorial program code is correct, should submit without error.

If tutorial program code is incorrect, should be updated.

Screenshots

Tutorial:

Screenshot 2024-01-11 at 12 57 01 PM

My notebook:

Screenshot 2024-01-11 at 12 58 21 PM

Desktop (please complete the following information):

ryanhill1 commented 8 months ago

Update: It turns out it was just a problem with the given example program. PR linked above giving fix.

However, it would be nice if we could make the error message a bit more descriptive, particularly in the line:

For the amplitude field, rate of change of values (between the 0-th and the 1-th times) is 3.000000E+14, more than 250000000000000.0

it would be great to add units or ballpark of how much the rabi amplitude would need to be lowered by.

weinbe58 commented 8 months ago

This example should work as is without having to change the parameters. We have run this in the past so there is probably something else going on here.

weinbe58 commented 8 months ago

Oh wait nvm, yeah the ramp up and down time should be 0.06 to make this work.