Text Classification
Transformers
English
bert
minbert
transformer
sentiment
tokenizer
classification
Instructions to use GlowCheese/minBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GlowCheese/minBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="GlowCheese/minBERT")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("GlowCheese/minBERT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| from everything import * | |
| from bert import BertModel | |
| def get_finetuned_bert(mode: str): | |
| assert mode in ['sup', 'unsup'] | |
| bert = BertModel.from_pretrained('bert-base-uncased') | |
| if mode == 'sup': | |
| state_dict = torch.load(SUP_BERT, weights_only=True) | |
| else: | |
| state_dict = torch.load(UNSUP_BERT, weights_only=True) | |
| device = torch.device('cuda') if USE_GPU else torch.device('cpu') | |
| bert.load_state_dict(state_dict) | |
| return bert.to(device) | |