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

Update example.py #178

Merged
merged 2 commits into from
Nov 15, 2024
Merged
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
12 changes: 7 additions & 5 deletions template/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@ def objective(trial: optuna.Trial) -> float:
return x**2 + y**2


# TODO: Change the variables here to test your package.
# TODO: Change package_name to test your package.
package_name = "samplers/your_sampler"
repo_owner = "Your GitHub Account Name"
ref = "Your Git Branch Name"
test_local = True

if test_local:
# This is an example of how to load a sampler from your local optunahub-registry.
sampler = optunahub.load_local_module(
package=package_name, registry_root="./package/"
package=package_name,
registry_root="./", # Path to the root of the optunahub-registry.
).YourSampler()
else:
# This is an example of how to load a sampler from your fork of the optunahub-registry.
# Please remove repo_owner and ref arguments before submitting a pull request.
sampler = optunahub.load_module(
package=package_name, repo_owner=repo_owner, ref=ref
package=package_name, repo_owner="Your GitHub Account ID", ref="Your Git Branch Name"
).YourSampler()

study = optuna.create_study(sampler=sampler)
Expand Down