question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

suggest_discrete_uniform error "unsupported operand type(s) for *: 'int' and 'NoneType'"

See original GitHub issue

Conditions

  • Optuna version: 0.14.0

  • Python version: 3.6.8

  • OS: Google Colab

  • Machine Learning library to be optimized: TensorFlow 2.0.0-beta1

Code to reproduce

The error started during a study run on Google Colab. I don’t have a min repro but can share the model sqlite DB and model code if needed.

Error messages, stack traces, or logs

[W 2019-08-05 19:12:03,795] Setting status of trial#27 as TrialState.FAIL because of the following error: TypeError("unsupported operand type(s) for *: 'int' and 'NoneType'",)
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/optuna/study.py", line 469, in _run_trial
    result = func(trial)
  File "<ipython-input-42-176311fa1b08>", line 33, in objective
    model = make_trial_model(trial, input_shape)
  File "<ipython-input-17-3a5c1667bd48>", line 37, in make_trial_model
    embedding_size = trial.suggest_discrete_uniform('embedding_size', 100, 300, 50)
  File "/usr/local/lib/python3.6/dist-packages/optuna/trial.py", line 268, in suggest_discrete_uniform
    return self._suggest(name, distribution)
  File "/usr/local/lib/python3.6/dist-packages/optuna/trial.py", line 455, in _suggest
    study, trial, name, distribution)
  File "/usr/local/lib/python3.6/dist-packages/optuna/samplers/tpe/sampler.py", line 94, in sample_independent
    values, scores = _get_observation_pairs(study, param_name)
  File "/usr/local/lib/python3.6/dist-packages/optuna/samplers/tpe/sampler.py", line 523, in _get_observation_pairs
    score = (-step, sign * intermediate_value)
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jbgh2commented, Aug 17, 2019

I’ve run several studies with 0.14.0 using new DBs and I haven’t seen the problem again.

0reactions
jbgh2commented, Aug 12, 2019

Will do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Error: unsupported operand type(s) for +: 'int' and ...
Whenever you see an error that include 'NoneType' that means that you have an operand or an object that is None when you...
Read more >
Unsupported operand type(s) for +: 'NoneType' and 'int'
The Python "TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'" occurs when we try to use the addition (+) operator with a ......
Read more >
unsupported operand type(s) for +: 'NoneType' and 'int'
In python, TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' error occurs when an integer value is added to a variable that...
Read more >
unsupported operand type(s) for +=: 'int' and 'NoneType ...
Hey Can someone please explain why i ping this error when returning the 'elif' part of the statement. Other research has helped me...
Read more >
TypeError: unsupported operand type(s) for |: 'type ... - GitHub
TypeError : unsupported operand type(s) for |: 'type' and 'NoneType' #371. Open.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found