Instructions to use litert-community/convnext_tiny with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/convnext_tiny with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Update validated TorchVision exports and compatibility documentation
Browse filesPublish the reviewed model files and current CPU/GPU/NPU compatibility table.
- README.md +15 -6
- convnext_tiny.tflite +2 -2
- convnext_tiny_int8_channelwise.tflite +3 -0
README.md
CHANGED
|
@@ -42,6 +42,15 @@ acc@5 (on ImageNet-1K): 96.146%
|
|
| 42 |
num_params: 28589128
|
| 43 |
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
## Intended uses & limitations
|
| 46 |
|
| 47 |
The model files were converted from pretrained weights from PyTorch Vision. The models may have their own licenses or terms and conditions derived from PyTorch Vision and the dataset used for training. It is your responsibility to determine whether you have permission to use the models for your use case.
|
|
@@ -79,25 +88,25 @@ def preprocess(img: Image.Image) -> np.ndarray:
|
|
| 79 |
w, h = img.size
|
| 80 |
s = 236
|
| 81 |
if w < h:
|
| 82 |
-
img = img.resize((s, int(
|
| 83 |
else:
|
| 84 |
-
img = img.resize((int(
|
| 85 |
-
left = (img.size[0] - 224) /
|
| 86 |
-
top = (img.size[1] - 224) /
|
| 87 |
img = img.crop((left, top, left + 224, top + 224))
|
| 88 |
|
| 89 |
x = np.asarray(img, dtype=np.float32) / 255.0
|
| 90 |
x = (x - np.array([0.485, 0.456, 0.406], dtype=np.float32)) / np.array(
|
| 91 |
[0.229, 0.224, 0.225], dtype=np.float32
|
| 92 |
)
|
| 93 |
-
return np.
|
| 94 |
|
| 95 |
def main():
|
| 96 |
ap = argparse.ArgumentParser()
|
| 97 |
ap.add_argument("--image", required=True)
|
| 98 |
args = ap.parse_args()
|
| 99 |
|
| 100 |
-
model_path = hf_hub_download("litert-community/convnext_tiny",
|
| 101 |
labels_path = hf_hub_download(
|
| 102 |
"huggingface/label-files", "imagenet-1k-id2label.json", repo_type="dataset"
|
| 103 |
)
|
|
|
|
| 42 |
num_params: 28589128
|
| 43 |
|
| 44 |
|
| 45 |
+
`convnext_tiny_int8_channelwise.tflite`: Mixed INT8/FP32 with channelwise INT8 weights. LayerNorm remains FP32.
|
| 46 |
+
|
| 47 |
+
## Compatibility
|
| 48 |
+
|
| 49 |
+
| File | CPU | GPU | NPU |
|
| 50 |
+
|---|---|---|---|
|
| 51 |
+
| `convnext_tiny.tflite` | Supported | Supported | N/A |
|
| 52 |
+
| `convnext_tiny_int8_channelwise.tflite` | Supported | Not supported | Qualcomm / MediaTek |
|
| 53 |
+
|
| 54 |
## Intended uses & limitations
|
| 55 |
|
| 56 |
The model files were converted from pretrained weights from PyTorch Vision. The models may have their own licenses or terms and conditions derived from PyTorch Vision and the dataset used for training. It is your responsibility to determine whether you have permission to use the models for your use case.
|
|
|
|
| 88 |
w, h = img.size
|
| 89 |
s = 236
|
| 90 |
if w < h:
|
| 91 |
+
img = img.resize((s, int(h * s / w)), Image.BILINEAR)
|
| 92 |
else:
|
| 93 |
+
img = img.resize((int(w * s / h), s), Image.BILINEAR)
|
| 94 |
+
left = int(round((img.size[0] - 224) / 2.0))
|
| 95 |
+
top = int(round((img.size[1] - 224) / 2.0))
|
| 96 |
img = img.crop((left, top, left + 224, top + 224))
|
| 97 |
|
| 98 |
x = np.asarray(img, dtype=np.float32) / 255.0
|
| 99 |
x = (x - np.array([0.485, 0.456, 0.406], dtype=np.float32)) / np.array(
|
| 100 |
[0.229, 0.224, 0.225], dtype=np.float32
|
| 101 |
)
|
| 102 |
+
return np.ascontiguousarray(x.transpose(2, 0, 1)[None])
|
| 103 |
|
| 104 |
def main():
|
| 105 |
ap = argparse.ArgumentParser()
|
| 106 |
ap.add_argument("--image", required=True)
|
| 107 |
args = ap.parse_args()
|
| 108 |
|
| 109 |
+
model_path = hf_hub_download("litert-community/convnext_tiny", "convnext_tiny.tflite")
|
| 110 |
labels_path = hf_hub_download(
|
| 111 |
"huggingface/label-files", "imagenet-1k-id2label.json", repo_type="dataset"
|
| 112 |
)
|
convnext_tiny.tflite
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:42f4181cae412cd35fc769d4baa25d13d5e38a399fe37b0f8872b5b849571188
|
| 3 |
+
size 114425184
|
convnext_tiny_int8_channelwise.tflite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:95e9aac495675b7e73cc91a7dfcb3b8474b8c06ae53e0815ee290c6cad9a25c7
|
| 3 |
+
size 29861536
|