bjascob / amrlib

A python library that makes AMR parsing, generation and visualization simple.
MIT License
219 stars 34 forks source link

'Inference' object has no attribute 'generate' #67

Closed SergioSMA closed 5 months ago

SergioSMA commented 5 months ago

I 'm facing some problems while trying to execute gtos models, the error encountered is "Exception has occurred: AttributeError (note: full exception trace is shown but execution is paused at: ) 'Inference' object has no attribute 'generate'"

i've already installed gtos model "model_generate_t5wtense-v0_1_0" and fulfill all requirements

i also found the code line where error took place at amr_view\processor_gtos.py

"def run(self, amr_text): if self.inference is None: return answers, clips = self.inference.generate([amr_text], disable_progress=True) if clips[0]: logger.warning('Graph was clipped')"

bjascob commented 5 months ago

I'm OoO for the next week but you might try going back one version of amrlib. I just re-wrote the gtos code and maybe there is an issue using it inside the viewer. On Apr 5, 2024 3:09 PM, SergioSMA @.***> wrote: I 'm facing some problems while trying to execute gtos models, the error encountered is "Exception has occurred: AttributeError (note: full exception trace is shown but execution is paused at: ) 'Inference' object has no attribute 'generate'" i've already installed gtos model "model_generate_t5wtense-v0_1_0" and fulfill all requirements i also found the code line where error took place at amr_view\processor_gtos.py "def run(self, amr_text): if self.inference is None: return answers, clips = self.inference.generate([amr_text], disable_progress=True) if clips[0]: logger.warning('Graph was clipped')"

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

SergioSMA commented 5 months ago

thank you very much for your prompt reply.

trying with gtos, I have not been able to run it successfully, what was the last stable version of the library ?, i've tried with version 0.7.1 and it does not work either.

I have installed the following GtoS model " { "model_type":"stog", "version":"0.1.0", "date":"2022-02-16", "inference_module":".parse_xfm.inference", "inference_class":"Inference", "model_fn":"pytorch_model.bin", "base_model":"facebook/bart-large", "kwargs":{} }",

do you know if there is another model that I can try ?

we are in touch, thanks anyway, Sergio

bjascob commented 5 months ago

I re-tested things and the code works as expected. I'm not sure what you've got going on that's causing your issue. If you're still having problems, please try running the model from the command line and post the error traceback. An example of how to run it from the command line is on the main README page... https://github.com/bjascob/amrlib?tab=readme-ov-file#library-usage

SergioSMA commented 5 months ago

Hii, i've found the mistake, it was mine certainly as you mentioned, the implementation i was trying about GtoS models was not done it properly. Now it works, thank you so much, Sergio