Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GST checkpointing misses the final chi-squared iteration #550

Open
rileyjmurray opened this issue Mar 6, 2025 · 0 comments
Open

GST checkpointing misses the final chi-squared iteration #550

rileyjmurray opened this issue Mar 6, 2025 · 0 comments
Milestone

Comments

@rileyjmurray
Copy link
Contributor

This code block manages checkpointing for the GateSetTomography class:

pyGSTi/pygsti/protocols/gst.py

Lines 1417 to 1436 in 962216e

#Now loop through the generator and query the intermediate results:
#Do all but the last circuit list.
for i in range(starting_idx, len(bulk_circuit_lists)):
#then do the final iteration slightly differently since the generator should
#give three return values.
if i==len(bulk_circuit_lists)-1:
mdl_iter, opt_iter, final_objfn = next(gst_iter_generator)
else:
mdl_iter, opt_iter = next(gst_iter_generator)
mdl_lsgst_list.append(mdl_iter)
optima_list.append(opt_iter)
if not disable_checkpointing:
# update the checkpoint along the way:
checkpoint.mdl_list = mdl_lsgst_list
checkpoint.last_completed_iter += 1
checkpoint.last_completed_circuit_list = bulk_circuit_lists[i]
# write the updated checkpoint to disk:
if resource_alloc.comm_rank == 0:
checkpoint.write(f'{checkpoint_path}_iteration_{i}.json')

Note how there's only only one checkpoint for each value of i. This is actually problematic under usual conditions, wherei == len(bulk_circuit_lists)-1 results in two calls to pygsti's optimizer: one call for a chi-squared objective and one call for log-likelihood.

We should change this code so we checkpoint the final GST chi-squared iteration as soon as it's complete (i.e., before the log-likelihood optimization step begins).

@sserita sserita added this to the 0.9.14 milestone Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants