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 with basic first code #70

Open
theoflaus opened this issue Nov 26, 2022 · 6 comments
Open

Getting error with basic first code #70

theoflaus opened this issue Nov 26, 2022 · 6 comments

Comments

@theoflaus
Copy link

Hi, I tried only the first lines of code that were :

import aspect_based_sentiment_analysis as absa

nlp = absa.load()
text = ("We are great fans of Slack, but we wish the subscriptions "
        "were more accessible to small startups.")

slack, price = nlp(text, aspects=['slack', 'price'])
assert price.sentiment == absa.Sentiment.negative
assert slack.sentiment == absa.Sentiment.positive

and got the following error :

Traceback (most recent call last):
File "test_absa.py", line 3, in
nlp = absa.load()
File "C:\Users\theo.flaus\Anaconda3\envs\test\lib\site-packages\aspect_based_sentiment_analysis\loads.py", line 34, in load
model = BertABSClassifier.from_pretrained(name, config=config)
File "C:\Users\theo.flaus\Anaconda3\envs\test\lib\site-packages\transformers\modeling_tf_utils.py", line 2699, in from_pretrained
model(model.dummy_inputs) # build the network with dummy inputs
File "C:\Users\theo.flaus\Anaconda3\envs\test\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\theo.flaus\Anaconda3\envs\test\lib\site-packages\aspect_based_sentiment_analysis\models.py", line 141, in call
outputs = self.bert(
ValueError: Exception encountered when calling layer "bert_abs_classifier" (type BertABSClassifier).
The first argument to Layer.call must always be passed.

Call arguments received by layer "bert_abs_classifier" (type BertABSClassifier):
• token_ids={'input_ids': 'tf.Tensor(shape=(3, 5), dtype=int32)'}
• attention_mask=None
• token_type_ids=None
• training=False
• bert_kwargs=<class 'inspect._empty'>

Any idea how to solve this ?

@klawicka
Copy link

Same here, any solutions?

@octokami
Copy link

octokami commented Feb 6, 2023

I got the same error. For me it was solved when I installed from the environment.yml. My problem in specific is that I had Python >3.7

@VedantNemane
Copy link

VedantNemane commented Mar 28, 2023

A bit late, but can confirm (at least for me) changing Python version immediately fixed the issue.

To create a new virtual environment with Python version 3.6 in Jupyter Notebook, take a look at this.

This is what it looks like for me:
image

@sudip-modi
Copy link

I am unable to install python version 3.6 on jupyter notebook colab. I get an error like this
image
Any ideas why this might be the case?
@VedantNemane

@morinstar
Copy link

@VedantNemane I installed 3.6.13 venv on pycharm and that can deal with the installation at least. btw 3.6.8 and 3.6.10 didn't help installing this package. Thanks for the guide!

@gyanendrarawat
Copy link

for me error is :
RecursionError: maximum recursion depth exceeded in instancecheck

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

7 participants