Skip to content

[Docs] Doctest flake in working-with-images.rst caused by PyTorch model download message #62283

@yuhuan130

Description

@yuhuan130

What's happening

The doctest in doc/source/data/working-with-images.rst flakes in CI because an extra PyTorch download message gets printed to stdout when running the image inference example.

Why it happens

When ImageClassifier runs models.resnet18(weights=weights) for the first time, PyTorch downloads the model weights and prints:

Downloading: "https://download.pytorch.org/models/resnet18-f37072fd.pth" to /root/.cache/torch/hub/checkpoints/resnet18-f37072fd.pth

CI containers start fresh with no cache, so this message almost always appears there. The doctest then fails because it gets an extra line that wasn't in the expected output.

Fix

Add :options: +SKIP to the .. testoutput:: block so the output is not checked. The code still runs and the expected output stays visible in the docs for readers.

.. testoutput::
    :options: +SKIP

    {'class': 118}
    {'class': 153}
    {'class': 296}

cc @bveeramani

Metadata

Metadata

Assignees

Labels

community-backlogdataRay Data-related issuesdocsAn issue or change related to documentation

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions