|
--- |
|
license: apache-2.0 |
|
--- |
|
|
|
**INFERENTIA ONLY** |
|
|
|
```py |
|
from optimum.neuron import NeuronCLIPForImageClassification |
|
|
|
input_shapes = {"text_batch_size": 2, "sequence_length": 77, "image_batch_size": 1, "num_channels": 3, "width": 224, "height": 224} |
|
compiler_args = {"auto_cast": "matmul", "auto_cast_type": "bf16"} |
|
neuron_model = NeuronCLIPForImageClassification.from_pretrained( |
|
"openai/clip-vit-base-patch32", |
|
export=True, |
|
**input_shapes, |
|
**compiler_args, |
|
) |
|
# Save locally |
|
neuron_model.save_pretrained("clip_image_classification_neuronx/") |
|
|
|
# Upload to the HuggingFace Hub |
|
neuron_model.push_to_hub( |
|
"clip_image_classification_neuronx/", repository_id="optimum/clip-vit-base-patch32-image-classification-neuronx" # Replace with your HF Hub repo id |
|
) |
|
``` |