Run this model with HF Jobs
Run Thastp/efficientnet_b1 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/Thastp/efficientnet_b1. 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/Thastp/efficientnet_b1 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 Thastp/efficientnet_b1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Thastp/efficientnet_b1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="Thastp/efficientnet_b1", 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 AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("Thastp/efficientnet_b1", trust_remote_code=True) model = AutoModelForImageClassification.from_pretrained("Thastp/efficientnet_b1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload processor
Browse files1232 unmodified lines6789101112131415161718192021222324from transformers.image_processing_utils import BaseImageProcessor, BatchFeaturefrom timm import create_modelfrom timm.data import resolve_data_config2 unmodified linesclass EfficientNetImageProcessor(BaseImageProcessor):model_input_names = ["pixel_values"]def __init__(self,model_name: str,**kwargs):super().__init__(**kwargs)self.model_name = model_nameself.config = resolve_data_config({}, model=create_model(model_name, pretrained=False))def preprocess(self, image):transforms = create_transform(**self.config)data = {'pixel_values': transforms(image).unsqueeze(0)}return BatchFeature(data=data)__all__ = [12345672 unmodified lines101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263from PIL import Imagefrom torch import Tensor, stackfrom typing import Union, Listfrom transformers.image_processing_utils import BaseImageProcessor, BatchFeaturefrom timm import create_modelfrom timm.data import resolve_data_config2 unmodified linesclass EfficientNetImageProcessor(BaseImageProcessor):model_input_names = ["pixel_values"]def __init__(self,model_name: str,**kwargs,):self.model_name = model_nameself.config = resolve_data_config({}, model=create_model(model_name, pretrained=False))super().__init__(**kwargs)def preprocess(self,images: Union[List[Union[Image.Image, Tensor]], Image.Image, Tensor],) -> BatchFeature:"""Preprocesses input images by applying transformations and returning them as a BatchFeature.Parameters----------images : Union[List[PIL.Image.Image, torch.Tensor], PIL.Image.Image, torch.Tensor]A single image or a list of images in one of the accepted formats.Returns-------BatchFeatureA batch of transformed images"""images = [images] if not isinstance(images, list) else images# TEST: empty listif len(images) == 0:raise ValueError("Received an empty list of images")# TEST: validate input typetest_image = images[0]if not isinstance(images[0], (Image.Image, Tensor)):raise TypeError(f"Expected image to be of type PIL.Image.Image, torch.Tensor, or numpy.ndarray, "f"but got {type(test_image).__name__} instead.")# Apply transformationstransforms = create_transform(**self.config)transformed_images = [transforms(image) for image in images]# Convert to batch tensortransformed_image_tensors = stack(transformed_images)data = {'pixel_values': transformed_image_tensors}return BatchFeature(data=data)__all__ = [
image_processing_efficientnet.py+47-8