Skip to content
Open
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
12fad57
added function related to training and for GNN, needed to define GNN …
Aug 19, 2025
be734dd
Added the gnn part, must be fine-tuned hyper-params, no test
Aug 19, 2025
61c6824
Removed the barriers in the creation of the DAG
Aug 19, 2025
75875ff
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 19, 2025
081651c
coded tested and fixed, need to add a cross validation module
Aug 20, 2025
b82dc01
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Aug 20, 2025
5ebd202
fixed the problem of the predict_device_for_figure_of_merits
Aug 20, 2025
857cd6f
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 20, 2025
6081f6b
Hellinger test done: success
Aug 20, 2025
7c54da6
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
Aug 20, 2025
bb4da24
GNN predictor fixed with optuna and tested
Aug 21, 2025
10bb52c
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 21, 2025
06be0d6
GNN predictor fixed with optuna and tested
Aug 21, 2025
ce990e3
Modified the tolm for running on the MacOS
Aug 21, 2025
96ca75b
Problems modified TPESampler and not TYPESampler
Aug 21, 2025
a64a082
Problems modified TPESampler and not TYPESampler
Aug 21, 2025
f8c99b5
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 21, 2025
e4e2742
Problems modified TPESampler and not TYPESampler
Aug 21, 2025
5784ff7
Problems modified TPESampler and not TYPESampler
Aug 21, 2025
7e17379
Test modified with number of epochs as parameter
Aug 21, 2025
082de05
Eliminated trained model
Aug 21, 2025
5ed00a9
Changed the test estimated hellinger for windows
Aug 21, 2025
e59a941
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 21, 2025
3a9f16c
Changed the test estimated hellinger for windows
Aug 21, 2025
c43ee01
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
Aug 21, 2025
92eda99
Changed the test estimated hellinger for windows
Aug 21, 2025
dc1aa55
Problem with windows solved eliminating warning
Aug 21, 2025
6809ccb
Files modified according suggestion
Aug 22, 2025
8c77598
Fixed the comments related to test hellinger distance and utils
antotu Aug 25, 2025
dc0a824
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 25, 2025
2419952
Fixed modification also with pre-commit
antotu Aug 25, 2025
5335241
Fixed modification also with pre-commit
antotu Aug 25, 2025
96096a0
Refactor the test ml predictor considering to join function related M…
antotu Aug 25, 2025
4613012
Modified part of helper in order to solve problems code
antotu Aug 26, 2025
1c728e2
Pre-commit has substituted Wille in Will
antotu Aug 26, 2025
c31cb46
Update tests/device_selection/test_predictor_ml.py
antotu Aug 27, 2025
13cf0f4
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 27, 2025
713343f
first round fixes
antotu Aug 27, 2025
17c6575
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 27, 2025
169b00e
pre-commit fixes
antotu Aug 27, 2025
2248081
pre-commit fixes
antotu Aug 27, 2025
8f90b12
Update src/mqt/predictor/ml/predictor.py
antotu Aug 27, 2025
74ec34b
Update src/mqt/predictor/ml/predictor.py
antotu Aug 27, 2025
f99e17b
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 27, 2025
57b1a29
Partial modification
antotu Aug 27, 2025
96232f0
Merge branch 'gnn-branch' of github.com:antotu/predictor-gnn into gnn…
antotu Aug 27, 2025
61965d8
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 27, 2025
93f5414
fixed comments repo
antotu Aug 27, 2025
95f5359
Merge branch 'gnn-branch' of github.com:antotu/predictor-gnn into gnn…
antotu Aug 27, 2025
4fb7112
Modified the gates accepted
antotu Aug 28, 2025
5ea1720
Modified list
antotu Aug 28, 2025
312e6ea
Fixed bug Swap and Cswap gates
antotu Sep 8, 2025
156b7e6
Edit for saving memory GPU
antotu Sep 12, 2025
77c9f5c
Added patience as variable
antotu Oct 6, 2025
1ff39e1
Updated GNN for predictions
antotu Nov 24, 2025
5a2d583
partial modification guessed by bot
antotu Nov 24, 2025
820895c
eliminated italian comments
antotu Nov 24, 2025
8b0b51f
eliminated italian comments
antotu Nov 24, 2025
de738df
eliminated redundancy torch_clamp
antotu Nov 24, 2025
794896e
removed small errors
antotu Nov 24, 2025
29761dc
solved partial errors
antotu Nov 25, 2025
3716688
Merge branch 'main' into gnn-branch
antotu Nov 25, 2025
65b409b
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 25, 2025
ef8e567
Corrected for the lint
antotu Nov 25, 2025
a734050
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Nov 25, 2025
a43dd5a
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 25, 2025
07e937e
error deprecation warning of a useless library
antotu Nov 25, 2025
1e29f6b
error deprecation warning of a useless library
antotu Nov 25, 2025
6dc9d28
small error correction
antotu Nov 25, 2025
f664616
small error correction
antotu Nov 25, 2025
f97e164
small error correction
antotu Nov 25, 2025
2e9cc1e
problem torch_geometric
antotu Nov 25, 2025
1a8b1a4
problem torch_geometric
antotu Nov 25, 2025
595469e
problem torch_geometric
antotu Nov 26, 2025
15d4814
problem torch_geometric
antotu Nov 26, 2025
ca5339e
lightweight import
antotu Nov 26, 2025
ddb6f50
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 26, 2025
a2cca5c
lightweight import
antotu Nov 26, 2025
af38ff4
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Nov 26, 2025
fc48550
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 26, 2025
92897cb
lightweight import
antotu Nov 26, 2025
f27358f
return back
antotu Nov 26, 2025
3af112a
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 26, 2025
88256c9
modified version to solve the warning of deprecation
antotu Nov 26, 2025
2cf80d1
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Nov 26, 2025
be5210b
modified version to solve the warning of deprecation
antotu Nov 26, 2025
2e28a14
Try to fix error for windows
antotu Nov 26, 2025
1e4a279
fixed some code coverage
antotu Nov 26, 2025
e9f698e
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 26, 2025
ea825ff
Consider also verbose
antotu Nov 27, 2025
e28dc60
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Nov 27, 2025
620a1d7
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 27, 2025
c258fe0
Consider also verbose
antotu Nov 27, 2025
29cf56a
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Nov 27, 2025
f412af8
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 27, 2025
3c077b1
Consider also verbose
antotu Nov 27, 2025
8b79177
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Nov 27, 2025
2a9457d
Consider adjusted estiamted hellinger distance as regression problem
antotu Nov 27, 2025
77cca31
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 27, 2025
1acc0cb
Fixed regression
antotu Nov 27, 2025
64a94ff
Fixed regression
antotu Nov 27, 2025
c4cc835
Adjusted threshold for test regression
antotu Nov 28, 2025
7acbec7
Fixed some code lines for more clarity
antotu Nov 28, 2025
6ebded4
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 28, 2025
6207f97
Merge branch 'main' into gnn-branch
antotu Nov 28, 2025
5828e7f
Modified a comment on test estimated_hellinger_distance
antotu Nov 28, 2025
a09b7dc
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Nov 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ dependencies = [
"numpy>=1.26; python_version >= '3.12'",
"numpy>=1.24; python_version >= '3.11'",
"numpy>=1.22",
"numpy>=1.22,<2; sys_platform == 'darwin' and 'x86_64' in platform_machine and python_version < '3.13'", # Restrict numpy v2 for macOS x86 since it is not supported anymore since torch v2.3.0
"optuna>=4.5.0",
"torch-geometric>=2.6.1,<2.7.0",
"torch>=2.7.1,<2.8.0; sys_platform == 'darwin' and 'x86_64' in platform_machine and python_version < '3.13'", # Restrict torch v2.3.0 for macOS x86 since it is not supported anymore.
Comment on lines +47 to +50
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Script executed:

#!/bin/bash
# Read the relevant lines from pyproject.toml
sed -n '47,50p' pyproject.toml

Repository: munich-quantum-toolkit/predictor


<shell_result>
Repository: munich-quantum-toolkit/predictor
Script execution failed with unrecoverable error: [CAPABILITY:RUN_SHELL_SCRIPT] Failed to clone repository munich-quantum-toolkit/predictor: Clone operation failed
</shell_result>


torch-geometric 2.6.1 PyTorch 2.7.x compatibility


<web_search_result>
Short answer: Not officially — torch-geometric 2.6.1 does not list PyTorch 2.7 as a supported runtime. PyG added explicit PyTorch 2.7/2.8 support in the 2.7 release; the installation docs/wheels matrix show PyTorch 2.7 support beginning with PyG 2.7.0. [1][2]

Recommendation: upgrade torch-geometric to 2.7+ when using PyTorch 2.7.x, or stick to PyTorch 2.6.x (or the PyG-supported PyTorch version shown in the 2.6.x docs) and ensure your extension wheels (torch-scatter, torch-sparse, etc.) match the PyTorch+CUDA pairing. [1][2]

Sources:

  • PyG release notes / 2.7 announcement (explicit PyTorch 2.7 support). [1]
  • PyG installation / wheels matrix (shows PyTorch 2.7 wheel targets and mapping). [2]
    </web_search_result>

torch-geometric version requirements PyTorch 2.7.1


<web_search_result>
Torch‑Geometric (PyG) supports PyTorch 2.7.x — use PyG 2.7 (torch-geometric==2.7.0) and the matching extension wheels (torch==2.7.0 in wheel filenames). Install extension wheels with the torch-2.7.0+{CUDA} index (cpu|cu118|cu126|cu128). [1][2]

Example (after installing torch==2.7.1):
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.7.0+cu128.html
pip install torch-geometric. [1][2]

Sources:
[1] PyG installation docs (compatibility / wheel patterns).
[2] PyG 2.7 release notes (PyTorch 2.7/2.8 support).
</web_search_result>


I've verified the core concern through web search. The compatibility issue is confirmed: torch-geometric 2.6.1 does not officially support PyTorch 2.7.x. According to PyG's official documentation and release notes, only torch-geometric 2.7.0 onwards provides explicit support for PyTorch 2.7/2.8.

Unfortunately, the repository clone failed, preventing me from reading the exact comment text on lines 47 and 50. However, the fundamental version mismatch issue is confirmed and requires remediation.


Update torch-geometric to 2.7.0+ for PyTorch 2.7.1 compatibility, and correct stale version references in comments.

Line 49 specifies torch-geometric>=2.6.1,<2.7.0, but this version does not officially support PyTorch 2.7.x. According to PyG's release notes and installation documentation, torch-geometric 2.7.0 is the minimum version required for PyTorch 2.7.1 compatibility. Upgrade to torch-geometric>=2.7.0,<2.8.0 to match the torch version constraint on line 50.

Additionally, comments on lines 47 and 50 should be updated to reflect the current PyTorch 2.7.1 constraint rather than any outdated references.

🤖 Prompt for AI Agents
In pyproject.toml around lines 47 to 50, the pinned torch-geometric range
(torch-geometric>=2.6.1,<2.7.0) is incompatible with the PyTorch 2.7.1
constraint; update the dependency to torch-geometric>=2.7.0,<2.8.0 and update
the adjacent comments to reflect that torch-geometric 2.7.0+ is required for
PyTorch 2.7.x compatibility (also adjust any macOS/x86 comment text to reference
PyTorch 2.7.1 where applicable).

"typing-extensions>=4.1", # for `assert_never`
]

Expand Down Expand Up @@ -118,6 +122,8 @@ xfail_strict = true
filterwarnings = [
'error',
'ignore:.*pytorch.*:UserWarning:',
"ignore:.*torch_geometric.*:UserWarning:",
"ignore:.*'type_params' parameter of 'typing\\._eval_type'.*:DeprecationWarning:",
Comment on lines +125 to +126
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Line 125: Verify torch_geometric UserWarning filter is appropriately specific.

The filter "ignore:.*torch_geometric.*:UserWarning:" remains broad and could suppress unexpected warnings. A prior review recommended narrowing it to specific known-benign messages. If there are concrete, reproducible torch_geometric UserWarnings that need suppression, please identify them and add targeted filters for each (e.g., by exact message substring) rather than a catch-all pattern.

Line 126 appears to be a new, targeted filter for a specific typing deprecation, which is appropriate.

Can you provide the specific torch_geometric UserWarning message(s) that prompted line 125? If there are reproducible warnings, I can help refine the filter to be more specific.

'ignore:.*Values in x.*:RuntimeWarning:',
'ignore:.*The least populated class in y has only 3 members, which is less than n_splits=5.*:UserWarning:',
'ignore:.*divide by zero encountered in det.*:RuntimeWarning:',
Expand All @@ -126,6 +132,7 @@ filterwarnings = [
'ignore:.*qiskit.providers.models is deprecated since Qiskit 1.2*:DeprecationWarning:',
'ignore:.*The class ``qiskit.qobj.*`` is deprecated as of Qiskit 1.3.*:DeprecationWarning:',
'ignore:.*The property ``qiskit.circuit.instruction.Instruction.*`` is deprecated as of qiskit 1.3.0.*:DeprecationWarning:',
"ignore::DeprecationWarning:torch_geometric\\.distributed.*",
]

[tool.coverage]
Expand Down Expand Up @@ -163,9 +170,13 @@ implicit_reexport = true
# recent versions of `gym` are typed, but stable-baselines3 pins a very old version of gym.
# qiskit is not yet marked as typed, but is typed mostly.
# the other libraries do not have type stubs.
module = ["qiskit.*", "joblib.*", "sklearn.*", "matplotlib.*", "gymnasium.*", "mqt.bench.*", "sb3_contrib.*", "bqskit.*", "qiskit_ibm_runtime.*", "networkx.*", "stable_baselines3.*"]
module = ["qiskit.*", "joblib.*", "sklearn.*", "matplotlib.*", "gymnasium.*", "mqt.bench.*", "sb3_contrib.*", "bqskit.*", "qiskit_ibm_runtime.*", "networkx.*", "stable_baselines3.*", "torch", "torch.*", "torch_geometric", "torch_geometric.*", "optuna.*"]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = ["mqt.predictor.ml.*"]
disallow_subclassing_any = false

[tool.ruff]
line-length = 120
extend-include = ["*.ipynb"]
Expand Down Expand Up @@ -247,6 +258,7 @@ wille = "wille"
anc = "anc"
aer = "aer"
fom = "fom"
TPE = "TPE"

[tool.repo-review]
ignore = [
Expand Down
40 changes: 40 additions & 0 deletions src/mqt/predictor/_version.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be tracked and can be removed.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
# Copyright (c) 2025 Munich Quantum Software Company GmbH
# All rights reserved.
#
# SPDX-License-Identifier: MIT
#
# Licensed under the MIT License

# file generated by setuptools-scm
# don't change, don't track in version control
from __future__ import annotations

__all__ = [
"__commit_id__",
"__version__",
"__version_tuple__",
"commit_id",
"version",
"version_tuple",
]

TYPE_CHECKING = False
if TYPE_CHECKING:
VERSION_TUPLE = tuple[int | str, ...]

Check warning

Code scanning / CodeQL

Unreachable code Warning

This statement is unreachable.
COMMIT_ID = str | None
else:
VERSION_TUPLE = object
COMMIT_ID = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
commit_id: COMMIT_ID
__commit_id__: COMMIT_ID

__version__ = version = "0.1.dev719+g5ea17201a.d20250908"
__version_tuple__ = version_tuple = (0, 1, "dev719", "g5ea17201a.d20250908")

__commit_id__ = commit_id = None
15 changes: 8 additions & 7 deletions src/mqt/predictor/hellinger/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ def calc_device_specific_features(
return np.array(list(feature_dict.values()))


def get_hellinger_model_path(device: Target) -> Path:
def get_hellinger_model_path(device: Target, *, gnn: bool = False) -> Path:
"""Returns the path to the trained model folder resulting from the machine learning training."""
training_data_path = Path(str(resources.files("mqt.predictor"))) / "ml" / "training_data"
model_path = (
training_data_path
/ "trained_model"
/ ("trained_hellinger_distance_regressor_" + device.description + ".joblib")
training_data_path = Path(str(resources.files("mqt.predictor"))) / "ml" / "training_data" / "trained_model"
device_description = str(device.description)
filename = (
("trained_hellinger_distance_regressor_gnn_" + device_description + ".pth")
if gnn
else ("trained_hellinger_distance_regressor_" + device_description + ".joblib")
)
return Path(model_path)
return training_data_path / filename
7 changes: 6 additions & 1 deletion src/mqt/predictor/ml/__init__.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to change this file. GNN should never be accessed by a user directly.

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
from mqt.predictor.ml import helper
from mqt.predictor.ml.predictor import Predictor, predict_device_for_figure_of_merit, setup_device_predictor

__all__ = ["Predictor", "helper", "predict_device_for_figure_of_merit", "setup_device_predictor"]
__all__ = [
"Predictor",
"helper",
"predict_device_for_figure_of_merit",
"setup_device_predictor",
]
Loading
Loading