Run this model with HF Jobs
Run l45k/lenet on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/l45k/lenet. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/l45k/lenet on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use l45k/lenet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use l45k/lenet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="l45k/lenet", 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("l45k/lenet", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload processor
Browse filesFiles changed (2)
- preprocessor_config.json+4-13
- preprocessor_resnet.pyAdded+35
123456789101112131415{"crop_pct": 0.875,"do_normalize": true,"do_rescale": false,"do_resize": false,"image_mean": 0.1307,"image_processor_type": "ConvNextImageProcessor","image_std": 0.3081,"resample": null,"rescale_factor": 0.00392156862745098,"size": {"height": 28,"width": 28}}123456{"auto_map": {"AutoImageProcessor": "preprocessor_resnet.ResNetProcessor"},"image_processor_type": "ResNetProcessor"}
1234567891011121314151617181920212223242526272829303132333435from transformers.image_utils import ImageInputfrom transformers import BaseImageProcessor, BatchFeaturefrom torchvision.transforms import v2import torch
class ResNetProcessor(BaseImageProcessor): """ A custom processor for ResNet training """
model_input_names = ["pixel_values"]
def __init__(self, **kwargs): super().__init__(**kwargs)
def preprocess(self, images: ImageInput, return_tensors="pt", **kwargs) -> BatchFeature: """ Preprocess a batch of grayscale images. """ if not isinstance(images, list): images = [images] transform = v2.Compose([ v2.RandomResizedCrop(size=(224, 224), antialias=True), v2.RandomHorizontalFlip(p=0.5), v2.ToDtype(torch.float32, scale=True), v2.Normalize( mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] ), ]) data = {"pixel_values": transform(images)} return BatchFeature(data=data, tensor_type="pt")preprocessor_config.json+4-13
preprocessor_resnet.pyAdded+35