Skip to content

Config

Global configuration management for MLIR RL training.

This module provides a singleton configuration class that loads and validates configuration parameters from JSON files, managing all hyperparameters and settings for the training pipeline.

Config()

Class to store and load global configuration

Source code in mlir_rl_artifact/utils/config.py
def __init__(self):
    """Load the configuration from the JSON file
    or get existing instance if any.
    """
    # Open the JSON file
    with open(os.getenv("CONFIG_FILE_PATH"), "r") as f:
        config_data: dict[str, Any] = json.load(f)

    for element, element_t in self.__annotations__.items():
        if element not in config_data:
            raise ValueError(f"{element} is missing from the config file")

        element_v = check_type(config_data[element], element_t, collection_check_strategy=CollectionCheckStrategy.ALL_ITEMS)
        setattr(self, element, element_v)

max_num_stores_loads instance-attribute

The maximum number of loads in the nested loops

max_num_loops instance-attribute

The max number of nested loops

max_num_load_store_dim instance-attribute

The max number of dimensions in load/store buffers

num_tile_sizes instance-attribute

The number of tile sizes

vect_size_limit instance-attribute

Vectorization size limit to prevent large sizes vectorization

order instance-attribute

The order of actions that needs to bo followed

interchange_mode instance-attribute

The method used for interchange action

exploration instance-attribute

The exploration method

init_epsilon instance-attribute

The initial epsilon value for epsilon greedy exploration

normalize_bounds instance-attribute

Flag to indicate if the upper bounds in the input should be normalized or not

normalize_adv instance-attribute

The advantage normalization method

reuse_experience instance-attribute

Strategy for experience replay

benchmarks_folder_path instance-attribute

Path to the benchmarks folder. Can be empty if optimization mode is set to "last".

bench_count instance-attribute

Number of batches in a trajectory

replay_count instance-attribute

Number of trajectories to keep in the replay buffer

nb_iterations instance-attribute

Number of iterations

ppo_epochs instance-attribute

Number of epochs for PPO

ppo_batch_size instance-attribute

Batch size for PPO

value_epochs instance-attribute

Number of epochs for value update

value_batch_size instance-attribute

Batch size for value update

value_coef instance-attribute

Value coefficient

value_clip instance-attribute

Clip value loss or not

entropy_coef instance-attribute

Entropy coefficient

lr instance-attribute

Learning rate

truncate instance-attribute

Maximum number of steps in the schedule

json_file instance-attribute

Path to the JSON file containing the benchmarks execution times.

eval_json_file instance-attribute

Path to the JSON file containing the benchmarks execution times for evaluation.

tags instance-attribute

List of tags to add to the neptune experiment

debug instance-attribute

Flag to enable debug mode

main_exec_data_file instance-attribute

Path to the file containing the execution data

results_dir instance-attribute

Path to the results directory

to_dict()

Convert the configuration to a dictionary.

Source code in mlir_rl_artifact/utils/config.py
def to_dict(self):
    """Convert the configuration to a dictionary."""
    return {k: self.__dict__[k] for k in self.__annotations__}

__str__()

Convert the configuration to a string.

Source code in mlir_rl_artifact/utils/config.py
def __str__(self):
    """Convert the configuration to a string."""
    return str(self.to_dict())