Problems in deployment when I configure my own labels
Hi.I am training a binary classification model based on this model checkpoint:dccuchile/bert-base-spanish-wwm-casedWhen deployment, it uses by default these labels: LABEL_0, LABEL_1.My goal is to deploy it with my own labels. Browsing the forum I came across this thread, and it seems that resolve a similiar problem.Change label names on inference APIBeginnersHi there, 
I recently uploaded myfirst modelto the model hub and I’m wondering how I can change the label names that are returned by the inference API. Right now, the API returns “LABEL_0”, “LABEL_1”, etc. with the predictions and I would like it to be something like “Economy”, “Welfare”, etc. 
I looked at the files of other hosted models and I saw that others changed the id2label and label2id in the config.json file, so I also did thathere, but the inference API still returns “LABEL_0”. Do I…After read this thread,  my code looks like:label2id = {
        "0": "goodUser",
        "1": "badUserFraud"
    }
    
    id2label = {
        "goodUser": 0,
        "badUserFraud": 1
    }

    # download model from model hub
    config = AutoConfig.from_pretrained(args.model_name, label2id=label2id, id2label=id2label)
    model = AutoModelForSequenceClassification.from_pretrained(args.model_name, config=config)
    tokenizer = AutoTokenizer.from_pretrained(args.model_name)The training step going well, but when deployment step I find this error:image1632×552 101 KBThanks in advance
2021-08-28T07:19:33Z
I would like to know this aswell
2021-08-30T07:41:18Z
Hey@Oigres,Your configuration is vice-versa.If you take a look atconfig.json · distilbert-base-uncased-finetuned-sst-2-english at mainSo theid2labelneeds to have as key theidand as value thestring.And thelabel2idneeds to have as key thestringand as value theid.id2label = {
        "0": "goodUser",
        "1": "badUserFraud"
    }

label2id = {
        "goodUser": 0,
        "badUserFraud": 1
    }Easy to remember is the name is alwayskey2Value.
2021-08-30T10:48:04Z
Ohh! Seems true that the best debugging technique is taking a restThank you very much
2021-09-02T12:21:31Z
philschmid:So theid2labelneeds to have as key theidand as value thestring.And thelabel2idneeds to have as key thestringand as value theid.id2label = {
        "0": "goodUser",
        "1": "badUserFraud"
    }

label2id = {
        "goodUser": 0,
        "badUserFraud": 1
    }Easy to remember is the name is alwayskey2Value.thanks for the awesome information.
2022-03-24T10:45:46Z
jackyjoy123:philschmid:So theid2labelneeds to have as key theidand as value thestring.And thelabel2idneeds to have as key thestringand as value theid.https://talktosonic.onlhttps://talktowendys.vipid2label = {"0": "goodUser",
    "1": "badUserFraud"
}label2id = {“goodUser”: 0,“badUserFraud”: 1}Easy to remember is the name is always `key2Value` .thanks for the awesome information.thanks my issue has been fixed.
2023-07-12T22:07:33Z
Hi, I have a doubt here.If I have already converted my labels to numbers and want to use the same, should I still create label2id and id2label?I am trying to perform sequence classification in binary and multi-class settings.Any discussion to help me understand this is greatly appreciated.Thanks