modlee.model_text_converter module

Convertor for model objects into text (deprecated?).

modlee.model_text_converter.exhaust_sequence_branch(root_sequence_module, custom_history)[source]

Exhaust a module as a tree to find custom modules,

Parameters:
  • root_sequence_module – The root node/module of the model.

  • custom_history – A list of custom module names.

Returns:

A tuple of lists ([custom module objects], [custom module names])

modlee.model_text_converter.get_code_text(code_text, module, custom_history)[source]

Get a code text representation of a model as its __init__ and forward functions.

Parameters:
  • code_text – The current code text if there are other dependencies, can be empty ‘’.

  • module – The module for which to get the code text.

  • custom_history – A list of the history of custom modules.

Returns:

A tuple of code_text, custom_child_module_list, custom_history.

modlee.model_text_converter.get_code_text_for_model(model: Module | LightningModule, include_header=False)[source]

Get the code text for a model.

Parameters:

model – The model for which to get the code text.

Returns:

The code text for the model.

modlee.model_text_converter.save_code_text_for_model(code_text: str, include_header: bool = False)[source]

Save the code text.

Parameters:
  • code_text – The code text to save.

  • include_header – Whether to include the header of modlee imports in the text, defaults to False.