def _constructor_based_unpickle(
    cls: Type[T], checkpointing_version: int, deduplicate: bool, args, kwargs
) -> T:
    """
    This function is used to unpickle a object by reconstructing it from the constructor parameters.

    This function is called directly by dill/pickle when loading a checkpoint that contains an object of class `cls`.
    """

    if checkpointing_version != CHECKPOINT_MECHANISM_VERSION:
        warnings.warn(
            f"Checkpointing mechanism version mismatch: "
            f"expected {CHECKPOINT_MECHANISM_VERSION}, "
            f"got {checkpointing_version}. "
            f"Checkpointing may fail."
        )

    if args is None:
        args = []
    if kwargs is None:
        kwargs = {}

    if deduplicate and _is_deduplicating_objects():
        obj, success = _unpickle_unique(cls, args, kwargs)
        if success:
            return obj

    return cls(*args, **kwargs)

    This function is used to unpickle a object by reconstructing it from the constructor parameters.

    This function is called directly by dill/pickle when loading a checkpoint that contains an object of class `cls`.
    
avalanche/checkpointing/checkpoint_internals.py