-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating Pytorch backend to Qiboml #1510
Changes from all commits
41e0b85
c1eef23
d3255c1
fdaf4c8
86e1574
cbc6ed9
ce623b1
77008a8
b744521
299d78a
1c38069
dbf8cbe
9762788
70e26ac
aa22507
5208307
eed754f
b9e340b
832d43c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,15 @@ Operating systems support | |
In the table below we summarize the status of *pre-compiled binaries | ||
distributed with pypi* for the packages listed above. | ||
|
||
+------------------+------+---------+------------+ | ||
| Operating System | qibo | qibojit | tensorflow | | ||
+==================+======+=========+============+ | ||
| Linux x86 | Yes | Yes | Yes | | ||
+------------------+------+---------+------------+ | ||
| MacOS >= 10.15 | Yes | Yes | Yes | | ||
+------------------+------+---------+------------+ | ||
| Windows | Yes | Yes | Yes | | ||
+------------------+------+---------+------------+ | ||
+------------------+------+---------+-----------+---------+ | ||
| Operating System | qibo | qibojit |Tensorflow | Pytorch | | ||
+==================+======+=========+===========+=========+ | ||
| Linux x86 | Yes | Yes | Yes | Yes | | ||
+------------------+------+---------+-----------+---------+ | ||
| MacOS >= 10.15 | Yes | Yes | Yes | Yes | | ||
+------------------+------+---------+-----------+---------+ | ||
| Windows | Yes | Yes | Yes | Yes | | ||
+------------------+------+---------+-----------+---------+ | ||
|
||
.. note:: | ||
All packages are supported for Python >= 3.9. | ||
|
@@ -148,35 +148,6 @@ Then proceed with the ``qibojit`` installation using ``pip`` | |
|
||
_______________________ | ||
|
||
.. _installing-tensorflow: | ||
|
||
tensorflow | ||
^^^^^^^^^^ | ||
|
||
If the `TensorFlow <https://www.tensorflow.org>`_ package is installed Qibo | ||
will detect and provide to the user the possibility to use ``tensorflow`` | ||
backend. | ||
|
||
This backend is used by default if ``qibojit`` is not installed, however, if | ||
needed, in order to switch to the ``tensorflow`` backend please do: | ||
|
||
.. code-block:: python | ||
|
||
import qibo | ||
qibo.set_backend("tensorflow") | ||
|
||
In order to install the package, we recommend the installation using: | ||
|
||
.. code-block:: bash | ||
|
||
pip install qibo tensorflow | ||
|
||
.. note:: | ||
TensorFlow can be installed following its `documentation | ||
<https://www.tensorflow.org/install>`_. | ||
|
||
_______________________ | ||
|
||
.. _installing-numpy: | ||
|
||
numpy | ||
|
@@ -197,26 +168,45 @@ please do: | |
_______________________ | ||
|
||
|
||
.. _installing-pytorch: | ||
.. _installing-qml-backends: | ||
|
||
pytorch | ||
^^^^^^^ | ||
Backends with automatic differentiation support | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
If you need automatic differentiation support, for tracing gradients of your | ||
quantum algorithm or for building some quantum machine learning routine, | ||
the right backends for you are those provided by the `Qiboml <https://github.com/qiboteam/qiboml>`__ | ||
package. | ||
|
||
If the `PyTorch <https://pytorch.org/>`_ package is installed Qibo | ||
will detect and provide to the user the possibility to use ``pytorch`` | ||
backend. | ||
In particular, Qiboml currently support `Pytorch <https://pytorch.org/>`_ and | ||
`Tensorflow <https://www.tensorflow.org>`_ interfaces, integrating the qibo functionalities | ||
into these well-known machine learning frameworks. Quantum layers can be constructed | ||
and added to your Pytorch or Tensorflow models, and trained using any supported | ||
optimization routine. | ||
|
||
In order to switch to the ``pytorch`` backend please do: | ||
In order to use these quantum machine learning backends please make sure the | ||
preferred package is installed following `Tensorflow's <https://www.tensorflow.org/install>`_ | ||
or `Pytorch's <https://pytorch.org/get-started/locally/>`_ installation instructions. | ||
|
||
To switch to Tensorflow or Pytorch backend please do: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure whether it is worth to have details about the ml backends. I would probably place this in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, I would remove these lines. Probably it is better to wait the moment the Qiboml docs are ready so that we can just link to the proper section. |
||
|
||
.. code-block:: python | ||
|
||
import qibo | ||
qibo.set_backend("pytorch") | ||
# in case of Tensorflow | ||
qibo.set_backend(backend="qiboml", platform="tensorflow") | ||
# in case of Pytorch | ||
qibo.set_backend(backend="qiboml", platform="pytorch") | ||
|
||
In order to install the package, we recommend the installation using: | ||
In order to start using automatic differentiation tools with Qibo, | ||
we recommend the installation using: | ||
|
||
.. code-block:: bash | ||
|
||
pip install qibo torch | ||
pip install qibo qiboml tensorflow | ||
|
||
_______________________ | ||
or | ||
|
||
.. code-block:: bash | ||
|
||
pip install qibo qiboml torch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be updated to contemplate the CPU / GPU subdivision? Both
qibojit
andqiboml
have backends that work on both.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, since this is already shown in the backends diagram.