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 PR stops the support of pre-trained models for the MQT Predictor
framework.
Up until mqt.predictor v2.0.0, pre-trained models were provided.
However, this is not feasible anymore due to the increasing number of
devices and figures of merits.
Instead, we now provide a detailed documentation on how to train and
setup the MQT Predictor framework.
---------
Signed-off-by: Nils Quetschlich <[email protected]>
Co-authored-by: Lukas Burgholzer <[email protected]>
Copy file name to clipboardExpand all lines: docs/Compilation.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,4 +52,4 @@ We trained one RL model for each currently :ref:`supported quantum device <suppo
52
52
Training Data
53
53
-------------
54
54
To train the model, sufficient training data must be provided as qasm files in the `respective directory <https://github.com/cda-tum/mqt-predictor/tree/main/src/mqt/predictor/rl/training_data/training_circuits>`_.
55
-
We provide the training data used for the pre-trained models which are stored `here <https://github.com/cda-tum/mqt-predictor/tree/main/src/mqt/predictor/rl/training_data/trained_model>`_.
55
+
We provide the training data used for the initial performance evaluation of this framework which are stored `here <https://github.com/cda-tum/mqt-predictor/tree/main/src/mqt/predictor/rl/training_data/trained_model>`_.
Copy file name to clipboardExpand all lines: docs/DeviceSelection.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ Training Data
63
63
-------------
64
64
65
65
To train the model, sufficient training data must be provided as qasm files in the `respective directory <https://github.com/cda-tum/mqt-predictor/tree/main/src/mqt/predictor/ml/training_data/training_circuits>`_.
66
-
We provide the training data used for the pre-trained model.
66
+
We provide the training data used in the initial performance evaluation of this framework.
67
67
68
68
After the adjustment is finished, the following methods need to be called to generate the training data:
Copy file name to clipboardExpand all lines: docs/Usage.rst
+71Lines changed: 71 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,3 +37,74 @@ For that, the repository must be cloned and installed:
37
37
pip install .
38
38
39
39
Afterwards, the package can be used as described :ref:`above <pip_usage>`.
40
+
41
+
MQT Predictor Framework Setup
42
+
=============================
43
+
To run ``qcompile``, the MQT Predictor framework must be set up. How this is properly done is described next.
44
+
45
+
First, the to-be-considered quantum devices must be included in the framework.
46
+
Currently, all devices supported by `MQT Bench <https://github.com/cda-tum/mqt-bench>`_ are natively supported.
47
+
In case another device shall be considered, it can be added by using a similar format as in MQT Bench but it is not
48
+
necessary to add it in the repository since it can be directly added to the MQT Predictor framework as follows:
49
+
50
+
- Modify in `mqt/predictor/rl/predictorenv.py <https://github.com/cda-tum/mqt-predictor/tree/main/src/mqt/predictor/rl/predictorenv.py>`_. the line where ``mqt.bench.devices.get_device_by_name`` is used.
51
+
- Modify in `mqt/predictor/ml/predictor.py <https://github.com/cda-tum/mqt-predictor/tree/main/src/mqt/predictor/ml/predictor.py>`_. the lines where ``mqt.bench.devices.*`` are used.
52
+
- Follow the same data format as defined in `mqt.bench.devices.device.py <https://github.com/cda-tum/mqt-bench/tree/main/src/mqt/bench/devices/device.py>`_
53
+
54
+
Second, for each supported device, a respective reinforcement learning model must be trained. This is done by running
55
+
the following command based on the training data in the form of quantum circuits provided as qasm files in
This will train a reinforcement learning model for the ``ibm_washington`` device with the expected fidelity as figure of merit.
68
+
Additionally to the expected fidelity, also critical depth is provided as another figure of merit.
69
+
Further figures of merit can be added in `mqt.predictor.reward.py <https://github.com/cda-tum/mqt-predictor/tree/main/src/mqt/predictor/reward.py>`_.
70
+
71
+
Third, after the reinforcement learning models that are used for the respective compilations are trained, the
72
+
supervised machine learning model to predict the device selection must be trained.
73
+
This is done by first creating the necessary training data (based on the training data in the form of quantum circuits provided as qasm files in
74
+
`mqt/predictor/ml/training_data/training_circuits <https://github.com/cda-tum/mqt-predictor/tree/main/src/mqt/predictor/ml/training_data/training_circuits>`_) and then running the following command:
75
+
76
+
.. code-block:: python
77
+
78
+
ml_pred = mqt.predictor.ml.Predictor()
79
+
ml_pred.generate_compiled_circuits(timeout=600) # timeout in seconds
Copy file name to clipboardExpand all lines: docs/index.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ The MQT Predictor framework is based on two main components:
20
20
- A :doc:`Device-Specific Circuit Compilation <Compilation>` component that compiles a given quantum circuit for a given device.
21
21
22
22
Combining these two components, the framework can be used to automatically compile a given quantum circuit for the most suitable device optimizing a :doc:`customizable figure of merit<FigureOfMerit>`.
23
+
How to use the framework is described in the :doc:`Usage <Usage>` section.
23
24
24
25
If you are interested in the theory behind MQT Predictor, have a look at the publications in the :doc:`references list <References>`.
error_msg="Suitable trained models cannot be downloaded since the GitHub API failed. One reasons could be that the limit of 60 API calls per hour and IP address is exceeded."
463
-
raiseRuntimeError(error_msg)
464
-
465
-
response_json=response.json()
466
-
if"assets"inresponse_json:
467
-
assets=response_json["assets"]
468
-
elif"asset"inresponse_json:
469
-
assets= [response_json["asset"]]
470
-
else:
471
-
assets= []
472
-
473
-
forassetinassets:
474
-
ifmodel_nameinasset["name"]:
475
-
version_found=True
476
-
download_url=asset["browser_download_url"]
477
-
logger.info("Downloading model from: "+download_url)
0 commit comments