rnn

Main entry point

This is the main entry point. You can execute this file. See rnn.init_config() for some arguments, or just run ./rnn.py --help. See Technological overview for a technical overview.

rnn.init_config(config_filename=None, command_line_options=(), default_config=None, extra_updates=None)[source]
Parameters:
  • config_filename (str|None) –
  • command_line_options (list[str]|tuple[str]) – e.g. sys.argv[1:]
  • default_config (dict[str]|None) –
  • extra_updates (dict[str]|None) –

Initializes the global config. There are multiple sources which are used to init the config:

  • configFilename, and maybe first item of commandLineOptions interpret as config filename
  • other options via commandLineOptions
  • extra_updates

Note about the order/priority of these:

  • extra_updates
  • options from commandLineOptions
  • configFilename
  • config filename from commandLineOptions[0]
  • extra_updates
  • options from commandLineOptions

extra_updates and commandLineOptions are used twice so that they are available when the config is loaded, which thus has access to them, and can e.g. use them via Python code. However, the purpose is that they overwrite any option from the config; that is why we apply them again in the end.

commandLineOptions is applied after extra_updates so that the user has still the possibility to overwrite anything set by extra_updates.

rnn.init_log()[source]

Initializes the global Log.

rnn.init_config_json_network()[source]

Handles ‘initialize_from_json’ from the global config.

rnn.init_theano_devices()[source]

Only for Theano.

Return type:list[Device.Device]|None
rnn.get_cache_byte_sizes()[source]
Return type:(int,int,int)

:returns cache size in bytes for (train,dev,eval)

rnn.load_data(config, cache_byte_size, files_config_key, **kwargs)[source]
Parameters:
  • config (Config) –
  • cache_byte_size (int) –
  • files_config_key (str) – such as “train” or “dev”
  • kwargs – passed on to init_dataset() or init_dataset_via_str()
Return type:

(Dataset,int)

:returns the dataset, and the cache byte size left over if we cache the whole dataset.

rnn.init_data()[source]

Initializes the globals train,dev,eval of type Dataset.

rnn.print_task_properties(devices=None)[source]
rnn.init_engine(devices)[source]

Initializes global engine.

rnn.returnn_greeting(config_filename=None, command_line_options=None)[source]

Prints some RETURNN greeting to the log.

Parameters:
  • config_filename (str|None) –
  • command_line_options (list[str]|None) –
rnn.init_backend_engine()[source]

Initializes engine, which is either TFEngine.Engine or Theano Engine.Engine.

rnn.init(config_filename=None, command_line_options=(), config_updates=None, extra_greeting=None)[source]
Parameters:
  • config_filename (str|None) –
  • command_line_options (tuple[str]|list[str]|None) – e.g. sys.argv[1:]
  • config_updates (dict[str]|None) – see init_config()
  • extra_greeting (str|None) –
rnn.finalize()[source]

Cleanup at the end.

rnn.need_data()[source]
Returns:whether we need to init the data (call init_data()) for the current task (execute_main_task())
Return type:bool
rnn.execute_main_task()[source]

Executes the main task (via config task option).

rnn.analyze_data(config)[source]
Parameters:config (Config) –
rnn.main(argv)[source]

Main entry point of RETURNN.

Parameters:argv (list[str]) –