|
|
--- |
|
|
license: apache-2.0 |
|
|
--- |
|
|
|
|
|
**INFERENTIA ONLY** |
|
|
|
|
|
Exported with: |
|
|
|
|
|
```python |
|
|
from optimum.neuron import NeuronModelForSentenceTransformers |
|
|
|
|
|
# [Compile] |
|
|
model_id = "sentence-transformers/clip-ViT-B-32" |
|
|
|
|
|
# configs for compiling model |
|
|
input_shapes = { |
|
|
"num_channels": 3, |
|
|
"height": 224, |
|
|
"width": 224, |
|
|
"text_batch_size": 3, |
|
|
"image_batch_size": 1, |
|
|
"sequence_length": 64, |
|
|
} |
|
|
|
|
|
neuron_model = NeuronModelForSentenceTransformers.from_pretrained( |
|
|
model_id, subfolder="0_CLIPModel", export=True, dynamic_batch_size=False, **input_shapes |
|
|
) |
|
|
|
|
|
# Save locally or upload to the HuggingFace Hub |
|
|
save_directory = "clip_emb_neuron/" |
|
|
neuron_model.save_pretrained(save_directory) |
|
|
|
|
|
# Upload to the HuggingFace Hub |
|
|
neuron_model.push_to_hub( |
|
|
"clip_emb_neuron/", repository_id="optimum/clip_vit_emb_neuronx" # Replace with your HF Hub repo id |
|
|
) |
|
|
``` |