Skip to content

Commit

Permalink
minor changes to dockerhub.yml and rem tpnm prioritization
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeisel committed Sep 30, 2022
1 parent d868947 commit d5f9a07
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Push docker images to Dockerhub

on:
push:
branches: main
branches: master
tags:
- "v*.*.*"

Expand All @@ -26,15 +26,15 @@ jobs:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push latest of error mitigation service
if: ${{ steps.vars.outputs.tag == 'main' }}
if: ${{ steps.vars.outputs.tag == 'master' }}
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: planqk/error-mitigation-service:latest

- name: Build and push version of error-mitigation-service
if: ${{ steps.vars.outputs.tag != 'main' }}
if: ${{ steps.vars.outputs.tag != 'master' }}
uses: docker/build-push-action@v2
with:
context: .
Expand Down
Binary file modified README.md
Binary file not shown.
6 changes: 3 additions & 3 deletions app/model/rem_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ def __init__(
):
self.qpu = qpu
self.qubits = qubits
self.cm_gen_method = cm_gen_method
self.mitigation_method = mitigation_method
self.cm_gen_method = cm_gen_method.lower() if provider else provider
self.mitigation_method = mitigation_method.lower()
self.max_age = max_age
self.time_of_execution = time_of_execution
self.counts = counts
self.provider = provider
self.provider = provider.lower() if provider else provider
self.shots = shots
self.credentials = credentials
self.noise_model = noise_model
Expand Down
7 changes: 6 additions & 1 deletion app/services/mitigator_gen_services/mmgen_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ def mitigation_generator(method):

def generate_mm(request: MMGenRequest):
mitigation_method = request.mitigation_method
if mitigation_method == "tpnm":

# prioritize sparse tpnm over standard tpnm
if mitigation_method == "tpnm" or (
mitigation_method in ["inversion", "matrixinversion"]
and request.cm_gen_method == "tpnm"
):
return generate_mm_from_skratch(request)
elif mitigation_method == "mthree":
return generate_mthree_mitigator(request)
Expand Down
8 changes: 6 additions & 2 deletions app/services/rem_services/rem_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


def application_generator(method):
if method in ["inversion", "tpnm", "ctmp"]:
if method in ["inversion", "tpnm", "ctmp", "matrixinversion"]:
return MatrixMultiplication()
if method == "mthree":
return MthreeApplication()
Expand All @@ -42,7 +42,11 @@ def perform_mitigation(counts, qubits, metadata, application_method, mitigator):


def mitigate_results(request: REMRequest):
request.provider = request.provider.lower()
if request.cm_gen_method == "tpnm" and request.mitigation_method in [
"inversion",
"matrixinversion",
]:
request.mitigation_method = "tpnm"
application_method = application_generator(request.mitigation_method)

if isinstance(request.qubits[0], int):
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Config:
API_TITLE = "Readout Error Mitigation Service API"
API_VERSION = "0.1"
OPENAPI_VERSION = "3.0.2"
OPENAPI_URL_PREFIX = "/app"
OPENAPI_URL_PREFIX = "/api"
OPENAPI_SWAGGER_UI_PATH = "/swagger-ui"
OPENAPI_SWAGGER_UI_VERSION = "3.24.2"
OPENAPI_SWAGGER_UI_URL = "https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.24.2/"
Expand Down

0 comments on commit d5f9a07

Please sign in to comment.