Update README.md
Browse files
README.md
CHANGED
|
@@ -6,7 +6,31 @@ tags: []
|
|
| 6 |
# Model Card for Model ID
|
| 7 |
|
| 8 |
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
## Model Details
|
|
|
|
| 6 |
# Model Card for Model ID
|
| 7 |
|
| 8 |
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
+
Code used to generate the model:
|
| 10 |
+
```py
|
| 11 |
+
import torch
|
| 12 |
+
from transformers import HieraForImageClassification, HieraConfig, AutoProcessor
|
| 13 |
+
|
| 14 |
+
# Set seed for reproducibility
|
| 15 |
+
torch.manual_seed(0)
|
| 16 |
+
|
| 17 |
+
# Initializing a Hiera-tiny style configuration
|
| 18 |
+
configuration = HieraConfig(
|
| 19 |
+
embed_dim=8,
|
| 20 |
+
hidden_size=32,
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
# Initializing a model from the Hiera-tiny style configuration
|
| 24 |
+
model = HieraForImageClassification(configuration)
|
| 25 |
+
|
| 26 |
+
# Re-use hiera-tiny processor
|
| 27 |
+
processor = AutoProcessor.from_pretrained("facebook/hiera-tiny-224-hf")
|
| 28 |
+
|
| 29 |
+
# Upload to the HF Hub
|
| 30 |
+
model_id = 'hf-internal-testing/tiny-random-HieraForImageClassification'
|
| 31 |
+
model.push_to_hub(model_id)
|
| 32 |
+
processor.push_to_hub(model_id)
|
| 33 |
+
```
|
| 34 |
|
| 35 |
|
| 36 |
## Model Details
|