StackOverflowNER icon indicating copy to clipboard operation
StackOverflowNER copied to clipboard

The results are random

Open namelucky opened this issue 3 years ago • 5 comments

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

import torch
from transformers import AutoModelForTokenClassification, AutoTokenizer
pretrained_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.logits
predictions = torch.argmax(outputs, dim=2)
for token, prediction in zip(tokens, predictions[0].numpy()):
     print((token, model.config.id2label[prediction]))

image

namelucky avatar Oct 10 '22 08:10 namelucky

@namelucky Hi! I've tried to get the utils_fine_tune.zip and the data_ctc.zip from the link: https://drive.google.com/drive/folders/1iEEMr2DYofulK2F5pSErOPf5ggrEqtJt?usp=sharing. But I didn't find any other file in this website except for word_piece_ner and word_piece_seg. Maybe I didn't figured out the usage of the files in this link.Could you share a copy of these files with me?My email adress is [email protected]; Thank you very much! 捕获

jiabo-code1 avatar Nov 15 '22 12:11 jiabo-code1

@namelucky @KhaZix7 hello,namelucky,KhaZix7.I am trying to get the utils_fine_tune.zip and the data_ctc.zip too, and it seems that all the link is not avaliable,can anyone share a copy?thank you so much. My email address is [email protected]

zhangdanni1129 avatar Nov 29 '22 08:11 zhangdanni1129

@KhaZix7 @zhangdanni1129 I have uploaded a copy of the files to https://huggingface.co/itisphilippe/StackOverflowNER

philippeitis avatar Dec 01 '22 02:12 philippeitis

@KhaZix7 @zhangdanni1129 I have uploaded a copy of the files to https://huggingface.co/itisphilippe/StackOverflowNER

Thank you soooooo much!

zhangdanni1129 avatar Dec 03 '22 13:12 zhangdanni1129

Hi, @namelucky it looks like you downloaded pre-trained model, but without classifier's weights. I have the same problem, when I run code. The website HuggingFace displays, that this model belongs to the category "Feature Extraction". @jeniyat could you please share weights for classifier head too?

ivankot88 avatar Jan 17 '23 15:01 ivankot88