update: add round_id for resume

This commit is contained in:
stellahsr 2023-10-12 17:28:16 +08:00
parent 8a7d96d507
commit 0b757d0b47

View file

@ -497,6 +497,9 @@ class MinecraftPlayer(SoftwareCompany):
"wait_ticks": 20,
}
)
with open(f"{CKPT_DIR}/curriculum/round_id.json", "r") as f:
round_id = json.load(f)["last_round_id"]
else:
# clear the inventory
self.game_memory.mf_instance.reset(
@ -520,7 +523,10 @@ class MinecraftPlayer(SoftwareCompany):
round_id += 1
# add new task into env and continue
# fixme: update self.task
self.start(task=self.task, round=round_id)
with open(f"{CKPT_DIR}/curriculum/round_id.json", "w") as f:
json.dump({"last_round_id": round_id}, f)
self.start(task=self.task, round=round_id)
logger.info(f"{n_round=}")
self._check_balance()