Skip to content
Open
Show file tree
Hide file tree
Changes from 172 commits
Commits
Show all changes
190 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
fa7c1f7
Minor fixes
Dec 8, 2025
fa75639
Minor fixes
Dec 8, 2025
cfb74ed
Merge branch 'main' into gnn-branch
antotu Dec 8, 2025
a11f7ea
Minor fixes
Dec 8, 2025
1bd824e
Minor fixes
Dec 8, 2025
f3d7c55
Minor fixes
Dec 8, 2025
0992bd0
Minor fixes
Dec 8, 2025
2e08905
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 8, 2025
84165a2
Minor fixes
Dec 8, 2025
a67b92b
Minor fixes
Dec 8, 2025
909ce80
Minor fixes found
Dec 9, 2025
1246856
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 9, 2025
f3ac221
Minor fixes found
Dec 9, 2025
77f4889
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
Dec 9, 2025
0558921
Minor fixes found: error in predicting hellinger distance
Dec 9, 2025
462e57c
Minor fixes found: error in predicting hellinger distance
Dec 9, 2025
a6ada4d
Minor fixes found: error in predicting hellinger distance
Dec 9, 2025
81d05af
Minor modifications
Dec 9, 2025
26fcc32
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 9, 2025
41f3dc8
Minor modifications
Dec 9, 2025
ecd5981
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
Dec 9, 2025
98cc955
Minor modifications
Dec 9, 2025
f3d17ce
Minor modifications
Dec 9, 2025
678f408
Minor modifications
Dec 9, 2025
c903056
Minor fixes code and change of libraries
Dec 10, 2025
128fcb6
Minor fixes code and change of libraries
Dec 10, 2025
2652119
Reduced ignore on warning, modified doc, and minor fixes
Dec 10, 2025
df44c8c
Modified documentation
Dec 10, 2025
92e93ea
Modified documentation
Dec 10, 2025
50b7a66
Modified documentation
Dec 10, 2025
cdaa495
Modified taking into account to not use .pt for saving dataset
Dec 10, 2025
3f8ed63
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 10, 2025
cdd19f5
Modified not using pt for getting the dataset
Dec 10, 2025
5816e2a
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
Dec 10, 2025
7a3999a
Modified not using pt for getting the dataset
Dec 10, 2025
3884aa4
Fixes for code rabbit AI
Dec 10, 2025
99ad6e4
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 10, 2025
a5fd1c9
Minor fixes
Dec 10, 2025
e3050f1
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
Dec 10, 2025
e8c50b7
Minor fixes
Dec 10, 2025
b23cee5
Minor fixes
Dec 10, 2025
cb03412
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 10, 2025
d072b42
Minor fixes
Dec 10, 2025
b1ad8d3
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
Dec 10, 2025
a4e2671
Minor fixes
Dec 10, 2025
553bfb7
Minor fixes
Dec 11, 2025
9b2f606
Minor fixes
Dec 11, 2025
a862524
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 11, 2025
b6d2d79
Modified documentation
Dec 12, 2025
2fee799
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 12, 2025
9eb4fb8
Modified documentation
Dec 12, 2025
faead05
Modified tests
Dec 12, 2025
811246a
Modified tests
Dec 12, 2025
e741287
Modified tests
Dec 12, 2025
97f8045
Minor modifications
Dec 16, 2025
f7caeef
Merge branch 'main' into gnn-branch
antotu Dec 16, 2025
221079f
Minor modifications
Dec 16, 2025
be7bd7f
🎨 pre-commit fixes
pre-commit-ci[bot] Dec 16, 2025
f3b79b6
Minor modifications
Dec 16, 2025
175be24
Minor modifications
Dec 16, 2025
79eb7c4
Verbose regression added for code coverage
Jan 7, 2026
1f2bf74
Merge branch 'main' into gnn-branch
antotu Jan 7, 2026
1a6867a
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 7, 2026
504df03
Verbose regression added for code coverage
Jan 7, 2026
98c8fd5
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
Jan 7, 2026
cf26b7c
Added multi-class classification
Jan 7, 2026
38a7c97
Test empty circuit DAG
Jan 7, 2026
d440d16
Fixed minor issue
Jan 7, 2026
365a4d9
Fixed minor issue
Jan 7, 2026
f426453
Minor fixes
Jan 8, 2026
846e100
Merge branch 'main' into gnn-branch
antotu Jan 19, 2026
d144231
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 19, 2026
4f74faf
Minor fixes
antotu Jan 19, 2026
a3aef8a
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Jan 19, 2026
7c3cd17
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 19, 2026
560fbfb
minor fixes
antotu Jan 19, 2026
c0a6c35
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Jan 19, 2026
1d758e6
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 19, 2026
c0f4846
Minor fixes
antotu Jan 19, 2026
53054c9
Merge branch 'gnn-branch' of https://github.com/antotu/predictor-gnn …
antotu Jan 19, 2026
035210e
Minor fixes
antotu Jan 19, 2026
80a999b
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 19, 2026
ac19300
Merge branch 'main' into gnn-branch
antotu Jan 20, 2026
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
15 changes: 14 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",
"optuna>=4.0.0",
"torch-geometric>=2.7.0,<2.8.0",
"torch>=2.7.0,<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.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update stale comment about torch version.

