ml_research_tools#

ML Research Tools Package.

A collection of tools for machine learning research, including experiment management, Kubernetes utilities, and LaTeX processing.

class ml_research_tools.Config(logging=<factory>, redis=<factory>, llm_presets=<factory>)[source]#

Bases: object

Global application configuration.

Parameters:
classmethod from_dict(config_dict)[source]#

Create a Config object from a dictionary.

Parameters:

config_dict (Dict[str, Any]) – Dictionary containing configuration values.

Return type:

Config

Returns:

Config object.

property llm: LLMConfig#

Backward compatibility property to get the default LLM config.

logging: LoggingConfig#
redis: RedisConfig#
llm_presets: LLMPresets#
ml_research_tools.get_config(args=None)[source]#

Get configuration from file and command line arguments.

Parameters:

args (Optional[Namespace]) – Parsed command line arguments. If None, only uses the config file.

Return type:

Tuple[Config, Path]

Returns:

Config object.

class ml_research_tools.BaseTool(services)[source]#

Bases: ABC

Base class for all research tools.

This class defines a standard interface that all tools should implement, including methods for parsing arguments and executing the tool’s functionality.

Initialize the tool with default values.

Parameters:

services (ServiceProvider)

__init__(services)[source]#

Initialize the tool with default values.

Parameters:

services (ServiceProvider)

Return type:

None

abstractmethod classmethod add_arguments(parser)[source]#

Add tool-specific arguments to the argument parser.

Parameters:

parser (ArgumentParser) – The argument parser to add arguments to

Return type:

None

classmethod add_subparser(subparsers)[source]#

Add a subparser for this tool to a parent parser’s subparsers.

Parameters:

subparsers (_SubParsersAction) – subparsers object from the parent parser

Return type:

ArgumentParser

Returns:

The created subparser

create_progress(**kwargs)[source]#

Create a progress bar with rich formatting.

Return type:

Progress

Returns:

Rich Progress object

Parameters:

kwargs (Any)

description: str = 'Base tool description'#
abstractmethod execute(config, args)[source]#

Execute the tool with the provided arguments.

Parameters:
  • config (Config) – Configuration object

  • args (Namespace) – Parsed command-line arguments

Return type:

int

Returns:

Exit code (0 for success, non-zero for error)

execute_from_args(args)[source]#

Execute the tool from parsed arguments.

Parameters:

args (Namespace) – Parsed command-line arguments

Return type:

int

Returns:

Exit code (0 for success, non-zero for error)

name: str = 'base_tool'#
parse_and_execute(args=None)[source]#

Parse command-line arguments and execute the tool.

Parameters:

args (Optional[List[str]]) – Command-line arguments (uses sys.argv if None)

Return type:

int

Returns:

Exit code (0 for success, non-zero for error)

ml_research_tools.get_logger(name)[source]#

Get a logger with the specified name.

Parameters:

name (str) – Name of the logger.

Return type:

Logger

Returns:

Logger instance.

ml_research_tools.setup_logging(log_level, log_file=None)[source]#

Set up logging configuration.

Parameters:
  • log_level (str) – Logging level.

  • log_file (Optional[str]) – Path to log file. If None, only logs to console.

Return type:

None

Subpackages#