All Projects → larq → zookeeper

larq / zookeeper

Licence: Apache-2.0 license
A small library for managing deep learning models, hyperparameters and datasets

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to zookeeper

Smenu
smenu started as a lightweight and flexible terminal menu generator, but quickly evolved into a powerful and versatile CLI selection tool for interactive or scripting use.
Stars: ✭ 1,906 (+8563.64%)
Mutual labels:  command-line-interface
AWS-CLI-Commands
Collection of AWS CLI commands for several AWS services.
Stars: ✭ 44 (+100%)
Mutual labels:  command-line-interface
npshell
Command line music queue manager. A music player from the comfort of your own shell.
Stars: ✭ 15 (-31.82%)
Mutual labels:  command-line-interface
Reactopt
A CLI React performance optimization tool that identifies potential unnecessary re-rendering
Stars: ✭ 1,975 (+8877.27%)
Mutual labels:  command-line-interface
ExampleCLI
Example TypeScript CLI with Node.js
Stars: ✭ 37 (+68.18%)
Mutual labels:  command-line-interface
diagrams-braille
Render diagrams to Braille
Stars: ✭ 21 (-4.55%)
Mutual labels:  command-line-interface
Gitui
Blazing 💥 fast terminal-ui for git written in rust 🦀
Stars: ✭ 6,762 (+30636.36%)
Mutual labels:  command-line-interface
main
Mocks Server monorepo
Stars: ✭ 109 (+395.45%)
Mutual labels:  command-line-interface
Blackeye-for-Windows
This is a Phishing tool. Phishing is a type of hacking also called credential harvesting. It creates fake websites for victims to login which saves their login info which includes IP, User-Agent, Username and Password to a file in the computer running Blackeye. This tool has been there for Linux and even Android via Termux. I converted it to Win…
Stars: ✭ 38 (+72.73%)
Mutual labels:  command-line-interface
node-cli-boilerplate
🪓 Create node cli with this user friendly boilerplate
Stars: ✭ 17 (-22.73%)
Mutual labels:  command-line-interface
practical intro to tf2
Building an image classifier in TF2
Stars: ✭ 55 (+150%)
Mutual labels:  tensorflow-datasets
UnityCLI
Unity TCP CLI communication for debugging
Stars: ✭ 22 (+0%)
Mutual labels:  command-line-interface
savepagenow
A simple Python wrapper and command-line interface for archive.org’s "Save Page Now" capturing service
Stars: ✭ 140 (+536.36%)
Mutual labels:  command-line-interface
Enhancd
🚀 A next-generation cd command with your interactive filter
Stars: ✭ 2,049 (+9213.64%)
Mutual labels:  command-line-interface
ucp-cli
command-line interface for sending and receiving SMS via UCP protocol
Stars: ✭ 15 (-31.82%)
Mutual labels:  command-line-interface
Rebound
Command-line tool that instantly fetches Stack Overflow results when an exception is thrown
Stars: ✭ 3,763 (+17004.55%)
Mutual labels:  command-line-interface
pypi-command-line
A powerful, colorful, beautiful command-line-interface for pypi.org
Stars: ✭ 32 (+45.45%)
Mutual labels:  command-line-interface
injectory
command-line interface dll injector
Stars: ✭ 49 (+122.73%)
Mutual labels:  command-line-interface
Comonicon.jl
Your best CLI generator in JuliaLang
Stars: ✭ 181 (+722.73%)
Mutual labels:  command-line-interface
googlr
Googlr is a command line tool that lets you search Google from your terminal.
Stars: ✭ 35 (+59.09%)
Mutual labels:  command-line-interface

Zookeeper

GitHub Actions Codecov PyPI - Python Version PyPI PyPI - License Code style: black

A small library for configuring modular applications.

Installation

pip install zookeeper

Components

The fundamental building blocks of Zookeeper are components. The @component decorator is used to turn classes into components. These component classes can have configurable fields, which are declared with the Field constructor and class-level type annotations. Fields can be created with or without default values. Components can also be nested, with ComponentFields, such that child componenents can access the field values defined on their parents.

For example:

from zookeeper import component

@component
class ChildComponent:
    a: int = Field()                          # An `int` field with no default set
    b: str = Field("foo")                     # A `str` field with default value `"foo"`

@component
class ParentComponent:
    a: int = Field()                          # The same `int` field as the child
    child: ChildComponent = ComponentField()  # A nested component field, of type `ChildComponent`

After instantiation, components can be 'configured' with a configuration dictionary, containing values for a tree of nested fields. This process automatically injects the correct values into each field.

If a child sub-component declares a field which already exists in some containing ancestor component, then it will pick up the value that's set on the parent, unless a 'scoped' value is set on the child.

For example:

from zookeeper import configure

p = ParentComponent()

configure(
    p,
    {
        "a": 5,
        "child.a": 4,
    }
)

>>> 'ChildComponent' is the only concrete component class that satisfies the type
>>> of the annotated parameter 'ParentComponent.child'. Using an instance of this
>>> class by default.

print(p)

>>> ParentComponent(
>>>     a = 5,
>>>     child = ChildComponent(
>>>         a = 4,
>>>         b = "foo"
>>>     )
>>> )

Tasks and the CLI

The @task decorator is used to define Zookeeper tasks and can be applied to any class that implements an argument-less run method. Such tasks can be run through the Zookeeper CLI, with parameter values passed in through CLI arguments (configure is implicitly called).

For example:

from zookeeper import cli, task

@task
class UseChildA:
    parent: ParentComponent = ComponentField()
    def run(self):
        print(self.parent.child.a)

@task
class UseParentA(UseChildA):
    def run(self):
        print(self.parent.a)

if __name__ == "__main__":
    cli()

Running the above file then gives a nice CLI interface:

python test.py use_child_a
>>> ValueError: No configuration value found for annotated parameter 'UseChildA.parent.a' of type 'int'.

python test.py use_child_a a=5
>>> 5

python test.py use_child_a a=5 child.a=3
>>> 3

python test.py use_parent_a a=5 child.a=3
>>> 5

Using Zookeeper to define Larq or Keras experiments

See examples/larq_experiment.py for an example of how to use Zookeeper to define all the necessary components (dataset, preprocessing, and model) of a Larq experiment: training a BinaryNet on MNIST. This example can be easily adapted to other Larq or Keras models and other datasets.

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].