import os

import torch


def save_state_dict(filepath: str, state_dict: dict) -> None:
    if os.path.dirname(filepath) != '':
        os.makedirs(os.path.dirname(filepath), exist_ok=True)
    torch.save(state_dict, filepath)
