Code Monkey home page Code Monkey logo

Comments (3)

mar-muel avatar mar-muel commented on June 17, 2024 1

Hi again!

There was indeed a problem when preparing the model for Huggingface. I have now converted our model into a native PyTorch model, you can now use it like any other model:

from transformers import pipeline
import json

pipe = pipeline(task='fill-mask', model='digitalepidemiologylab/covid-twitter-bert')
out = pipe(f"I think I might have {pipe.tokenizer.mask_token}")
print(json.dumps(out, indent=4))

Which gives me:

[
    {
        "sequence": "[CLS] i think i might have it [SEP]",
        "score": 0.48932939767837524,
        "token": 2009,
        "token_str": "it"
    },
    {
        "sequence": "[CLS] i think i might have. [SEP]",
        "score": 0.14833217859268188,
        "token": 1012,
        "token_str": "."
    },
    {
        "sequence": "[CLS] i think i might have corona [SEP]",
        "score": 0.12335461378097534,
        "token": 21887,
        "token_str": "corona"
    },
    {
        "sequence": "[CLS] i think i might have died [SEP]",
        "score": 0.029644010588526726,
        "token": 2351,
        "token_str": "died"
    },
    {
        "sequence": "[CLS] i think i might have to [SEP]",
        "score": 0.02588510327041149,
        "token": 2000,
        "token_str": "to"
    }
]

Let me know if this works for you! And thanks again for letting us know about this!

from covid-twitter-bert.

mar-muel avatar mar-muel commented on June 17, 2024

Hi ogencoglu! Thanks for bringing this to our attention! I'll look into this within the following days. For now, the way to go is to use the TF models (e.g. through TFHub).

from covid-twitter-bert.

ogencoglu avatar ogencoglu commented on June 17, 2024

Thanks a lot for the fix. I appreciate it!

from covid-twitter-bert.

Related Issues (18)

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.