OK, I see.
Personally, I’d perform the mapping inside Dataset before the training/validation code:
train_dataset = ...  # your training dataset
val_dataset = ...  # your validation dataset etc

class TransformedDataset(torch.utils.data.Dataset):
    def __init__(self, dataset, transform_fn):
        self.dataset = dataset
        self.transform_fn = transform_fn

    def __len__(self):
        return len(self.dataset)

    def __getitem__(self, index):
        dp = self.dataset[index]
        return self.transform_fn(dp)


from functools import partial

labels_mapping = {
    10988: 0,
    10995: 1,
    ...
}


def map_targets_fn(dp, target_mapping):
    x, y = dp
    new_y  = target_mapping[y]
    return x, new_y


train_dataset = TransformedDataset(train_dataset, partial(map_targets_fn, target_mapping=labels_mapping))
val_dataset = TransformedDataset(val_dataset, partial(map_targets_fn, target_mapping=labels_mapping))

# same code as before without any change to metrics

HTH