QMapDataset demo - #1825
Conversation
|
👋 Hey, looks like you've updated some demos! 🐘 Don't forget to update the Please hide this comment once the field(s) are updated. Thanks! |
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
| from scipy.optimize import linear_sum_assignment | ||
|
|
||
| class QubitMapping_dot_Model(nn.Module): |
There was a problem hiding this comment.
The method make_edge_mlp has not been defined. Is this how you want it to work? Please insert your actual code here.
| from scipy.optimize import linear_sum_assignment | |
| class QubitMapping_dot_Model(nn.Module): | |
| from scipy.optimize import linear_sum_assignment | |
| def make_edge_mlp(edge_dim, out_dim, hidden=32): | |
| return nn.Sequential(nn.Linear(edge_dim, hidden), nn.ReLU(), | |
| nn.Linear(hidden, out_dim)) | |
| class QubitMapping_dot_Model(nn.Module): |
| # | ||
|
|
||
| def train_loop(model, optimizer, loss_fn, loader_train, loader_valid, n_epoch, device): | ||
| """ |
There was a problem hiding this comment.
The training and test data are not defined. You may need to adjust the format of the data.
| # | |
| def train_loop(model, optimizer, loss_fn, loader_train, loader_valid, n_epoch, device): | |
| """ | |
| # | |
| train_size, test_size = 0.8, 0.2 | |
| n = len(ds.circuits) | |
| train_idx, val_idx = random_split(range(n), [train_size, test_size]) | |
| def train_loop(model, optimizer, loss_fn, loader_train, loader_valid, n_epoch, device): | |
| """ |
| # and variance) of gradients. | ||
| # | ||
|
|
||
| optimizer = torch.optim.Adam(model.parameters(), lr=1e-3, weight_decay=1e-5) |
There was a problem hiding this comment.
You'll need to define this before you call it.
Your preview is ready 🎉!You can view your changes here
|
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
|
|
||
| def make_edge_mlp(in_dim, out_dim, hid_dim=32): | ||
| """ | ||
| Create a small multilayer perceptron (MLP) used to process edge features. |
There was a problem hiding this comment.
This documentation might be excessive for a simple code snippet, and is incongruous with the other methods in this code block.
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Co-authored-by: drdren <104710745+drdren@users.noreply.github.com>
Title: Solving the qubit mapping problem with machine learning
Summary: The demo introduces the qubit mapping problem, an NP-hard challenge in quantum computing systems with limited hardware connectivity, and explores machine learning-based approaches for solving it. It presents the QMapDataset available in PennyLane and shows how it can be used to train a Graph Neural Network to tackle the qubit mapping problem.
Relevant references:
Possible Drawbacks:
Related GitHub Issues:
If you are writing a demonstration, please answer these questions to facilitate the marketing process.
QMapDataset has been available in PennyLane since March 2026. The goal of this demo is to explain how to access QMapDataset in PennyLane and to show an example of how to use it for solving qubit mapping using machine learning approaches.
Quantum scientists specializing in quantum compilation and/or the use of machine learning to improve quantum computing.
KEYWORDS — What words should be included in the marketing post?
machine learning, quantum compilation, AI for Quantum
Which of the following types of documentation is most similar to your file?
(more details here)
[ ] Demo