Instructions to use not-lain/MyRepo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use not-lain/MyRepo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="not-lain/MyRepo", 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("not-lain/MyRepo", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Upload config
Browse files- MyConfig.py +17 -0
- config.json +9 -0
MyConfig.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from transformers import PretrainedConfig
|
| 3 |
+
from typing import List
|
| 4 |
+
|
| 5 |
+
class MnistConfig(PretrainedConfig):
|
| 6 |
+
# since we have an image classification task
|
| 7 |
+
# we need to put a model type that is close to our task
|
| 8 |
+
# don't worry this will not affect our model
|
| 9 |
+
model_type = "MobileNetV1"
|
| 10 |
+
def __init__(
|
| 11 |
+
self,
|
| 12 |
+
conv1=10,
|
| 13 |
+
conv2=20,
|
| 14 |
+
**kwargs):
|
| 15 |
+
self.conv1 = conv1
|
| 16 |
+
self.conv2 = conv2
|
| 17 |
+
super().__init__(**kwargs)
|
config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoConfig": "MyConfig.MnistConfig"
|
| 4 |
+
},
|
| 5 |
+
"conv1": 10,
|
| 6 |
+
"conv2": 20,
|
| 7 |
+
"model_type": "MobileNetV1",
|
| 8 |
+
"transformers_version": "4.35.2"
|
| 9 |
+
}
|