Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rbms/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def save_model(
num_updates: int,
time: float,
learning_rate: Tensor,
effective_time: np.ndarray,
flags: list[str] = [],
) -> None:
"""Save the current state of the model.
Expand Down Expand Up @@ -48,6 +49,7 @@ def save_model(
checkpoint["numpy_rng_arg3"] = np.random.get_state()[3]
checkpoint["numpy_rng_arg4"] = np.random.get_state()[4]
checkpoint["time"] = time
checkpoint["effective_time"] = effective_time
checkpoint["learning_rate"] = learning_rate.cpu().numpy()
# Update the parallel chains to resume training
if "parallel_chains" in f.keys():
Expand Down
6 changes: 3 additions & 3 deletions rbms/training/pcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def train(
pbar.set_description(f"Training {params.name}")

start = time.perf_counter()

effective_time = np.zeros(len(optimizer))
for idx in range(curr_update + 1, num_updates + 1):
batch = train_dataset.batch(batch_size)
data, weights = batch["data"], batch["weights"]
Expand Down Expand Up @@ -69,7 +69,8 @@ def train(

params.post_grad_update()
sampler.post_grad_update(params=params)

learning_rates = np.asarray([opt.param_groups[0]["lr"] for opt in optimizer])
effective_time += learning_rates
# Get flags for save
flags = []
flags = params.save_flags(flags)
Expand All @@ -81,7 +82,6 @@ def train(
names_params = (
list(params.named_parameters().keys()) if len(optimizer) > 1 else ["all"]
)
learning_rates = np.asarray([opt.param_groups[0]["lr"] for opt in optimizer])

metrics = {}
metrics = sampler.get_metrics_display(
Expand Down
Loading