Skip to content

Set simulator appropriately in gst.run(...) when checkpointing is used #551

@rileyjmurray

Description

@rileyjmurray

If checkpointing is used in GST then we read the initial model at this code block:

pyGSTi/pygsti/protocols/gst.py

Lines 1380 to 1395 in c74fcb2

elif isinstance(checkpoint, GateSetTomographyCheckpoint):
# if the checkpoint's last completed iteration is non-negative
# (i.e. the checkpoint actually has data in it)
if checkpoint.last_completed_iter >= 0:
seed_model = checkpoint.mdl_list[-1]
# otherwise seed with target
else:
seed_model = mdl_start.copy()
mdl_lsgst_list = checkpoint.mdl_list
final_objfn = checkpoint.final_objfn
# final_objfn initialized to None in the GateSetTomographyCheckpoint and will be overwritten
# during the loop below unless the last completed iteration is the final iteration
# in which case the loop should be skipped. If so I think it is ok that this gets
# left set to None. There looks to be some logic for handling this and it looks
# like the serialization routines effectively do this already, as the value
# of this is lost between writing and reading.

At no point in this block do we set seed_model.sim according to the "simulator" keyword argument. We should update to add

                if simulator is not None:
                    seed_model.sim = simulator

after seed_model is defined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions