I downloaded the pretrained model you provided and loaded it.(https : //drive.google.com/drive/folders/1iEEMr2DYofulK2F5pSErOPf5ggrEqtJt?usp=sharing) Why is the result random?
importtorchfromtransformersimportAutoModelForTokenClassification, AutoTokenizerpretrained_model='./utils_fine_tune/word_piece_ner/'tokenizer=AutoTokenizer.from_pretrained(pretrained_model)
model=AutoModelForTokenClassification.from_pretrained(pretrained_model)
sequence=" Is there any mechanism to enforce a singleton policy without having to make the derived class' constructors private manually?"print(tokenizer.decode(tokenizer.encode(sequence)))
tokens=tokenizer.tokenize(tokenizer.decode(tokenizer.encode(sequence)))
inputs=tokenizer.encode(sequence, return_tensors="pt")
outputs=model(inputs)
outputs=outputs.logitspredictions=torch.argmax(outputs, dim=2)
fortoken, predictioninzip(tokens, predictions[0].numpy()):
print((token, model.config.id2label[prediction]))

I downloaded the pretrained model you provided and loaded it.(https : //drive.google.com/drive/folders/1iEEMr2DYofulK2F5pSErOPf5ggrEqtJt?usp=sharing) Why is the result random?