mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
fix: refine details (#979)
* feat: add parquet preview and extract common DataFrame preview logic * refactor: improve error messages, prompts, regex, and session loading * lint
This commit is contained in:
@@ -250,7 +250,11 @@ class LoopBase:
|
||||
current_step = self.step_idx[li]
|
||||
self.pbar.n = current_step
|
||||
next_step = self.step_idx[li] % len(self.steps)
|
||||
self.pbar.set_postfix(loop_index=li, step_index=next_step, step_name=self.steps[next_step])
|
||||
self.pbar.set_postfix(
|
||||
loop_index=li + next_step_idx // len(self.steps),
|
||||
step_index=next_step,
|
||||
step_name=self.steps[next_step],
|
||||
)
|
||||
self._check_exit_conditions_on_step()
|
||||
else:
|
||||
logger.warning(f"Step forward {si} of loop {li} is skipped.")
|
||||
@@ -411,6 +415,18 @@ class LoopBase:
|
||||
An instance of LoopBase with the loaded session.
|
||||
"""
|
||||
path = Path(path)
|
||||
# if the path is a directory, load the latest session
|
||||
if path.is_dir():
|
||||
if path.name != "__session__":
|
||||
path = path / "__session__"
|
||||
|
||||
if not path.exists():
|
||||
raise FileNotFoundError(f"No session file found in {path}")
|
||||
|
||||
# iterate the dump steps in increasing order
|
||||
files = sorted(path.glob("*/*_*"), key=lambda f: (int(f.parent.name), int(f.name.split("_")[0])))
|
||||
path = files[-1]
|
||||
logger.info(f"Loading latest session from {path}")
|
||||
with path.open("rb") as f:
|
||||
session = cast(LoopBase, pickle.load(f))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user