Skip to content

Commit

Permalink
Merge branch 'issue_586' of github.com:Delaunay/orion into issue_586
Browse files Browse the repository at this point in the history
  • Loading branch information
Delaunay committed Mar 21, 2022
2 parents c7b5a46 + 64555ed commit c3eecbb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"orion.serving",
"orion.storage",
"orion.testing",
"orion.typing",
]

extras_require = {
Expand Down
23 changes: 13 additions & 10 deletions src/orion/algo/space/configspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@
except ImportError as err:
IMPORT_ERROR = err

IntegerHyperparameter = object()
FloatHyperparameter = object()
ConfigurationSpace = object()
Hyperparameter = object()
UniformFloatHyperparameter = object()
NormalFloatHyperparameter = object()
UniformIntegerHyperparameter = object()
NormalIntegerHyperparameter = object()
CategoricalHyperparamete = object()
class DummyType:
pass

IntegerHyperparameter = DummyType
FloatHyperparameter = DummyType
ConfigurationSpace = DummyType
Hyperparameter = DummyType
UniformFloatHyperparameter = DummyType
NormalFloatHyperparameter = DummyType
UniformIntegerHyperparameter = DummyType
NormalIntegerHyperparameter = DummyType
CategoricalHyperparamete = DummyType


def _qantization(dim: Dimension) -> float:
Expand Down Expand Up @@ -205,7 +208,7 @@ def to_oriondim(dim: Hyperparameter) -> Dimension:


@to_orionspace.register
def configpsace_to_orionspace(cspace: ConfigurationSpace) -> Space:
def configspace_to_orionspace(cspace: ConfigurationSpace) -> Space:
"""Convert from orion space to configspace
Notes
Expand Down
1 change: 0 additions & 1 deletion src/orion/benchmark/task/profet/forrester.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from orion.benchmark.task.profet.model_utils import get_architecture_forrester
from orion.benchmark.task.profet.profet_task import ProfetTask

from orion.typing import torch


Expand Down
1 change: 0 additions & 1 deletion src/orion/benchmark/task/profet/svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from orion.benchmark.task.profet.model_utils import get_default_architecture
from orion.benchmark.task.profet.profet_task import ProfetTask

from orion.typing import torch


Expand Down
14 changes: 9 additions & 5 deletions src/orion/typing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import typing

try:
import torch

if typing.TYPE_CHECKING:
import torch
HAS_TORCH = True
TORCH_ERROR = None

except ImportError as err:
TORCH_ERROR = err
HAS_TORCH = False

class torch:
"""torch module stub"""

class nn:
"""toch nn module stub"""

class Module:
"""torch module stub"""

pass

def __getattr__(self) -> None:
raise err
raise TORCH_ERROR

0 comments on commit c3eecbb

Please sign in to comment.