Skip to content

Commit b548422

Browse files
Nikia RudinNikita Rudin
authored andcommitted
fixes to runner
1 parent ff9e971 commit b548422

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rsl_rl/runners/on_policy_runner.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ def learn(self, num_learning_iterations, init_at_random_ep_len=False):
137137
if it % self.save_interval == 0:
138138
self.save(os.path.join(self.log_dir, 'model_{}.pt'.format(it)))
139139
ep_infos.clear()
140-
self.current_learning_iteration = num_learning_iterations
141-
self.save(os.path.join(self.log_dir, 'model_{}.pt'.format(num_learning_iterations)))
140+
141+
self.current_learning_iteration += num_learning_iterations
142+
self.save(os.path.join(self.log_dir, 'model_{}.pt'.format(self.current_learning_iteration)))
142143

143144
def log(self, locs, width=80, pad=35):
144145
self.tot_timesteps += self.num_steps_per_env * self.env.num_envs
@@ -175,7 +176,7 @@ def log(self, locs, width=80, pad=35):
175176
self.writer.add_scalar('Train/mean_reward/time', statistics.mean(locs['rewbuffer']), self.tot_time)
176177
self.writer.add_scalar('Train/mean_episode_length/time', statistics.mean(locs['lenbuffer']), self.tot_time)
177178

178-
str = f" \033[1m Learning iteration {locs['it']}/{locs['num_learning_iterations']} \033[0m "
179+
str = f" \033[1m Learning iteration {locs['it']}/{self.current_learning_iteration + locs['num_learning_iterations']} \033[0m "
179180

180181
if len(locs['rewbuffer']) > 0:
181182
log_string = (f"""{'#' * width}\n"""

0 commit comments

Comments
 (0)