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

Fix randint ValueError in windows #711

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

hrntsm
Copy link
Collaborator

@hrntsm hrntsm commented Nov 26, 2023

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

Reference Issues/PRs

What does this implement/fix? Explain your changes.

When I run PreferentialOptimization in a windows environment, I get the following error in the randint function.

Traceback (most recent call last):
  File "c:\Users\hrntsm\Desktop\potest\main.py", line 60, in <module>
    main()
  File "c:\Users\hrntsm\Desktop\potest\main.py", line 27, in main
    sampler=PreferentialGPSampler(),
  File "C:\Users\hrntsm\Desktop\potest\.venv\lib\site-packages\optuna_dashboard\preferential\samplers\gp.py", line 320, in __init__
    seed=self._rng.randint(2**32)
  File "numpy\\random\\mtrand.pyx", line 779, in numpy.random.mtrand.RandomState.randint
  File "numpy\\random\\_bounded_integers.pyx", line 2881, in numpy.random._bounded_integers._rand_int32
ValueError: high is out of bounds for int32

Fix this error by specifying the dtype explicitly.

env

  • windows11
  • python3.9
  • optuna3.3.0
  • optuna-dashboard0.13.0

@hrntsm hrntsm marked this pull request as ready for review November 26, 2023 08:48
Copy link

codecov bot commented Nov 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a801b89) 63.77% compared to head (bf7c930) 63.77%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #711   +/-   ##
=======================================
  Coverage   63.77%   63.77%           
=======================================
  Files          35       35           
  Lines        2280     2280           
=======================================
  Hits         1454     1454           
  Misses        826      826           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@not522 not522 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing it out, LGTM!

@not522 not522 merged commit 39c5e7e into optuna:main Nov 27, 2023
13 checks passed
@hrntsm hrntsm deleted the fix-out-of-bounds-in-randint branch November 27, 2023 11:17
@c-bata c-bata mentioned this pull request Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants