All Projects → rbgirshick → Yacs

rbgirshick / Yacs

Licence: apache-2.0
YACS -- Yet Another Configuration System

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Yacs

Pgm Index
🏅State-of-the-art learned data structure that enables fast lookup, predecessor, range searches and updates in arrays of billions of items using orders of magnitude less space than traditional indexes
Stars: ✭ 499 (-29.22%)
Mutual labels:  research
Habitat Lab
A modular high-level library to train embodied AI agents across a variety of tasks, environments, and simulators.
Stars: ✭ 587 (-16.74%)
Mutual labels:  research
Spring Cloud Config Admin
Spring Cloud Config的综合管理后台(简称:SCCA)
Stars: ✭ 645 (-8.51%)
Mutual labels:  configuration-management
Holodeck
High Fidelity Simulator for Reinforcement Learning and Robotics Research.
Stars: ✭ 513 (-27.23%)
Mutual labels:  research
Aconfmgr
A configuration manager for Arch Linux
Stars: ✭ 576 (-18.3%)
Mutual labels:  configuration-management
Rwa
Machine Learning on Sequential Data Using a Recurrent Weighted Average
Stars: ✭ 593 (-15.89%)
Mutual labels:  research
Solr Injection
Apache Solr Injection Research
Stars: ✭ 464 (-34.18%)
Mutual labels:  research
Carla
Open-source simulator for autonomous driving research.
Stars: ✭ 7,012 (+894.61%)
Mutual labels:  research
Warez
All your base are belong to us!
Stars: ✭ 584 (-17.16%)
Mutual labels:  research
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (-8.79%)
Mutual labels:  configuration-management
Qlib
Qlib is an AI-oriented quantitative investment platform, which aims to realize the potential, empower the research, and create the value of AI technologies in quantitative investment. With Qlib, you can easily try your ideas to create better Quant investment strategies. An increasing number of SOTA Quant research works/papers are released in Qlib.
Stars: ✭ 7,582 (+975.46%)
Mutual labels:  research
Ios
Most usable tools for iOS penetration testing
Stars: ✭ 563 (-20.14%)
Mutual labels:  research
Enms
An enterprise-grade vendor-agnostic network automation platform.
Stars: ✭ 595 (-15.6%)
Mutual labels:  configuration-management
Nacos Spring Boot Project
Nacos ECO Project for Spring Boot
Stars: ✭ 508 (-27.94%)
Mutual labels:  configuration-management
Gibsonenv
Gibson Environments: Real-World Perception for Embodied Agents
Stars: ✭ 666 (-5.53%)
Mutual labels:  research
Poc
Proofs-of-concept
Stars: ✭ 467 (-33.76%)
Mutual labels:  research
Dnc Tensorflow
A TensorFlow implementation of DeepMind's Differential Neural Computers (DNC)
Stars: ✭ 587 (-16.74%)
Mutual labels:  research
Apollo
Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
Stars: ✭ 26,052 (+3595.32%)
Mutual labels:  configuration-management
Pybossa
PYBOSSA is the ultimate crowdsourcing framework (aka microtasking) to analyze or enrich data that can't be processed by machines alone.
Stars: ✭ 670 (-4.96%)
Mutual labels:  research
Ohai
Ohai profiles your system and emits JSON
Stars: ✭ 641 (-9.08%)
Mutual labels:  configuration-management

YACS

Introduction

YACS 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. YACS uses YAML as a simple, human readable serialization format. The paradigm is: your code + a YACS 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.

YACS grew out of the experimental configuration systems used in: py-faster-rcnn and Detectron.

Usage

YACS 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 YACS 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 yacs.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 YAML 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.yaml
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.yaml")
  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.yaml")
# 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 YACS 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.

Python config files (instead of YAML)

yacs>= 0.1.4 supports loading CfgNode objects from Python source files. The convention is that the Python source must export a module variable named cfg of type dict or CfgNode. See examples using a CfgNode and a dict as well as usage in the unit tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].