Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GdoongMathew opened this issue Jan 5, 2025 · 1 comment · May be fixed by #8846
Open

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

GdoongMathew opened this issue Jan 5, 2025 · 1 comment · May be fixed by #8846

Comments

@GdoongMathew
Copy link

GdoongMathew commented Jan 5, 2025

📚 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",
)
@NicolasHug
Copy link
Member

Thanks for the report @GdoongMathew , your suggestion sounds good, would you mind submitting a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants