digideep.pipeline package

Submodules

digideep.pipeline.runner module

class digideep.pipeline.runner.Runner(params)[source]

Bases: object

This class controls the main flow of the program. The main components of the class are:

  • explorer: A dictionary containing Explorer for the three modes of train, test, and eval. An Explorer is a class which handles running simulations concurrently in several environments.
  • memory: The component responsible for storing the trajectories generated by the explorer.
  • agents: A dictionary containing all agents in the environment.

This class also prints the Profiler and Monitor information. Also the main serialization burden is on this class. The rest of classes only need to implement the state_dict and load_state_dict functions for serialization.

Caution

The lines of code for testing while training are commented out.

custom()[source]
enjoy()[source]

This function evaluates the current policy in the environment. It only runs the explorer in a loop.

# Do a cycle
while not done:
    # Explore
    explorer["eval"].update()

log()
finalize(save=True)[source]
instantiate()[source]

This function will instantiate the memory, the explorers, and the agents with their specific parameters.

lazy_connect_signal()[source]
lazy_init()[source]

Initialization of attributes which are not part of the object state. These need lazy initialization due to proper initialization when loading from a checkpoint.

load()[source]

This is a function used by the start() function to load the states of internal objects from the checkpoint and update the objects state dicts.

load_memory()[source]
load_state_dict(state_dict)[source]

This function will load the states of the internal objects:

  • Agents
  • Explorers (state of train mode would be loaded for test and eval as well)
  • Memory
log()[source]

The log function prints a summary of:

  • Frame rate and simulated frames.
  • Variables sent to the Monitor.
  • Profiling information, i.e. registered timing information in the Profiler.
monitor_epoch()[source]
on_sigint_received(signalNumber, frame)[source]
on_sigusr1_received(signalNumber, frame)[source]
override()[source]
save(forced=False)[source]

This is a high-level function for saving both the state of objects and the runner object. It will use helper functions from Session.

save_final_checkpoint()[source]
start(session)[source]

A function to initialize the objects and load their states (if loading from a checkpoint). This function must be called before using the train() and enjoy() functions.

If we are starting from scrarch, we will:

  • Instantiate all internal components using parameters.

If we are loading from a saved checkpoint, we will:

  • Instantiate all internal components using old parameters.
  • Load all state dicts.
  • (OPTIONAL) Override parameters.
state_dict()[source]

This function will return the states of all internal objects:

  • Agents
  • Explorer (only the train mode)
  • Memory

Todo

Memory should be dumped in a separate file, since it can get really large. Moreover, it should be optional.

termination_check()[source]
test()[source]
train()[source]

The function that runs the training loop.

train_cycle()[source]

digideep.pipeline.session module

class digideep.pipeline.session.Session(root_path)[source]

Bases: object

This class provides the utilities for storing results of a session. It provides a unique path based on a timestamp and creates all sub- folders that are required there. A session directory will have the following contents:

  • session_YYYYMMDDHHMMSS/:

    • checkpoints/: The directory of all stored checkpoints.
    • modules/: A copy of all modules that should be saved with the results. This helps to load checkpoints in evolving codes with breaking changes. Use extra modules with --save-modules command-line option.
    • monitor/: Summary results of each worker environment.
    • cpanel.json: A json file including control panel (cpanel) parameters in params file.
    • params.yaml: The parameter tree of the session, i.e. the params variable in params file.
    • report.log: A log file for Logger class.
    • visdom.log: A log file for visdom logs.
    • __init__.py: Python __init__ file to convert the session to a module.
Parameters:root_path (str) – The path to the digideep module.

Note

This class also initializes helping tools (e.g. Visdom, Logger, Monitor, etc.) and has helper functions for saving/loading checkpoints.

Tip

The default directory for storing sessions is /tmp/digideep_sessions. To change the default directory use the program with cli argument --session-path <path>

Todo

Complete the session-as-a-module (SaaM) implementation. Then, session_YYYYMMDDHHMMSS should work like an importable module for testing and inference.

Todo

If restoring a session, visdom.log should be copied from there and replayed.

play resume loading dry-run session-only | implemented

——————————————————————————————– | ———— Train 0 0 0 0 0 | 1 Train session barebone 0 0 0 0 1 | 1 Train from a checkpoint 0 1 1 0 0 | 1 Play (policy initialized) 1 0 0 0/1 0 | 1 Play (policy loaded from checkpoint) 1 0 1 0/1 0 | 1

check_if_done()[source]
check_singleton_instance()[source]
createSaaM()[source]

SaaM = Session-as-a-Module This function will make the session act like a python module. The user can then simply import the module for inference.

dump_cpanel(cpanel)[source]
dump_params(params)[source]
dump_repeal(repeal)[source]
finalize()[source]
get_device()[source]
initLogger()[source]

This function sets the logger level and file.

initProlog()[source]
initTensorboard()[source]

Will initialize the SummaryWriter for tensorboard logging.

Link: https://pytorch.org/docs/stable/tensorboard.html

initVarlog()[source]
load_runner()[source]
load_states()[source]
mark_as_done()[source]
parse_arguments()[source]
runMonitor()[source]

This function will load the monitoring tool for CPU and GPU utilization and memory consumption.

save_runner(runner, index)[source]
save_states(states, index)[source]
set_device()[source]
update_params(params)[source]
digideep.pipeline.session.check_checkpoint(path, verbose=False)[source]
digideep.pipeline.session.check_session(path, verbose=False)[source]
digideep.pipeline.session.print_verbose(*args, verbose=False, **kwargs)[source]

Module contents