From ac224bb0797c1ee6522d814139f3eb0a8947267b Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Fri, 7 Jan 2022 16:55:59 +0100 Subject: [PATCH] [Fix doc examples] Add missing from_pretrained (#15044) * fix doc example - ValueError: Parameter config should be an instance of class `PretrainedConfig` * Update src/transformers/models/segformer/modeling_segformer.py Co-authored-by: NielsRogge <48327001+NielsRogge@users.noreply.github.com> * update Co-authored-by: ydshieh Co-authored-by: NielsRogge <48327001+NielsRogge@users.noreply.github.com> --- src/transformers/models/segformer/modeling_segformer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformers/models/segformer/modeling_segformer.py b/src/transformers/models/segformer/modeling_segformer.py index afa6d8cde8d45f..1fa4f73266ad7c 100755 --- a/src/transformers/models/segformer/modeling_segformer.py +++ b/src/transformers/models/segformer/modeling_segformer.py @@ -490,8 +490,8 @@ def forward(self, pixel_values, output_attentions=None, output_hidden_states=Non >>> from PIL import Image >>> import requests - >>> feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512") - >>> model = SegformerModel("nvidia/segformer-b0-finetuned-ade-512-512") + >>> feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/mit-b0") + >>> model = SegformerModel.from_pretrained("nvidia/mit-b0") >>> url = "http://images.cocodataset.org/val2017/000000039769.jpg" >>> image = Image.open(requests.get(url, stream=True).raw)