def METHOD_NAME(cls, config: HardKeypointMiningConfig) -> "OHKMLoss":
    return cls(
        hard_to_easy_ratio=config.hard_to_easy_ratio,
        min_hard_keypoints=config.min_hard_keypoints,
        max_hard_keypoints=config.max_hard_keypoints
        if config.max_hard_keypoints is not None
        else -1,
        loss_scale=config.loss_scale,
    )