Documentation
ODP 3.3.6.4-1
Release Notes
What is ODP
Installation
Component User guide and Installation Instructions
Upgrade Instructions
Downgrade Instructions
Reference Guide
Security Guide
Troubleshooting Guide
Uninstall ODP
Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
Pytorch on Jupyterhub
Summarize Page
Copy Markdown
Open in ChatGPT
Open in Claude
Connect to Cursor
Connect to VS Code
This release adds PyTorch CPU packages to JupyterHub, so you can start using PyTorch in your notebooks without any additional setup.
The JupyterHub environment now includes the core PyTorch CPU packages commonly used for model development and inference, including torch, torchvision, and torchaudio.
Example
The following example loads a pretrained image classification model with torchvision, runs inference on uploaded images, and prints the predicted class:
Bash
xxxxxxxxxximport torchfrom torchvision import models, transformsfrom PIL import Imageimport requests model = models.resnet18(pretrained=True)model.eval() labels_url = "https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt"classes = requests.get(labels_url).text.splitlines() transform = transforms.Compose([ transforms.Resize((224, 224)), transforms.ToTensor(), transforms.Normalize( mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] )]) image = Image.open("example.png").convert("RGB")input_tensor = transform(image).unsqueeze(0) with torch.no_grad(): outputs = model(input_tensor) _, predicted = torch.max(outputs, 1) print("Model prediction:", classes[predicted.item()])To try this yourself, upload an image file to your JupyterHub workspace and update the filename in the example code.
Example output in JupyterHub is shown below.

If you are working with GPU-based hardware, you can still install the appropriate PyTorch GPU packages as usual for your environment.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
Last updated on May 15, 2026
Was this page helpful?
Next to read:
Streamlit on Jupyterhubnull
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message