TACS
str method is not supported yet.
Introduction
TACS was created as a lightweight library to define and manage
system configurations, such as those commonly found in software
designed for scientific experimentation. These "configurations"
typically cover concepts like hyperparameters used in training a
machine learning model or configurable model hyperparameters, such
as the depth of a convolutional neural network. Since you're doing
science, reproducibility is paramount and thus you need a reliable
way to serialize experimental configurations. TACS
uses TOML as a simple, human readable serialization format.
The paradigm is: your code + a TACS config for experiment E (+ external dependencies + hardware + other nuisance terms ...) = reproducible experiment E. While you might not be able to control
everything, at least you can control your code and your experimental
configuration. YACS is here to help you with that.
TACS grew out of the experimental configuration systems used in: py-faster-rcnn and Detectron.
Usage
TACS can be used in a variety of flexible ways. There are two main paradigms:
- Configuration as local variable
- Configuration as a global singleton
It's up to you which you prefer to use, though the local variable route is recommended.
To use TACS in your project, you first create a project config
file, typically called config.py or defaults.py. This file
is the one-stop reference point for all configurable options.
It should be very well documented and provide sensible defaults
for all options.
# my_project/config.py
from tacs.config import CfgNode as CN
_C = CN()
_C.SYSTEM = CN()
# Number of GPUS to use in the experiment
_C.SYSTEM.NUM_GPUS = 8
# Number of workers for doing things
_C.SYSTEM.NUM_WORKERS = 4
_C.TRAIN = CN()
# A very important hyperparameter
_C.TRAIN.HYPERPARAMETER_1 = 0.1
# The all important scales for the stuff
_C.TRAIN.SCALES = (2, 4, 8, 16)
def get_cfg_defaults():
"""Get a yacs CfgNode object with default values for my_project."""
# Return a clone so that the defaults will not be altered
# This is for the "local variable" use pattern
return _C.clone()
# Alternatively, provide a way to import the defaults as
# a global singleton:
# cfg = _C # users can `from config import cfg`
Next, you'll create TOML configuration files; typically you'll make one for each experiment. Each configuration file only overrides the options that are changing in that experiment.
# my_project/experiment.toml
[SYSTEM]
NUM_GPUS = 2
[TRAIN]
SCALES = [1, 2]
Finally, you'll have your actual project code that uses the config
system. After any initial setup it's a good idea to freeze it to
prevent further modification by calling the freeze() method. As
illustrated below, the config options can either be used a global
set of options by importing cfg and accessing it directly, or
the cfg can be copied and passed as an argument.
# my_project/main.py
import my_project
from config import get_cfg_defaults # local variable usage pattern, or:
# from config import cfg # global singleton usage pattern
if __name__ == "__main__":
cfg = get_cfg_defaults()
cfg.merge_from_file("experiment.toml")
cfg.freeze()
print(cfg)
# Example of using the cfg as global access to options
if cfg.SYSTEM.NUM_GPUS > 0:
my_project.setup_multi_gpu_support()
model = my_project.create_model(cfg)
Command line overrides
You can update a CfgNode using a list of fully-qualified key, value pairs.
This makes it easy to consume override options from the command line. For example:
cfg.merge_from_file("experiment.toml")
# Now override from a list (opts could come from the command line)
opts = ["SYSTEM.NUM_GPUS", 8, "TRAIN.SCALES", "[1, 2, 3, 4]"]
cfg.merge_from_list(opts)
The following principle is recommended: "There is only one way to
configure the same thing." This principle means that if an option
is defined in a TACS config object, then your program should set
that configuration option using cfg.merge_from_list(opts) and
not by defining, for example, --train-scales as a command line
argument that is then used to set cfg.TRAIN.SCALES.
Metadata
Release files for tacs 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tacs-0.0.1-py3.6.egg | Legacy Egg format | - | - | Details for tacs-0.0.1-py3.6.egg |
| tacs-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for tacs-0.0.1-py3-none-any.whl |
Total release size: 37.2 kB
Release files / tacs-0.0.1-py3.6.egg
| Download URL | tacs-0.0.1-py3.6.egg |
|---|---|
| Size | 20.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
f930a300836530f9e8497fbeebda677366a651c1e9ec8e911224d97c036af392
|
|
BLAKE2b-256 checksum How to use checksums |
8fc3fad2ca6018ec256dcef346021ebabcdbb5685daf003654bddc14b6c7ef7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.6.7
|
Release files / tacs-0.0.1-py3-none-any.whl
| Download URL | tacs-0.0.1-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d0c786eec5ee8e7dc5939eadbb6f531c041a879d69432326012a65283ca198d
|
|
BLAKE2b-256 checksum How to use checksums |
a0edd0c55f71226311770019c186b4ae724816d910316eaf3d1abe918a3cc00e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.6.7
|
Security for tacs 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.