-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hi,
Thanks for your great contribution in biomedical domain.
I tried all the models in the hugging face format and I couldn't replicate any of the results or even get a reasonable output. Is there something wrong with the code, model, or anything is missing?
I run the following code:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("razent/SciFive-base-PMC")
model = AutoModelForSeq2SeqLM.from_pretrained("razent/SciFive-base-PMC")
model.to(device)
sentence = "Identification of APC2 , a homologue of the adenomatous polyposis coli tumour suppressor ."
text = "ncbi_ner: " + sentence + " </s>"
encoding = tokenizer.encode_plus(text, pad_to_max_length=True, return_tensors="pt")
input_ids, attention_masks = encoding["input_ids"].to(device), encoding["attention_mask"].to(device)
outputs = model.generate(
input_ids=input_ids, attention_mask=attention_masks,
max_length=256,
early_stopping=True
)
for output in outputs:
line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
print(line)
And this is the output:
ncbi_ner: ncbi_ner: ncbi_ner:
The expected output (based on the paper) should be as follow:
Identification of APC2 , a homologue of the entity* adenomatous polyposis coli tumour *entity suppressor .
I replaced the model with all other available large, base, pubmed, pmc, pubmed+pmc models (basically all 6 hugging face variations) but I didn't get any reasonable outputs.
Could you give me a solution?
uyaseen, NouamaneTazi, AhmedIdr, yangxia605, mobashgr and 1 more
Metadata
Metadata
Assignees
Labels
No labels