Skip to content

Commit

Permalink
Merge branch 'facebookresearch:main' into antlr
Browse files Browse the repository at this point in the history
  • Loading branch information
jlopezpena authored Jan 29, 2024
2 parents 92a8d0e + 6ff79b1 commit e8173ff
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ ignore_missing_imports = True
[mypy-hydra.grammar.gen.*]
ignore_missing_imports = True
ignore_errors = True

[mypy-nevergrad.*]
ignore_missing_imports = True

[mypy-rq.*]
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion hydra/_internal/grammar/grammar_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Sweep,
)

ElementType = Union[str, int, bool, float, list, dict]
ElementType = Union[str, int, bool, float, List[Any], Dict[str, Any]]


def apply_to_dict_values(
Expand Down
2 changes: 2 additions & 0 deletions plugins/hydra_ax_sweeper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"ax-platform>=0.1.20,<0.2.1", # https://github.com/facebookresearch/hydra/issues/1767
"torch",
"gpytorch<=1.8.1", # avoid deprecation warnings. This can probably be removed when ax-platform is unpinned.
"pandas<1.5.0", # https://github.com/facebook/Ax/issues/1153, unpin when upgrading ax to >=0.2.8
"numpy<1.25.0", # same as above, silences deprecation from np.find_common_type for pandas <1.5
],
include_package_data=True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def create_nevergrad_parameter_from_override(override: Override) -> Any:
if "log" in val.tags:
scalar = ng.p.Log(lower=val.start, upper=val.end)
else:
scalar = ng.p.Scalar(lower=val.start, upper=val.end) # type: ignore
scalar = ng.p.Scalar(lower=val.start, upper=val.end)
if isinstance(val.start, int):
scalar.set_integer_casting()
return scalar
Expand Down
1 change: 1 addition & 0 deletions plugins/hydra_optuna_sweeper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
install_requires=[
"hydra-core>=1.1.0.dev7",
"optuna>=2.10.0,<3.0.0",
"sqlalchemy~=1.3.0", # TODO: Unpin when upgrading to optuna v3.0
],
include_package_data=True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from dataclasses import dataclass, field
from enum import Enum, IntEnum
from importlib import import_module
from importlib.metadata import version
from typing import Any, Dict, List, Optional

from hydra.core.config_store import ConfigStore
from omegaconf import OmegaConf
from pkg_resources import get_distribution


@dataclass
Expand Down Expand Up @@ -178,11 +178,11 @@ def _pip_pkgs_default_factory() -> Dict[str, str]:
"hydra_core": "${ray_pkg_version:hydra}",
"ray": "${ray_pkg_version:ray}",
"cloudpickle": "${ray_pkg_version:cloudpickle}",
"hydra_ray_launcher": get_distribution("hydra_ray_launcher").version,
"hydra_ray_launcher": version("hydra_ray_launcher"),
}

if sys.version_info < (3, 8):
d["pickle5"] = get_distribution("pickle5").version
d["pickle5"] = version("pickle5")

return d

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def launch(
f"sweep output dir: {sweep_dir}"
)

# Avoid allocating too little memory in CI https://github.com/ray-project/ray/issues/11966#issuecomment-1318100747
launcher.ray_cfg.init.setdefault("object_store_memory", 78643200)
start_ray(launcher.ray_cfg.init)

runs = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from hydra.types import HydraContext, TaskFunction
from omegaconf import DictConfig, OmegaConf, open_dict
from redis import Redis
from rq import Queue # type: ignore
from rq import Queue

from .rq_launcher import RQLauncher

Expand Down
2 changes: 1 addition & 1 deletion plugins/hydra_rq_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"cloudpickle",
"fakeredis<1.7.4", # https://github.com/dsoftwareinc/fakeredis-py/issues/3
"hydra-core>=1.1.0.dev7",
"rq>=1.5.1",
"rq>=1.5.1,<1.12",
],
include_package_data=True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ def test_example(tmpdir: Path) -> None:
"-m",
f"hydra.sweep.dir={tmpdir}",
"hydra/launcher=submitit_local",
]
],
allow_warnings=True,
)
4 changes: 3 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ filterwarnings =
; Remove when default changes
ignore:.*Future Hydra versions will no longer change working directory at job runtime by default.*:UserWarning
; Jupyter notebook test on Windows yield warnings
ignore:.*Proactor event loop does not implement add_reader family of methods required for zmq.*:RuntimeWarning
ignore:.*Proactor event loop does not implement add_reader family of methods required for zmq.*:RuntimeWarning
; Ignore deprecation warning related to pkg_resources
ignore:.*pkg_resources is deprecated*
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build
coverage
flake8<6 # pinned due to https://github.com/savoirfairelinux/flake8-copyright/issues/19
flake8-copyright
importlib-metadata<5.0; python_version <= '3.7'
isort==5.5.2
mypy
nox
Expand Down
2 changes: 1 addition & 1 deletion website/docs/advanced/compose_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ There are 3 initialization methods:

All 3 can be used as methods or contexts.
When used as methods, they are initializing Hydra globally and should only be called once.
When used as contexts, they are initializing Hydra within the context can be used multiple times.
When used as contexts, they are initializing Hydra within the context and can be used multiple times.
Like <b>@hydra.main()</b> all three support the [version_base](../upgrades/version_base.md) parameter
to define the compatibility level to use.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/advanced/instantiate_objects/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ assert isinstance(obj_object.foo, Foo)
assert isinstance(obj_object.bar, dict)

obj_all = instantiate(cfg, _convert_="all")
assert isinstance(obj_none, MyTarget)
assert isinstance(obj_all, MyTarget)
assert isinstance(obj_all.foo, dict)
assert isinstance(obj_all.bar, dict)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ By setting `hydra.job.chdir=True`, you can configure
Hydra's `@hydra.main` decorator to change python's working directory by calling
`os.chdir` before passing control to the user's decorated main function.
As of Hydra v1.2, `hydra.job.chdir` defaults to `False`.

Setting `hydra.job.chdir=True` enables convenient use of the output directory to
store output for the application (For example, a database dump file).

Expand Down

0 comments on commit e8173ff

Please sign in to comment.