-
Notifications
You must be signed in to change notification settings - Fork 5
/
launch_feature_extraction.py
39 lines (28 loc) · 1.15 KB
/
launch_feature_extraction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# --------------------------------------------------------
import asyncio
import hydra
from feature_extraction_module import FeatureExtractionConfig, FeatureExtractionModule
from hydra.core.config_store import ConfigStore
from omegaconf import DictConfig, OmegaConf
from stopes.core import Launcher
async def run(config: FeatureExtractionConfig):
launcher = Launcher(
cluster=config.launcher.cluster,
partition=config.launcher.partition,
max_jobarray_jobs=config.launcher.max_jobarray_jobs,
)
module = FeatureExtractionModule(config)
await launcher.schedule(module)
cs = ConfigStore.instance()
cs.store(name="feature_extraction_config", node=FeatureExtractionConfig)
@hydra.main(version_base=None, config_name="feature_extraction_config")
def main(config: DictConfig):
OmegaConf.resolve(config)
print(f"Config:\n{'-'*50}\n{OmegaConf.to_yaml(config)}{'-'*50}")
asyncio.run(run(config))
if __name__ == "__main__":
main()