lazarinastoy / meta-descriptions-BERT

If you want a quick and dirty way to programmatically meta descriptions at scale using Python, this is the tutorial for you. Jupyter notebook, as well as a step-by-step process included.
18 stars 7 forks source link

Unexpected keyword argument 'max_length' #2

Open nybergan opened 2 years ago

nybergan commented 2 years ago

This code works well until the very end, when I always get this error:

TypeError                                 Traceback (most recent call last)
<ipython-input-18-e5ad83648d1f> in <module>()
      1 # BERT
      2 model = Summarizers()
----> 3 result = model(body, max_length=160)
      4 full = ''.join(result)
      5 print(full)

/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs)
     25         def decorate_context(*args, **kwargs):
     26             with self.clone():
---> 27                 return func(*args, **kwargs)
     28         return cast(F, decorate_context)
     29 

TypeError: __call__() got an unexpected keyword argument 'max_length'

What does it mean and how can I fix it?

lazarinastoy commented 2 years ago

Could it be because of this? Summarizers() instead of Summarizer().

Refer to these docs: https://pypi.org/project/bert-extractive-summarizer/

[image: image.png]

On Wed, 15 Jun 2022 at 16:33, nybergan @.***> wrote:

This code works well until the very end, when I always get this error:

TypeError Traceback (most recent call last)

in () 1 # BERT 2 model = Summarizers() ----> 3 result = model(body, max_length=160) 4 full = ''.join(result) 5 print(full) /usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs) 25 def decorate_context(*args, **kwargs): 26 with self.clone(): ---> 27 return func(*args, **kwargs) 28 return cast(F, decorate_context) 29 TypeError: __call__() got an unexpected keyword argument 'max_length' What does it mean and how can I fix it? — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
nybergan commented 2 years ago

I change it but I still get an error. Now I get:

`--------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () 1 # BERT 2 model = Summarizer() ----> 3 result = model(body, max_length=160) 4 full = ''.join(result) 5 print(full)

TypeError: 'Summarizer' object is not callable`