-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
[WIP] Working prototype of experiment sequence #2461
base: main
Are you sure you want to change the base?
Changes from 3 commits
421293e
587c509
f59ec7b
6c0f10f
b9af790
b9ccf5a
3d2b441
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from abc import abstractmethod | ||
import typing | ||
|
||
from collections.abc import Iterator | ||
from typing import Any, Sequence, Tuple | ||
|
||
|
||
class ExperimentSequence(Iterator): | ||
@abstractmethod | ||
def __next__(self): | ||
"""Return tuple of experiment id, optional trial object and experiment overrides.""" | ||
raise NotImplementedError() | ||
|
||
def __iter__(self) -> typing.Iterator[Sequence[str]]: | ||
return self | ||
|
||
@abstractmethod | ||
def update_sequence(self, experiment_result: Tuple[Sequence[str], Any]): | ||
"""Update experiment generator(study) with experiment results""" | ||
raise NotImplementedError() | ||
|
||
def __len__(self): | ||
"""Return maximum number of experiments sequence can produce""" | ||
raise NotImplementedError() |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,17 @@ | ||||||||||||||||||||||||||||||||||
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. | ||||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||
# you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||||
# You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||||
# http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||
# | ||||||||||||||||||||||||||||||||||
# Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||
# distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||
# See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||
# limitations under the License. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved | ||||||||||||||||||||||||||||||||||
Comment on lines
+1
to
15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
No need to add the license to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let me check, maybe I have added some changes and haven't committed them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I originally had |
||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||
Sweeper plugin interface | ||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
global-exclude *.pyc | ||
global-exclude __pycache__ | ||
recursive-include hydra_plugins/* *.yaml py.typed |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Hydra loky Launcher | ||
Provides a [loky](link) based Hydra Launcher supporting parallel worker pool execution. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defaults: | ||
- override hydra/launcher: loky | ||
|
||
task: 1 | ||
|
||
hydra: | ||
launcher: | ||
# override the number of jobs for loky | ||
max_workers: 10 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved | ||
import logging | ||
import os | ||
import time | ||
|
||
import hydra | ||
from omegaconf import DictConfig | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
@hydra.main(config_name="config") | ||
def my_app(cfg: DictConfig) -> None: | ||
log.info(f"Process ID {os.getpid()} executing task {cfg.task} ...") | ||
|
||
time.sleep(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
my_app() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved | ||
|
||
__version__ = "1.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.