Merge in RR/fb_detr_prediction_container from docker-image-tuning to master
Squashed commit of the following:
commit 9b30e6317aaf892fcb6f87275d03e2efb76954bf
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Mon Feb 21 15:17:01 2022 +0100
applied black
commit 84a57ac29723910dbc2c4d8ccce58c9d3131a305
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Mon Feb 21 15:15:15 2022 +0100
refactorig of tqdm
commit b26c52765c58125826099072d510a39baabce73e
Author: Julius Unverfehrt <Julius.Unverfehrt@iqser.com>
Date: Mon Feb 21 14:52:11 2022 +0100
correcting versioning of docker-compose
commit 23752eec0d95cc543f15a86c78bd8531ebfdde7d
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Mon Feb 21 14:49:26 2022 +0100
put tqdm progress in different place
commit e2e109ea7125c90f5b15ec374f3cbfef41e2ee9e
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Mon Feb 21 11:51:09 2022 +0100
fixed batching index bug
commit 6ca508ac55dd02ded356617653f580099e1cf186
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Mon Feb 21 11:37:34 2022 +0100
batching WIP
commit 0ceb7c1415b10230397f4860ac4e314d44bfbfd1
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Fri Feb 18 19:21:02 2022 +0100
debug mode for webserver renamed
commit 617f07a0296ad3efc85b6ee52d1641cdfa22d3d3
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Fri Feb 18 18:25:39 2022 +0100
refactoring, better logging, added compose file for local testing
commit a24f799614e22481dd20b578c354e33474bec5c0
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Fri Feb 18 17:31:14 2022 +0100
updated submodule
commit 67b64606e081373e5c30ccf5bfafcb91dcc9a74e
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Fri Feb 18 17:29:20 2022 +0100
cleanup: better config; refactoring; renaming
commit c3a1ab560879d6a1e6ce003c74a07d62175316f7
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Fri Feb 18 15:55:35 2022 +0100
tweaked dockerfiles
commit 43f7a32265243bc0f110bd307325b5404e8726a8
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date: Fri Feb 18 15:02:49 2022 +0100
added dockerignore
41 lines
925 B
Python
41 lines
925 B
Python
"""Implements a config object with dot-indexing syntax."""
|
|
|
|
|
|
from envyaml import EnvYAML
|
|
|
|
from fb_detr.locations import CONFIG_FILE
|
|
|
|
|
|
def _get_item_and_maybe_make_dotindexable(container, item):
|
|
ret = container[item]
|
|
return DotIndexable(ret) if isinstance(ret, dict) else ret
|
|
|
|
|
|
class DotIndexable:
|
|
def __init__(self, x):
|
|
self.x = x
|
|
|
|
def __getattr__(self, item):
|
|
return _get_item_and_maybe_make_dotindexable(self.x, item)
|
|
|
|
def __setitem__(self, key, value):
|
|
self.x[key] = value
|
|
|
|
def __repr__(self):
|
|
return self.x.__repr__()
|
|
|
|
|
|
class Config:
|
|
def __init__(self, config_path):
|
|
self.__config = EnvYAML(config_path)
|
|
|
|
def __getattr__(self, item):
|
|
if item in self.__config:
|
|
return _get_item_and_maybe_make_dotindexable(self.__config, item)
|
|
|
|
def __getitem__(self, item):
|
|
return self.__getattr__(item)
|
|
|
|
|
|
CONFIG = Config(CONFIG_FILE)
|