Skip to content

Failures with UniversalSentimentAnalysis class #405

@saikumaru

Description

@saikumaru

Version
Name: pyabsa
Version: 2.4.1.post1

Name: torch
Version: 2.3.1

Name: transformers
Version: 4.41.2

Describe the bug
Unable to successfully execute predict function for UniversalSentimentAnalysis

example file
pyabsa/tasks/UniversalSentimentAnalysis/trainer/trainer.py

Code To Reproduce

from pyabsa.tasks import UniversalSentimentAnalysis as USA

usa_predictor = USA.USAPredictor(checkpoint="multilingual")

examples = [
    '{"text": "keyboard key fragile .", "labels": [{"aspect": "keyboard", "opinion": "fragile", "polarity": "negative", "category": "KEYBOARD#QUALITY"}]}'
]

inference_results = usa_predictor.predict(examples)

print(inference_results)

while True:
    text = input("Please input your text: ")
    inference_results = usa_predictor.predict(text)
    print(inference_results)

Expected behavior
usa_predictor.predict(examples) should output predicted labels, but errors out

Screenshots
Error

RuntimeError: Fail to load the model from multilingual! Please make sure the version of checkpoint and PyABSA are compatible. Try to remove he checkpoint and download again

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions