Instructions to use kd13/Modern-MobileNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kd13/Modern-MobileNet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="kd13/Modern-MobileNet", trust_remote_code=True) pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoModelForImageClassification model = AutoModelForImageClassification.from_pretrained("kd13/Modern-MobileNet", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update configuration_mobilenet.py
Browse files
configuration_mobilenet.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from transformers import PretrainedConfig
|
| 2 |
|
| 3 |
class MobileNetV1Config(PretrainedConfig):
|
| 4 |
-
model_type = "
|
| 5 |
|
| 6 |
def __init__(
|
| 7 |
self,
|
|
@@ -13,12 +13,5 @@ class MobileNetV1Config(PretrainedConfig):
|
|
| 13 |
self.num_classes = num_classes
|
| 14 |
self.block_dropout = block_dropout
|
| 15 |
self.final_dropout = final_dropout
|
| 16 |
-
|
| 17 |
-
# This mapping allows AutoModel to find the code when pushed to the Hub
|
| 18 |
-
if "auto_map" not in kwargs:
|
| 19 |
-
kwargs["auto_map"] = {
|
| 20 |
-
"AutoConfig": "configuration_mobilenet.MobileNetV1Config",
|
| 21 |
-
"AutoModelForImageClassification": "modeling_mobilenet.MobileNetV1ForImageClassification"
|
| 22 |
-
}
|
| 23 |
|
| 24 |
-
super().__init__(**kwargs)
|
|
|
|
| 1 |
from transformers import PretrainedConfig
|
| 2 |
|
| 3 |
class MobileNetV1Config(PretrainedConfig):
|
| 4 |
+
model_type = "mobilenet_custom"
|
| 5 |
|
| 6 |
def __init__(
|
| 7 |
self,
|
|
|
|
| 13 |
self.num_classes = num_classes
|
| 14 |
self.block_dropout = block_dropout
|
| 15 |
self.final_dropout = final_dropout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
super().__init__(**kwargs)
|