-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I use 6 images and dtype = torch.float16 and get
CUDA out of memory. Tried to allocate 20.00 MiB. GPU
import torch
from vggt.models.vggt import VGGT
from vggt.utils.load_fn import load_and_preprocess_images
device = "cuda" if torch.cuda.is_available() else "cpu"
# bfloat16 is supported on Ampere GPUs (Compute Capability 8.0+)
dtype = torch.float16
# Initialize the model and load the pretrained weights.
# This will automatically download the model weights the first time it's run, which may take a while.
model = VGGT.from_pretrained("facebook/VGGT-1B").to(device)
# Load and preprocess example images (replace with your own image paths)
image_names = ["img1.jpg", "img2.jpg", "img3.jpg", "img4.jpg", "img5.jpg", "img6.jpg" ]
images = load_and_preprocess_images(image_names).to(device)
with torch.no_grad():
with torch.cuda.amp.autocast(dtype=dtype):
# Predict attributes including cameras, depth maps, and point maps.
predictions = model(images)
Runtime and GPU Memory table says that with 8GB I should be able to run 20-30 images.
Maybe I understand something wrong or doing something wrong?
Metadata
Metadata
Assignees
Labels
No labels