Skip to main content

SMaBERTa

This repository contains the code for SMaBERTa, a wrapper for the huggingface transformer libraries. It was developed by Zhanna Terechshenko and Vishakh Padmakumar through research at the Center for Social Media and Politics at NYU.

Setup

To install using pip, run

pip install smaberta

To install from the source, first download the repository by running

git clone https://github.com/SMAPPNYU/SMaBERTa.git

Then, install the dependencies for this repo and setup by running

cd SMaBERTa
pip install -r requirements.txt
python setup.py install

Using the package

Basic use:

from smaberta import TransformerModel

epochs = 3
lr = 4e-6

training_sample = ['Today is a great day', 'Today is a terrible day']
training_labels = [1, 0]

model = TransformerModel('roberta', 'roberta-base', num_labels=25, 'reprocess_input_data': True, "num_train_epochs":epochs, "learning_rate":lr,    
                         'output_dir':'./saved_model/', 'overwrite_output_dir': True, 'fp16':False)

model.train_model(training_sample, training_labels)

For further details, see Tutorial.ipynb in the (examples)[https://github.com/SMAPPNYU/SMaBERTa/tree/master/examples] directory.

Acknowledgements

Code for this project was adapted from version 0.6 of https://github.com/ThilinaRajapakse/simpletransformers

Vishakh Padmakumar and Zhanna Terechshenko contributed to the software writing, implementation, and testing.

Megan Brown contributed to documentation and publication.

Metadata

Release files for smaberta 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smaberta 0.0.2
File Size Uploaded Provenance
smaberta-0.0.2.tar.gz 12.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for smaberta 0.0.2
File Interpreter ABI Platform
smaberta-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.4 kB

Release files / smaberta-0.0.2.tar.gz

Download URL smaberta-0.0.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
57d823a4868de3c638497f9f40c3218a7ec1db903b9ed576d272ae57be8d364b
BLAKE2b-256 checksum
How to use checksums
daef679d5d5b60588ddd9e5d640ce1f9ce79ef945448e25ef19252ebbf1acab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Release files / smaberta-0.0.2-py3-none-any.whl

Download URL smaberta-0.0.2-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9222ae3cdcc998a3880dad0eef5c2d41727949c23d7391bb4a88afd7ad80ea2
BLAKE2b-256 checksum
How to use checksums
8078f1cf7b03a5859b583cf332b3187d7e9430ff7cff5fde7f84ae0a9602faf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Security for smaberta 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page