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

Can't execute the example #33

Closed
Garve opened this issue Dec 11, 2020 · 1 comment
Closed

Can't execute the example #33

Garve opened this issue Dec 11, 2020 · 1 comment

Comments

@Garve
Copy link

Garve commented Dec 11, 2020

Hi!

I tried to excute

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

but I only get

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-0cd7d305f4c1> in <module>
----> 1 import aspect_based_sentiment_analysis as absa
      2 
      3 nlp = absa.load()
      4 text = ("We are great fans of Slack, but we wish the subscriptions "
      5         "were more accessible to small startups.")

~\Miniconda3\lib\site-packages\aspect_based_sentiment_analysis\__init__.py in <module>
      2 __version__ = "2.0.1"
      3 
----> 4 from .alignment import tokenize
      5 from .alignment import make_alignment
      6 from .alignment import merge_tensor

~\Miniconda3\lib\site-packages\aspect_based_sentiment_analysis\alignment.py in <module>
      7 import numpy as np
      8 
----> 9 from .data_types import TokenizedExample
     10 
     11 

~\Miniconda3\lib\site-packages\aspect_based_sentiment_analysis\data_types.py in <module>
    159 
    160 
--> 161 @dataclass(frozen=True)
    162 class InputBatch:
    163     """ The model uses these tensors to perform a prediction.

~\Miniconda3\lib\site-packages\aspect_based_sentiment_analysis\data_types.py in InputBatch()
    170     indicate first and second portions of the inputs, zeros
    171     and ones. """
--> 172     token_ids: tf.Tensor
    173     attention_mask: tf.Tensor
    174     token_type_ids: tf.Tensor

AttributeError: module 'tensorflow' has no attribute 'Tensor'

Do I need an older Tensoflow version?

Thank you!

Best regards
Robert

@rolczynski
Copy link
Contributor

Please update to the version 2.0.2 - it should work now 😊

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