Skip to main content

An open source framework for using Amazon Braket devices with the PennyLane quantum machine learning library

Project description

Latest Version Supported Python Versions Build Status codecov Documentation Status

The Amazon Braket PennyLane plugin offers four Amazon Braket quantum devices to work with PennyLane:

  • braket.aws.qubit for running with the Amazon Braket service’s quantum devices, both QPUs and simulators

  • braket.local.qubit for running the Amazon Braket SDK’s local simulator where you can optionally specify the backend (“default”, “braket_sv”, “braket_dm” etc)

  • braket.aws.ahs for running with the Amazon Braket service’s analog Hamiltonian simulation QPUs

  • braket.local.ahs for running analog Hamiltonian simulation on Amazon Braket SDK’s local simulator

The Amazon Braket Python SDK is an open source library that provides a framework to interact with quantum computing hardware devices and simulators through Amazon Braket.

PennyLane is a machine learning library for optimization and automatic differentiation of hybrid quantum-classical computations.

The plugin documentation can be found here: https://amazon-braket-pennylane-plugin-python.readthedocs.io/en/latest/.

Features

Provides four devices to be used with PennyLane:

  • Two gate-based devices, braket.aws.qubit for running on the Amazon Braket service, and braket.local.qubit for running on the Amazon Braket SDK’s local simulator.

  • Two analog Hamiltonian simulation devices, braket.aws.ahs for running on QPU via the Amazon Braket service, and braket.local.ahs for running on the Amazon Braket SDK’s local simulator.

  • Combines Amazon Braket with PennyLane’s automatic differentiation and optimization.

For the gate-based devices:

  • Both devices support most core qubit PennyLane operations.

  • All PennyLane observables are supported.

  • Provides custom PennyLane operations to cover additional Braket operations: ISWAP, PSWAP, and many more. Every custom operation supports analytic differentiation.

For the analog Hamiltonian simulation devices:

  • The devices support ParametrizedEvolution operators created via the PennyLane pulse programming module.

  • PennyLane observables in the measurement (Z) basis are supported

  • Provides translation of user-defined pulse level control to simulation and hardware implementation

Installation

Before you begin working with the Amazon Braket PennyLane Plugin, make sure that you installed or configured the following prerequisites:

  • Download and install Python 3.11 or greater. If you are using Windows, choose the option Add Python to environment variables before you begin the installation.

  • Make sure that your AWS account is onboarded to Amazon Braket, as per the instructions here.

  • Download and install PennyLane:

    pip install pennylane

You can then install the latest release of the PennyLane-Braket plugin as follows:

pip install amazon-braket-pennylane-plugin

You can also install the development version from source by cloning this repository and running a pip install command in the root directory of the repository:

git clone https://github.com/amazon-braket/amazon-braket-pennylane-plugin-python.git
cd amazon-braket-pennylane-plugin-python
pip install .

You can check your currently installed version of amazon-braket-pennylane-plugin with pip show:

pip show amazon-braket-pennylane-plugin

or alternatively from within Python:

from braket import pennylane_plugin
pennylane_plugin.__version__

Tests

Make sure to install test dependencies first:

pip install -e "amazon-braket-pennylane-plugin-python[test]"

Unit tests

Run the unit tests using:

tox -e unit-tests

To run an individual test:

tox -e unit-tests -- -k 'your_test'

To run linters, doc, and unit tests:

tox

Integration tests

To run the integration tests, set the AWS_PROFILE as explained in the amazon-braket-sdk-python README:

export AWS_PROFILE=Your_Profile_Name

Running the integration tests creates an S3 bucket in the same account as the AWS_PROFILE with the following naming convention amazon-braket-pennylane-plugin-integ-tests-{account_id}.

Run the integration tests with:

tox -e integ-tests

To run an individual integration test:

tox -e integ-tests -- -k 'your_test'

Documentation

To build the HTML documentation, run:

tox -e docs

The documentation can then be found in the doc/build/documentation/html/ directory.

Contributing

We welcome contributions - simply fork the repository of this plugin, and then make a pull request containing your contribution. All contributers to this plugin will be listed as authors on the releases.

We also encourage bug reports, suggestions for new features and enhancements, and even links to cool projects or applications built with the plugin.

Support

If you are having issues, please let us know by posting the issue on our Github issue tracker, or by asking a question in the forum.

License

This project is licensed under the Apache-2.0 License.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amazon_braket_pennylane_plugin-1.34.0.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amazon_braket_pennylane_plugin-1.34.0-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

Details for the file amazon_braket_pennylane_plugin-1.34.0.tar.gz.

File metadata

File hashes

Hashes for amazon_braket_pennylane_plugin-1.34.0.tar.gz
Algorithm Hash digest
SHA256 4f264b8c4cf28d788d713ef57cb227a3297e066775cc5d869d06bf99f781dc00
MD5 a5415363b1599627976c14605a60fb16
BLAKE2b-256 7ce904d0315cf9f6ba770be175682b8b9f888e488eb9f3d44de3e955e71a761f

See more details on using hashes here.

Provenance

The following attestation bundles were made for amazon_braket_pennylane_plugin-1.34.0.tar.gz:

Publisher: publish-to-pypi.yml on amazon-braket/amazon-braket-pennylane-plugin-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file amazon_braket_pennylane_plugin-1.34.0-py3-none-any.whl.

File metadata

File hashes

Hashes for amazon_braket_pennylane_plugin-1.34.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dbc857e694886a74a025957e37c556ab8a70659cdcae7519d091d2280d8bdc75
MD5 0910d7dc6ee909f02941a0c72772a9b0
BLAKE2b-256 1369b2c578e2a6d35f19f1a7375bbe620837a2add98d8800cc617debf00cf715

See more details on using hashes here.

Provenance

The following attestation bundles were made for amazon_braket_pennylane_plugin-1.34.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on amazon-braket/amazon-braket-pennylane-plugin-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page