Giter Club home page Giter Club logo

Comments (5)

monologg avatar monologg commented on July 19, 2024

https://huggingface.co/monologg/bert-base-cased-goemotions-ekman
https://huggingface.co/monologg/bert-base-cased-goemotions-group
https://huggingface.co/monologg/bert-base-cased-goemotions-original

Please see List all files in model in pages above.

from goemotions-pytorch.

Saumajit avatar Saumajit commented on July 19, 2024

I tried to download all the files and use it for prediction as shown in your github readme. It is showing me
UnicodeDecodeError : 'utf-8' codec can't decode byte : invalid continuation byte. Please let me know how to fix this.

from goemotions-pytorch.

monologg avatar monologg commented on July 19, 2024

I tried to download all the files and use it for prediction as shown in your github readme. It is showing me
UnicodeDecodeError : 'utf-8' codec can't decode byte : invalid continuation byte. Please let me know how to fix this.

First of all, you don't have to download the files manually. If you run the code below, all the files will be downloaded automatically from huggingface s3

from transformers import BertTokenizer
from model import BertForMultiLabelClassification
from multilabel_pipeline import MultiLabelPipeline
from pprint import pprint

tokenizer = BertTokenizer.from_pretrained("monologg/bert-base-cased-goemotions-original")
model = BertForMultiLabelClassification.from_pretrained("monologg/bert-base-cased-goemotions-original")

goemotions = MultiLabelPipeline(
    model=model,
    tokenizer=tokenizer,
    threshold=0.3
)

texts = [
    "Hey that's a thought! Maybe we need [NAME] to be the celebrity vaccine endorsement!",
    "it’s happened before?! love my hometown of beautiful new ken πŸ˜‚πŸ˜‚",
    "I love you, brother.",
    "Troll, bro. They know they're saying stupid shit. The motherfucker does nothing but stink up libertarian subs talking shit",
]

pprint(goemotions(texts))

Plz run this code and write all the logs you got:)

from goemotions-pytorch.

Saumajit avatar Saumajit commented on July 19, 2024

from goemotions-pytorch.

monologg avatar monologg commented on July 19, 2024

I can't infer the reason only based on the one line of the log that you gave. (UnicodeDecodeError : 'utf-8' codec can't decode byte : invalid continuation byte)

You should give all the log from console.

What I can only guess is that you might not save the file (vocab.txt etc) in utf-8 format.

Can you check the encoding of the files?

from goemotions-pytorch.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.