Downloads · 30 days
3
6% of all-time downloads
optimum/bert-base-uncased-neuronx-bs1-sq128
bert-base-uncased-neuronx-bs1-sq128 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. The card lists the license as apache-2.0.
Downloads · 30 days
3
6% of all-time downloads
All-time downloads
49
Public
Repo size
225 MB
Likes
0
Public
Click a slice to open those files.
.neuron225 MB · 100%
From the Hugging Face model README
AWS INFERENTIA ONLY
from transformers import AutoTokenizer
from optimum.neuron import NeuronModelForFeatureExtraction
# 1. Export
input_shapes = {"batch_size": 1, "sequence_length": 128}
compiler_args = {"auto_cast": "matmul", "auto_cast_type": "bf16"}
neuron_model = NeuronModelForFeatureExtraction.from_pretrained(
"google-bert/bert-base-uncased",
export=True,
**input_shapes,
**compiler_args,
)
# Save locally
neuron_model.save_pretrained("bert_feature_extraction_neuronx")
neuron_model.push_to_hub(
"bert_feature_extraction_neuronx", repository_id="optimum/bert-base-uncased-neuronx-bs1-sq128" # Replace with your HF Hub repo id
)
# 2. Inference
tokenizer = AutoTokenizer.from_pretrained("optimum/bert-base-uncased-neuronx-bs1-sq128")
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = neuron_model(**inputs)
last_hidden_states = outputs.last_hidden_state