Config¶
-
class
tinder.config.
Placeholder
[source]¶ A placeholder to denote the required parameter without default.
Example:
config = { 'lr': 0.01, 'gpu': Placeholder.STR } tinder.config.override(config)
-
tinder.config.
bootstrap
(*, logger_name='tinder', trace=True, pdb_on_error=True)[source]¶ Setup convinient utils to run a python script for deep learning.
Sets the ‘CUDA_DEVICE_ORDER’ environment variable to ‘PCI_BUS_ID’
Examples
./a.py lr=0.01 gpu=0,1,2
The following environments are set:
os.environ[‘CUDA_VISIBLE_DEVICES’] = ‘0,1,2’
os.environ[‘CUDA_DEVICE_ORDER’] = ‘PCI_BUS_ID’
os.environ[‘lr’] = ‘0.01’
- Parameters
logger_name – setup standard python logger that is compatiable with tqdm
parse_args – set environment variables from command line arguments. gpu is alias for CUDA_DEVICE_DEVICES.
trace – use backtrace module to print stacktrace
pdb_on_error – enter pdb shell when an exception is raised
-
tinder.config.
override
(config)[source]¶ Update your config dict with command line arguments.
The original dictionary is the default values. To prevent mistakes, any command line argument not specified in the dictionary raises.
gpu is a special key. If gpu is found, os.environ[‘CUDA_VISIBLE_DEVICES’] is set accordingly.
Example:
config = { 'lr': 0.01, 'gpu': Placeholder.STR } tinder.config.override(config) // shell python script.py lr=0.005 gpu=0,1,2
- Parameters
config (dict or SimpleNamspace) – parameter specs
- Raises
RuntimeError – the command line provided an unknown arg.
RuntimeError – the required arg is not provided.