Skip to content

Commit 8ebd160

Browse files
authored
[Upgrade] Updating to latest versions of Pulser and Emu-MPS. (#120)
This will bring in a number of bugfixes.
1 parent 216d3a5 commit 8ebd160

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "quantum-evolution-kernel"
77
description = "A Python library designed for the machine learning community to help users design quantum-driven similarity metrics for graphs and to use them inside kernel-based machine learning algorithms for graph data.ide the right environment to explore new ideas - both in terms of methodologies and data domain - while always interacting with a simple and intuitive QPU interface."
88
readme = "README.md"
9-
version = "0.3.2"
9+
version = "0.3.3"
1010
requires-python = ">=3.10,<3.13"
1111
license = { text = "MIT-derived" }
1212
keywords = ["quantum"]
@@ -31,13 +31,13 @@ classifiers = [
3131
dependencies = [
3232
"networkx",
3333
"numpy",
34-
"pulser==1.1.1",
34+
"pulser==1.5.3",
3535
"rdkit",
3636
"scikit-learn",
3737
"torch",
3838
"torch_geometric",
3939
"matplotlib",
40-
"emu-mps~=1.2.0",
40+
"emu-mps~=2.2.0",
4141
"pasqal-cloud",
4242
]
4343

qek/data/extractors.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import itertools
1010
import json
1111
import logging
12-
from math import ceil
1312
from uuid import UUID
1413
import time
1514
from typing import Any, Callable, Generator, Generic, Sequence, TypeVar, cast
@@ -498,7 +497,6 @@ def run(self, max_qubits: int = 10, dt: int = 10) -> BaseExtracted:
498497
logger.warning("No sequences to run, did you forget to call compile()?")
499498
return SyncExtracted(raw_data=[], targets=[], sequences=[], states=[])
500499

501-
backend = emu_mps.MPSBackend()
502500
raw_data = []
503501
targets: list[int] = []
504502
sequences = []
@@ -516,12 +514,12 @@ def run(self, max_qubits: int = 10, dt: int = 10) -> BaseExtracted:
516514
logger.debug("Executing compiled graph # %s", id)
517515

518516
# Configure observable.
519-
cutoff_duration = int(ceil(compiled.sequence.get_duration() / dt) * dt)
520-
observable = emu_mps.BitStrings(evaluation_times={cutoff_duration})
517+
observable = emu_mps.BitStrings(evaluation_times=[1.0])
521518
config = emu_mps.MPSConfig(observables=[observable], dt=dt)
522-
counter: dict[str, Any] = backend.run(compiled.sequence, config)[observable.name][
523-
cutoff_duration
524-
]
519+
520+
# And run.
521+
backend = emu_mps.MPSBackend(sequence=compiled.sequence, config=config)
522+
counter: dict[str, Any] = backend.run().get_result(observable=observable, time=1.0)
525523
logger.debug("Execution of compiled graph # %s complete", id)
526524
raw_data.append(compiled.graph)
527525
if compiled.graph.target is not None:

qek/target/backends.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import abc
66
import asyncio
7-
from math import ceil
87
from typing import Counter, cast
98

109
import os
@@ -244,11 +243,10 @@ async def run(
244243
self, register: targets.Register, pulse: targets.Pulse, dt: int = 10
245244
) -> Counter[str]:
246245
sequence = self._make_sequence(register=register, pulse=pulse)
247-
backend = emu_mps.MPSBackend()
248246

249247
# Configure observable.
250-
cutoff_duration = int(ceil(sequence.get_duration() / dt) * dt)
251-
observable = emu_mps.BitStrings(evaluation_times={cutoff_duration})
248+
observable = emu_mps.BitStrings(evaluation_times=[1.0])
252249
config = emu_mps.MPSConfig(observables=[observable], dt=dt)
253-
counter: Counter[str] = backend.run(sequence, config)[observable.name][cutoff_duration]
250+
backend = emu_mps.MPSBackend(sequence=sequence, config=config)
251+
counter: Counter[str] = backend.run().get_result(observable=observable, time=1.0)
254252
return counter

0 commit comments

Comments
 (0)