Image Classification
Transformers
JAX
ntlm_class25
imagenet-1k
tpu
muon
convnext
hybrid
custom_code
notokenlm
Instructions to use VeroLM/NoTokenLM-ImageGen-Class-2.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VeroLM/NoTokenLM-ImageGen-Class-2.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="VeroLM/NoTokenLM-ImageGen-Class-2.5", trust_remote_code=True) pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForImageClassification model = AutoModelForImageClassification.from_pretrained("VeroLM/NoTokenLM-ImageGen-Class-2.5", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download configuration_ntlm_class25.py from VeroLM/NoTokenLM-ImageGen-Class-2.5: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/VeroLM/NoTokenLM-ImageGen-Class-2.5/resolve/main/configuration_ntlm_class25.py
- Command line
-
hf download hf://VeroLM/NoTokenLM-ImageGen-Class-2.5/configuration_ntlm_class25.py
-
curl -L -o configuration_ntlm_class25.py https://huggingface.co/VeroLM/NoTokenLM-ImageGen-Class-2.5/resolve/main/configuration_ntlm_class25.py
1.62 kB
| """Configuration for NoTokenLM-ImageGen-Class-2.5 (hybrid conv/attention ImageNet-1k classifier).""" | |
| from transformers import PretrainedConfig | |
| class NTLMClass25Config(PretrainedConfig): | |
| """Architecture hyper-parameters. Field names mirror the JAX training code (`ntlm_core.Cfg`).""" | |
| model_type = "ntlm_class25" | |
| def __init__( | |
| self, | |
| widths=(64, 128, 256, 384), # channels of the 4 stages | |
| depths=(2, 3, 3, 2), # blocks per stage (stage 1 = Fused-MBConv, stages 2-4 = ConvNeXt-style) | |
| ratios=(4, 4, 4, 3), # MLP / expansion ratio per stage | |
| heads=4, # attention heads (global attention, last block of stage 4) | |
| head_dim=1024, # width of the hidden layer of the classification head | |
| num_classes=1000, | |
| dw_k=7, # depthwise kernel size of the ConvNeXt blocks | |
| ls_init=1e-2, # layer-scale init (irrelevant at inference) | |
| drop_path=0.1, # stochastic depth rate (training only, unused here) | |
| default_resolution=128, # resolution the final training stages used | |
| **kwargs, | |
| ): | |
| self.widths = list(widths) | |
| self.depths = list(depths) | |
| self.ratios = list(ratios) | |
| self.heads = heads | |
| self.head_dim = head_dim | |
| self.num_classes = num_classes | |
| self.dw_k = dw_k | |
| self.ls_init = ls_init | |
| self.drop_path = drop_path | |
| self.default_resolution = default_resolution | |
| kwargs.setdefault("num_labels", num_classes) | |
| super().__init__(**kwargs) | |