# define pre-trained model path model_path = "google-bert/bert-base-uncased" # load model tokenizer tokenizer = AutoTokenizer.from_pretrained(model_path) # load model with binary classification head id2label = {0: "Safe", 1: "Not Safe"} label2id = {"Safe": 0, "Not Safe": 1} model = AutoModelForSequenceClassification.from_pretrained(model_path, num_labels=2, id2label=id2label, label2id=label2id,)