Views
No views yet
1from optimum.neuron import NeuronCLIPForImageClassification
2
3input_shapes = {"text_batch_size": 2, "sequence_length": 77, "image_batch_size": 1, "num_channels": 3, "width": 224, "height": 224}
4compiler_args = {"auto_cast": "matmul", "auto_cast_type": "bf16"}
5neuron_model = NeuronCLIPForImageClassification.from_pretrained(
6 "openai/clip-vit-base-patch32",
7 export=True,
8 **input_shapes,
9 **compiler_args,
10)
11# Save locally
12neuron_model.save_pretrained("clip_image_classification_neuronx/")
13
14# Upload to the HuggingFace Hub
15neuron_model.push_to_hub(
16 "clip_image_classification_neuronx/", repository_id="optimum/clip-vit-base-patch32-image-classification-neuronx" # Replace with your HF Hub repo id
17)