Skip to content

Code block in Using models from Hub failed to render correctly. #8837

@GdoongMathew

Description

@GdoongMathew

📚 The doc issue

In https://pytorch.org/vision/main/models.html#using-models-from-hub, the resulting code block on my browser looks like
image
, which is different from the original documents.

import torch

# Option 1: passing weights param as string
model = torch.hub.load("pytorch/vision", "resnet50", weights="IMAGENET1K_V2")

# Option 2: passing weights param as enum
weights = torch.hub.load("pytorch/vision", "get_weight", weights="ResNet50_Weights.IMAGENET1K_V2")  # --> this is where it looks weird on Chrome.
model = torch.hub.load("pytorch/vision", "resnet50", weights=weights)

Suggest a potential alternative/fix

Not sure if the following changes could solve the rendering problem.

# Option 2: passing weights param as enum
weights = torch.hub.load(
    "pytorch/vision", 
    "get_weight", 
    weights="ResNet50_Weights.IMAGENET1K_V2",
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions