Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to get the right response for relation extraction task (DDI Drug Drug Interatcion) #107

Open
MathewKevin opened this issue Jul 14, 2023 · 0 comments

Comments

@MathewKevin
Copy link

Hi team,

I'm using the pretrained model for DDI and trying to do relation extraction for the below abstract from Pubmed, I'm getting the output as same as the input text which is the abstract itself, instead I need to get the right response: the interaction between plenaxis and testosterone is mechanism.

import torch
from src.transformer_lm_prompt import TransformerLanguageModelPrompt
pubmed_abstract = 'No formal drug/drug interaction studies with Plenaxis were performed. Cytochrome P-450 is not known to be involved in the metabolism of Plenaxis. Plenaxis is highly bound to plasma proteins (96 to 99%). Laboratory Tests Response to Plenaxis should be monitored by measuring serum total testosterone concentrations just prior to administration on Day 29 and every 8 weeks thereafter. Serum transaminase levels should be obtained before starting treatment with Plenaxis and periodically during treatment. Periodic measurement of serum PSA levels may also be considered.'

m = TransformerLanguageModelPrompt.from_pretrained(
        "checkpoints/RE-DDI-BioGPT", 
        "checkpoint_avg.pt", 
        "data/DDI/relis-bin",
        tokenizer='moses', 
        bpe='fastbpe', 
        bpe_codes="data/bpecodes",
        max_len_b=1024,
        beam=1)
m.cuda()
src_text=pubmed_abstract # input text, e.g., a PubMed abstract
src_tokens = m.encode(src_text)
generate = m.generate([src_tokens], beam=5)[0]
output = m.decode(generate[0]["tokens"])
print(output)

'No formal drug/drug interaction studies with Plenaxis were performed. Cytochrome P-450 is not known to be involved in the metabolism of Plenaxis. Plenaxis is highly bound to plasma proteins (96 to 99%). Laboratory Tests Response to Plenaxis should be monitored by measuring serum total testosterone concentrations just prior to administration on Day 29 and every 8 weeks thereafter. Serum transaminase levels should be obtained before starting treatment with Plenaxis and periodically during treatment. Periodic measurement of serum PSA levels may also be considered.'

The correct response should be: the interaction between plenaxis and testosterone is mechanism. . How do I get it? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant