AMRBART icon indicating copy to clipboard operation
AMRBART copied to clipboard

input for huggingface AMRBART - AMR2Text

Open tingchihc opened this issue 1 year ago • 7 comments

Hi,

I am very happy to see the pre-trained model in huggingface. I have a little question about AMRBART(AMR2Text) what is the input for this? does that mean we still need to follow AMR-process?

thanks,

tingchihc avatar Oct 31 '23 02:10 tingchihc

Yes, you need to follow AMR-process to linearize AMRs before feeding them into AMRBART-AMR2Text.

goodbai-nlp avatar Oct 31 '23 02:10 goodbai-nlp

ok thanks

tingchihc avatar Oct 31 '23 03:10 tingchihc

I want to use the hugging face AMR2text pre-trained model. This is my code.

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
from model_interface.tokenization_bart import AMRBartTokenizer
import torch
from transformers import pipeline

pipe = pipeline("text2text-generation", model="xfbai/AMRBART-large-finetuned-AMR2.0-AMR2Text-v2", tokenizer= AMRBartTokenizer.from_pretrained("xfbai/AMRBART-large-finetuned-AMR2.0-AMR2Text-v2"))
text = "( <pointer:0> date-entity :month 9 :day 11 :year 2010 )"
ans = pipe(text)
print(ans)

the text is your example input data. However, the results look weird. The results is [{'generated_text': ' ( <pointer:0> date-entity :month 9 :day 11 : year 2010'}]

what's the problem in here?

tingchihc avatar Oct 31 '23 15:10 tingchihc

Hi, @ting-chih

Our code does not support transformer pipeline, you can try inference-text.sh to generate text from AMR graphs.

goodbai-nlp avatar Nov 02 '23 03:11 goodbai-nlp

Maybe it's related this issue, for the huggingface inference api, the following error comes up:

Link: https://huggingface.co/xfbai/AMRBART-base?text=test

image

Would it be possible to fix, for allowing access through api?

flipz357 avatar Jan 25 '24 13:01 flipz357

Hi, @flipz357

AMRBART does not support the huggingface inference api as we have modified the tokenizer and input format. You can follow the instructions here to inference on your own data, so that the quailty can be ensured.

goodbai-nlp avatar Jan 26 '24 02:01 goodbai-nlp

I see, Thank you @goodbai-nlp!

flipz357 avatar Jan 26 '24 08:01 flipz357