Skip to content

Commit

Permalink
WIP: Fixes errors
Browse files Browse the repository at this point in the history
  • Loading branch information
y4izus committed Nov 7, 2024
1 parent ff816bf commit 4d1ed6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion qiskit_ibm_transpiler/ai/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ def __init__(
)
elif backend:
self.backend = backend
elif backend_name:
elif backend_name and local_mode:
try:
runtime_service = QiskitRuntimeService()
self.backend = runtime_service.backend(name=backend_name)
except Exception:
raise PermissionError(f"ERROR. Backend not supported ({backend_name})")
else:
self.backend_name = backend_name

self.optimization_level = optimization_level
self.optimization_preferences = optimization_preferences
Expand Down
8 changes: 4 additions & 4 deletions qiskit_ibm_transpiler/ai/synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ def __init__(
)

if isinstance(coupling_map, CouplingMap):
self.coupling_map = list(coupling_map.get_edges())
else:
self.coupling_map = coupling_map
else:
self.coupling_map = CouplingMap(couplinglist=coupling_map)

if backend:
self.backend = backend
Expand Down Expand Up @@ -116,8 +116,8 @@ def synth_nodes(self, nodes):
synths = self.synth_service.transpile(
synth_inputs,
qargs=qargs,
coupling_map=self.coupling_map,
backend=self.backend,
coupling_map=getattr(self, "coupling_map", None),
backend=getattr(self, "backend", None),
)
except TranspilerError as e:
logger.warning(
Expand Down

0 comments on commit 4d1ed6a

Please sign in to comment.