Coba ieu tinimbang: ngimpor torch ti transformator ngimpor BertTokenizer, BertModel # Load the BERT tokenizer tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') # Encode a text input input_ids = torch.tensor(tokenizer.encode("Hello, my dog is cute", add_special_tokens=True)).unsqueeze(0) # Batch size 1 # Load the BERT model model = BertModel.from_pretrained'bert-base-uncased') # Set the model in evaluation model.((eval) # Predict hidden features for each layer with torch.no_grad): output = modelin_output_states(((puts =[0] # the last-state output is the first output of the last output element
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence