Instructions to use nvidia/segformer-b5-finetuned-ade-640-640 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/segformer-b5-finetuned-ade-640-640 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="nvidia/segformer-b5-finetuned-ade-640-640")# Load model directly from transformers import AutoImageProcessor, SegformerForSemanticSegmentation processor = AutoImageProcessor.from_pretrained("nvidia/segformer-b5-finetuned-ade-640-640") model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b5-finetuned-ade-640-640") - Inference
- Notebooks
- Google Colab
- Kaggle
Fix: Replace invalid model ID with valid SegFormer checkpoint in example code
#6
by anon-repair-bot - opened
Description
The original example code attempts to load a model ID that does not exist on the Hugging Face Hub:
nvidia/segformer-b5-finetuned-ade-512-512
This triggers the following runtime error:
OSError: nvidia/segformer-b5-finetuned-ade-512-512 is not a valid model identifier listed on https://huggingface.co/models
Changes
Replaced:
feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b5-finetuned-ade-512-512")
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b5-finetuned-ade-512-512")
with:
feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b5-finetuned-ade-640-640")
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b5-finetuned-ade-640-640")
Testing
The code has been successfully tested and runs without error.
Note
This contribution is part of an ongoing research initiative to systematically identify and correct faulty example code in Hugging Face Model Cards.
We would appreciate a timely review and integration of this patch to support code reliability and enhance reproducibility for downstream users.
LGTM!
(although I don't have permissions to merge)
Same, btw the feature extractor can be replaced by an image processor (SegformerImageProcessor).