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

Correction of the sample codes in README.md #14

Closed
sefeoglu opened this issue Apr 4, 2022 · 3 comments
Closed

Correction of the sample codes in README.md #14

sefeoglu opened this issue Apr 4, 2022 · 3 comments

Comments

@sefeoglu
Copy link

sefeoglu commented Apr 4, 2022

Hello,
There are some mistakes in your code samples in the README.

  1. There is a mistake in the line of the REBEL example code below:
extracted_text = triplet_extractor.tokenizer.batch_decode(triplet_extractor("Punta Cana is a resort town in the municipality of Higuey, in La Altagracia Province, the eastern most province of the Dominican Republic", return_tensors=True, return_text=False)[0]["generated_token_ids"]["output_ids"])

The code line below gives : TypeError: 'list' object cannot be interpreted as an integer:
It should be like :

extracted_text = triplet_extractor.tokenizer.batch_decode(triplet_extractor("Punta Cana is a resort town in the municipality of Higuey, in La Altagracia Province, the eastern most province of the Dominican Republic", return_tensors=True, return_text=False)[0]["generated_token_ids"]["output_ids"][0])
  1. The second mistake is in the spaCy example:
    The line below gives the TypeError: add_pipe() got an unexpected keyword argument 'config'
nlp.add_pipe("rebel", after="senter", config={
    'device':0, # Number of the GPU, -1 if want to use CPU
    'model_name':'Babelscape/rebel-large'} # Model used, will default to 'Babelscape/rebel-large' if not given
    )

Could you correct your samples in the Readme?
Thanks in advance.
Bests,

@LittlePea13
Copy link
Collaborator

Hi @sefeoglu thanks for bringing these two issues.

The first one has to do with a change on the transformers library, there is some inconsistency between the version in the requirements with the actual version of the library. I will try to update the requirements to a more recent transformers version and make sure that the code on the readme/repo works with it.

Regarding the second problem, I believe it comes from your end. Do you have an updated version of spaCy? I have no issues running the spaCy script with the latest version. Perhaps you can give me a bit more info in which version you are using.

@sefeoglu
Copy link
Author

sefeoglu commented Apr 4, 2022

Thanks for your reply.
The second one was coming from my spaCy version.

@LittlePea13
Copy link
Collaborator

Fixed the first issue in the latest commit. It was due a change in the output of the pipeline component.

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

2 participants