Skip to content

Commit

Permalink
Another fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mseeger committed Dec 8, 2022
1 parent 6f65513 commit c44ccae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chapter_hyperparameter_optimization/sh-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def suggest(self):
# Number of configurations for the first rung:
n0 = int(self.prefact * self.eta ** self.K)
for _ in range(n0):
config = searcher.sample_configuration()
config = self.searcher.sample_configuration()
config["max_epochs"] = self.r_min # Set r = r_min
self.queue.append(config)
# Return an element from the queue
Expand Down
6 changes: 3 additions & 3 deletions d2l/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2735,7 +2735,7 @@ def suggest(self):
# Number of configurations for the first rung:
n0 = int(self.prefact * self.eta ** self.K)
for _ in range(n0):
config = searcher.sample_configuration()
config = self.searcher.sample_configuration()
config["max_epochs"] = self.r_min # Set r = r_min
self.queue.append(config)
# Return an element from the queue
Expand Down Expand Up @@ -2784,7 +2784,7 @@ def __init__(self, searcher, eta, r_min, r_max):
self.save_hyperparameters()
self.s_max = int(np.ceil((np.log(r_max) - np.log(r_min)) / np.log(eta)))
self.s = self.s_max
self.successive_halving = SuccessiveHalvingScheduler(
self.successive_halving = d2l.SuccessiveHalvingScheduler(
searcher=self.searcher,
eta=self.eta,
r_min=self.r_min,
Expand All @@ -2806,7 +2806,7 @@ def update(self, config: dict, error: float, info=None):
self.s -= 1
if self.s < 0:
self.s = self.s_max
self.successive_halving = SuccessiveHalvingScheduler(
self.successive_halving = d2l.SuccessiveHalvingScheduler(
searcher=self.searcher,
eta=self.eta,
r_min=int(self.r_max * self.eta ** (-self.s)),
Expand Down

0 comments on commit c44ccae

Please sign in to comment.