Coder Social home page Coder Social logo

sngp-bert-pytorch's Introduction

🔥 SNGP-BERT (Unofficial) 🔥

This is reimplementation of "Simple and Principled Uncertainty Estimation with Deterministic Deep Learning via Distance Awareness" in Pytorch.

The codes are based on official repo (Tensorflow) and huggingface.

Original Paper : Link

Installation ☕

Training environment : Ubuntu 18.04, python 3.6

pip3 install torch torchvision torchaudio
pip install scikit-learn

Download bert-base-uncased checkpoint from hugginface-ckpt
Download bert-base-uncased vocab file from hugginface-vocab
Download CLINC OOS intent detection benchmark dataset from tensorflow-dataset

The downloaded files' directory should be:

SNGP-BERT
ㄴckpt
  ㄴbert-base-uncased-pytorch_model.bin
ㄴdataset
  ㄴclinc_oos
    ㄴtrain.csv
    ㄴval.csv
    ㄴtest.csv
    ㄴtest_ood.csv
  ㄴvocab
    ㄴbert-base-uncased-vocab.txt
ㄴmodels
...

Dataset Info 📖

In their paper, the authors conducted OOD experiment for NLP using CLINC OOS intent detection benchmark dataset, the OOS dataset contains data for 150 in-domain services with 150 training sentences in each domain, and also 1500 natural out-of-domain utterances. You can download the dataset at Link.

Original dataset paper, and Github : Paper Link, Git Link

Run 🌟

Train

python main.py --train_or_test train --method sngp --device gpu --gpu 0

Test

python main.py --train_or_test test --method sngp --device gpu --gpu 0

Results ✨

Results for SNGP-BERT on CLINC OOS.
NOTE : Depending on the random seed, the result may be slightly different.

Version ACC AUROC AUPRC
Paper (Tensorflow) 96.6 0.969 0.880
Pytorch (batch size = 256) 96.1 0.974 0.900
Pytorch (batch size = 64) 95.9 0.972 0.894

References

[1] https://github.com/google/uncertainty-baselines/blob/main/baselines/clinc_intent/sngp.py
[2] https://huggingface.co/
[3] https://github.com/google/edward2

sngp-bert-pytorch's People

Contributors

jaeyoung5257 avatar kimjeyoung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sngp-bert-pytorch's Issues

Non-symmetrical gp_cov_matrix returned

Hi,

Thank you for all the work on porting this to PyTorch. I'm running into a bit of an issue however. When using this for BERT for span-extractive question answering I am getting a covariance matrix that is not symmetrical, and thus not a valid covariance matrix.

Any ideas what is happening or if I am forgetting something?

Thanks!

License of this repository

Hi, I have a simple question. What is the license of this repository?
I can't find any information about that.

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.