File size: 775 Bytes
7821a9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
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
)
```