Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename load to load_module #9

Merged
merged 2 commits into from
May 15, 2024
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: 1 addition & 1 deletion package/samplers/demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def objective(trial: optuna.Trial) -> float:


if __name__ == "__main__":
module = optunahub.load("samplers/demo")
module = optunahub.load_module("samplers/demo")
sampler = module.DemoSampler(seed=42)
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=5)
Expand Down
2 changes: 1 addition & 1 deletion package/samplers/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ from optuna.trial import FrozenTrial


class UserDefinedSampler(
optunahub.load("sampler/simple").SimpleSampler
optunahub.load_module("sampler/simple").SimpleSampler
):
def __init__(self, search_space: dict[str, BaseDistribution]) -> None:
super().__init__(search_space)
Expand Down
2 changes: 1 addition & 1 deletion package/samplers/simulated_annealing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def objective(trial: optuna.Trial) -> float:


if __name__ == "__main__":
mod = optunahub.load("sampler/simulated_annealing")
mod = optunahub.load_module("sampler/simulated_annealing")

sampler = mod.SimulatedAnnealingSampler()
study = optuna.create_study(sampler=sampler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def objective(trial):


if __name__ == "__main__":
mod = optunahub.load("visualization/plot_hypervolume_history_with_rp")
mod = optunahub.load_module("visualization/plot_hypervolume_history_with_rp")

study = optuna.create_study(directions=["minimize", "minimize"])
study.optimize(objective, n_trials=50)
Expand Down
4 changes: 2 additions & 2 deletions recipes/001_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
###################################################################################################
# Next, define your own sampler class by inheriting `SimpleSampler` class.
# In this example, we implement a sampler that always returns a random value.
# The `SimpleSampler` class can be loaded using `optunahub.load` function.
# The `SimpleSampler` class can be loaded using `optunahub.load_module` function.
# The `force_load` argument is set to `True` to force loading the sampler without caching and consent to use stats.

SimpleSampler = optunahub.load(
SimpleSampler = optunahub.load_module(
"samplers/simple",
auth=Auth.Token(os.environ["SECRET_GITHUB_TOKEN"]),
).SimpleSampler
Expand Down
Loading