BERT
Collection
BERT models of varying flavors • 22 items • Updated
# Load model directly
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("Intel/bert-base-uncased-sparse-70-unstructured")
model = AutoModelForMaskedLM.from_pretrained("Intel/bert-base-uncased-sparse-70-unstructured")Pretrained model pruned to 70% sparsity. The model is a pruned version of the BERT base model.
The model can be used for fine-tuning to downstream tasks with sparsity already embeded to the model. To keep the sparsity a mask should be added to each sparse weight blocking the optimizer from updating the zeros.
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="Intel/bert-base-uncased-sparse-70-unstructured")