The comment states "Restrict torch v2.3.0 for macOS x86" but the actual constraint is torch>=2.7.0,<2.8.0. The comment should reflect the current version to avoid confusion.

Apply this diff to correct the comment:

-    "torch>=2.7.0,<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.
+    "torch>=2.7.0,<2.8.0; sys_platform == 'darwin' and 'x86_64' in platform_machine and python_version < '3.13'",  # Restrict torch to 2.7.x for macOS x86 since 2.8.0+ is not supported on this platform.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"torch>=2.7.0,<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.
"torch>=2.7.0,<2.8.0; sys_platform == 'darwin' and 'x86_64' in platform_machine and python_version < '3.13'", # Restrict torch to 2.7.x for macOS x86 since 2.8.0+ is not supported on this platform.
🤖 Prompt for AI Agents
In pyproject.toml around line 49, the inline comment incorrectly references
"Restrict torch v2.3.0 for macOS x86" while the actual constraint is
torch>=2.7.0,<2.8.0; update the comment to accurately reflect the current
constraint (e.g., "Restrict torch >=2.7.0,<2.8.0 for macOS x86 since older
versions are not supported") so the comment and the version specifier match.

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

Expand Down Expand Up @@ -116,6 +120,8 @@ log_level = "INFO"
filterwarnings = [
'error',
'ignore:.*pytorch.*:UserWarning:',
"ignore:`torch_geometric.distributed` has been deprecated:DeprecationWarning:torch_geometric",
"ignore:.*'type_params' parameter of 'typing\\._eval_type'.*:DeprecationWarning:",
'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 Down Expand Up @@ -162,9 +168,15 @@ 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.*", "safetensors", "safetensors.torch", "safetensors.*" ]
ignore_missing_imports = true

# Relax type checking for the GNN module since torch and torch_geometric expose
# many APIs as Any due to incomplete type stubs; the GNN implementation must
# work with these untyped returns and may need to subclass Any-typed classes.
[[tool.mypy.overrides]]
module = ["mqt.predictor.ml.gnn"]
disallow_subclassing_any = false

[tool.ruff]
line-length = 120
Expand Down Expand Up @@ -252,6 +264,7 @@ wille = "wille"
anc = "anc"
aer = "aer"
fom = "fom"
TPE = "TPE"


[tool.repo-review]
Expand Down
39 changes: 39 additions & 0 deletions src/mqt/predictor/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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

__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.
Copy link
Author

Choose a reason for hiding this comment

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

Done by pre-commit

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.dev957+g1f2bf74aa.d20260107"
__version_tuple__ = version_tuple = (0, 1, "dev957", "g1f2bf74aa.d20260107")

__commit_id__ = commit_id = None
17 changes: 9 additions & 8 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:
"""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")
def get_hellinger_model_path(device: Target, gnn: bool = False) -> Path:
"""Returns the path to the trained model file resulting from the machine learning training."""
training_data_path = Path(str(resources.files("mqt.predictor"))) / "ml" / "training_data" / "trained_model"
device_description = str(device.description)
filename = (
(f"trained_hellinger_distance_regressor_gnn_{device_description}.pth")
if gnn
else (f"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
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