GithubHelp home page GithubHelp logo

Comments (5)

HHousen avatar HHousen commented on May 23, 2024 1

The fix to solve this problem is now in the documentation.

from transformersum.

slvcsl avatar slvcsl commented on May 23, 2024 1

Thanks, it does work perfectly!

from transformersum.

HHousen avatar HHousen commented on May 23, 2024

Hi. It seems like my latest changes to the documentation did not build correctly so the information about this issue was not visible. To solve this issue please see this page, which will be on the ReadTheDocs documentation very soon. Essentially, set strict=False like so: model = ExtractiveSummarizer.load_from_checkpoint("distilroberta-base-ext-sum.ckpt", strict=False) and that should solve it.

from transformersum.

slvcsl avatar slvcsl commented on May 23, 2024

Hi @HHousen! Thanks for your quick reply.
Now the model loads fine.

However, when I try to summarize a string, using

from extractive import ExtractiveSummarizer
model = ExtractiveSummarizer.load_from_checkpoint("my/path", strict=False) #ok
source = "This is just a try. Let's see if it works"
summary = model.predict(source)

I get:

C:\Users\silvia\Anaconda3\envs\TransformerSum\lib\site-packages\pytorch_lightning\core\saving.py:205: UserWarning: Found keys that are in the model state dict but not in the checkpoint: ['word_embedding_model.embeddings.position_ids']
rank_zero_warn(
Traceback (most recent call last):
File "C:\Users\silvia\Desktop\transformersum\prova.py", line 7, in
summary = model.predict(source)
File "C:\Users\silvia\Desktop\transformersum.\src\extractive.py", line 1177, in predict
nlp.add_pipe(sentencizer)
File "C:\Users\silvia\Anaconda3\envs\TransformerSum\lib\site-packages\spacy\language.py", line 758, in add_pipe
raise ValueError(err)
ValueError: [E966] nlp.add_pipe now takes the string name of the registered component factory, not a callable component. Expected string, but got <spacy.pipeline.sentencizer.Sentencizer object at 0x000001B26E43A240> (name: 'None').

  • If you created your component with nlp.create_pipe('name'): remove nlp.create_pipe and call nlp.add_pipe('name') instead.

  • If you passed in a component like TextCategorizer(): call nlp.add_pipe with the string name instead, e.g. nlp.add_pipe('textcat').

  • If you're using a custom component: Add the decorator @Language.component (for function components) or @Language.factory (for class components / factories) to your custom component and assign it a name, e.g. @Language.component('your_name'). You can then run nlp.add_pipe('your_name') to add it to the pipeline.

Process finished with exit code 1

from transformersum.

HHousen avatar HHousen commented on May 23, 2024

Try opening the extractive.py file and changing line 1177 from nlp.add_pipe(sentencizer) to nlp.add_pipe("sentencizer"). Then, delete the previous line (line 1176). If this works I will merge this change to the master branch.

from transformersum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.