Get label to id / id to label mapping
hello,I have been trouble finding where I can get label to id mapping after loading a dataset from the HuggingFace Hub. Is it already in the dataset object ? or is it done with the model ? Because I did not define the label2id configuration before training and I don’t know how to get back the corresponding label afterwards.
2021-11-08T08:10:55Z
It is done within the dataset AFAIK.dataset = load_dataset(...)
dataset.features["label"].feature.names  # All label names
dataset.features["label"].feature._int2str  # Same as `.names`
dataset.features["label"].feature._str2int  # Mapping from labels to integer
2021-11-08T09:17:05Z
Yes that’s what I was looking for thank you !