pip install numpy scipy openfermion huggingface_hub
python - <<'PY'
from huggingface_hub import hf_hub_download
import json
p = hf_hub_download("FINAL-Bench/oqc-data","qsim/systems.json",repo_type="dataset")
sysd = json.load(open(p))["systems"]
from openfermion import fermi_hubbard, get_sparse_operator
import scipy.sparse.linalg as sla
pred = {}
for sid, s in sysd.items():
x, y = s["lattice"]
H = fermi_hubbard(x, y, tunneling=s["t"], coulomb=s["U_over_t"]*s["t"], periodic=False)
pred[sid] = float(sla.eigsh(get_sparse_operator(H), k=1, which="SA", return_eigenvectors=False)[0])
json.dump(pred, open("my_qsim.json","w")) # paste my_qsim.json into the Submit box
print(pred)
PY
pip install numpy stim pymatching huggingface_hub
python - <<'PY'
from huggingface_hub import hf_hub_download
import numpy as np, stim, pymatching, json
det = np.load(hf_hub_download("FINAL-Bench/oqc-data","qec/detectors.npy",repo_type="dataset"))
dem = stim.DetectorErrorModel(open(hf_hub_download("FINAL-Bench/oqc-data","qec/dem.txt",repo_type="dataset")).read())
m = pymatching.Matching.from_detector_error_model(dem)
bits = m.decode_batch(det)[:,0].astype(int)
pred = {"shot_%05d"%i: int(bits[i]) for i in range(det.shape[0])}
json.dump(pred, open("my_qec.json","w")) # paste my_qec.json into the Submit box
print("items", len(pred))
PY