Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
**INFERENTIA ONLY**
|
| 6 |
+
|
| 7 |
+
```py
|
| 8 |
+
from optimum.neuron import NeuronCLIPForImageClassification
|
| 9 |
+
|
| 10 |
+
input_shapes = {"text_batch_size": 2, "sequence_length": 77, "image_batch_size": 1, "num_channels": 3, "width": 224, "height": 224}
|
| 11 |
+
compiler_args = {"auto_cast": "matmul", "auto_cast_type": "bf16"}
|
| 12 |
+
neuron_model = NeuronCLIPForImageClassification.from_pretrained(
|
| 13 |
+
"openai/clip-vit-base-patch32",
|
| 14 |
+
export=True,
|
| 15 |
+
**input_shapes,
|
| 16 |
+
**compiler_args,
|
| 17 |
+
)
|
| 18 |
+
# Save locally
|
| 19 |
+
neuron_model.save_pretrained("clip_image_classification_neuronx/")
|
| 20 |
+
|
| 21 |
+
# Upload to the HuggingFace Hub
|
| 22 |
+
neuron_model.push_to_hub(
|
| 23 |
+
"clip_image_classification_neuronx/", repository_id="optimum/clip-vit-base-patch32-image-classification-neuronx" # Replace with your HF Hub repo id
|
| 24 |
+
)
|
| 25 |
+
```
|