a wrapper for the huggingface transformer libraries
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file smaberta-0.0.2.tar.gz
.
File metadata
- Download URL: smaberta-0.0.2.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57d823a4868de3c638497f9f40c3218a7ec1db903b9ed576d272ae57be8d364b |
|
MD5 | 29dab6f2628d219752fdffab38dc7ffb |
|
BLAKE2b-256 | daef679d5d5b60588ddd9e5d640ce1f9ce79ef945448e25ef19252ebbf1acab2 |
File details
Details for the file smaberta-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: smaberta-0.0.2-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9222ae3cdcc998a3880dad0eef5c2d41727949c23d7391bb4a88afd7ad80ea2 |
|
MD5 | 5d6dad810eb705488a2f720005e1481a |
|
BLAKE2b-256 | 8078f1cf7b03a5859b583cf332b3187d7e9430ff7cff5fde7f84ae0a9602faf2 |