Downloads · 30 days
19
12% of all-time downloads
optimum/legal-bert-base-uncased-neuronx
legal-bert-base-uncased-neuronx is a machine learning model from optimum. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as cc-by-sa-4.0.
This repo contains artifacts from nlpaueb/legal-bert-base-uncased but in neuronx format compatible with INF2 and TRN1 devices.
Downloads · 30 days
19
12% of all-time downloads
All-time downloads
165
Public
Repo size
755 MB
Likes
0
Public
Click a slice to open those files.
.neuron262 MB · 100%
From the Hugging Face model README
This repo contains artifacts from nlpaueb/legal-bert-base-uncased but in neuronx format compatible with INF2 and TRN1 devices.
from transformers import AutoTokenizer
from optimum.neuron import NeuronBertForMaskedLM
input_shapes = {"batch_size": 1, "sequence_length": 128}
compiler_args = {"auto_cast": "matmul", "auto_cast_type": "bf16"}
neuron_model = NeuronBertForMaskedLM.from_pretrained(
"nlpaueb/legal-bert-base-uncased",
export=True,
**input_shapes,
**compiler_args,
)
# Save locally
neuron_model.save_pretrained("legal_bert_masked_lm_neuronx")
neuron_model.push_to_hub(
"legal_bert_masked_lm_neuronx",
repository_id="optimum/legal-bert-base-uncased-neuronx", # Replace with your HF Hub repo id
)