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)
1234{"crop_size": null,"data_format": "channels_first","default_to_square": true,1234567{"auto_map": {"AutoImageProcessor": "preprocessor_lenet.LeNetProcessor"},"crop_size": null,"data_format": "channels_first","default_to_square": true,
123456789101112131415161718192021222324252627282930313233343536from transformers import BaseImageProcessorFast, BatchFeaturefrom transformers.image_transforms import ( normalize, )from transformers.image_utils import ( ImageInput, to_numpy_array,)
class LeNetProcessor(BaseImageProcessorFast): model_input_names = ["pixel_values"]
def __init__( self, **kwargs ): super().__init__(**kwargs)
def preprocess( self, images: ImageInput, return_tensors=None, **kwargs ) -> BatchFeature: if not isinstance(images, list): images = [images]
images = [to_numpy_array(img) for img in images]
processed_images = [] for img in images: processed_images.append(normalize(img, mean=0.1307, std=0.3081))
data = {"pixel_values": processed_images} return BatchFeature(data=data, tensor_type=return_tensors)preprocessor_config.json+3
preprocessor_lenet.pyAdded+36