Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/transformers/pipelines/image_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES

if is_torch_available():
import torch
from ..models.auto.modeling_auto import MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES

logger = logging.get_logger(__name__)
Expand Down Expand Up @@ -179,7 +180,7 @@ def postprocess(self, model_outputs, function_to_apply=None, top_k=5):
if top_k > self.model.config.num_labels:
top_k = self.model.config.num_labels

outputs = model_outputs["logits"][0]
outputs = model_outputs["logits"][0].to(torch.float32)
outputs = outputs.numpy()
Comment thread
jiqing-feng marked this conversation as resolved.
Outdated

if function_to_apply == ClassificationFunction.SIGMOID:
Expand Down