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

Getting error from professor file! #69

Open
Seyedhosseinzadeh opened this issue May 21, 2022 · 1 comment
Open

Getting error from professor file! #69

Seyedhosseinzadeh opened this issue May 21, 2022 · 1 comment

Comments

@Seyedhosseinzadeh
Copy link

Seyedhosseinzadeh commented May 21, 2022

I run this sample:

import aspect_based_sentiment_analysis as absa
name = 'absa/classifier-rest-0.2'
model = absa.BertABSClassifier.from_pretrained(name)
tokenizer = BertTokenizer.from_pretrained(name)
professor = absa.Professor(...) # Explained in detail later on.
text_splitter = absa.sentencizer() # The English CNN model from SpaCy.
nlp = absa.Pipeline(model, tokenizer, professor, text_splitter)

task = nlp.preprocess(text="We are great fans of Slack", aspects=['slack'])
tokenized_examples = nlp.tokenize(task.examples)
input_batch = nlp.encode(tokenized_examples)
output_batch = nlp.predict(input_batch)
predictions = nlp.review(tokenized_examples, output_batch)
completed_task = nlp.postprocess(task, predictions)

but actually I got error in this line :
completed_task = nlp.postprocess(task, predictions)

details:
41
42 is_reference = self.reference_recognizer(example, output)
---> 43 if self.reference_recognizer else None
44 patterns = self.pattern_recognizer(example, output)
45 if self.pattern_recognizer and is_reference is not False else None

TypeError: 'ellipsis' object is not callable

could you help to solve the issue?

@abaveja313
Copy link

abaveja313 commented Jan 1, 2023

This is an old issue, so I'm not sure how helpful my comment is, but the elipsis, although a valid token in python, were merely meant as placeholders for actual code. Try something like this:

import transformers

name = 'absa/classifier-rest-0.2'
reference_recognizer = absa.aux_models.BasicReferenceRecognizer.from_pretrained('absa/basic_reference_recognizer-rest-0.1')
professor = absa.Professor(reference_recognizer=reference_recognizer)
model = absa.BertABSClassifier.from_pretrained(name)
tokenizer = transformers.BertTokenizer.from_pretrained(name)
text_splitter = absa.sentencizer()  # The English CNN model from SpaCy.
nlp = absa.Pipeline(model, tokenizer, professor, text_splitter) 

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