Solved by lewtun in post #2 
              
              
                Hey @ivanlau I think your idea to apply ClassLabel.str2int() is the simplest approach, e.g. 
from datasets import load_dataset, ClassLabel, Features

dset = load_dataset("amazon_reviews_multi", "all_languages", split="test")
# Create ClassLabel feature
langs = dset.unique("language")
lang_feature = …