Skip to content

RuntimeError: "replication_pad2d_cuda" not implemented for 'BFloat16' #26

Description

@jiafengshen

RuntimeError: "replication_pad2d_cuda" not implemented for 'BFloat16'?
help! when I run {
import torch
import cv2
import numpy as np
from mdm.model.v2 import MDMModel

Load model

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = MDMModel.from_pretrained('robbyant/lingbot-depth-pretrain-vitl-14-v0.5').to(device)

Load and prepare inputs

image = cv2.cvtColor(cv2.imread('examples/0/rgb.png'), cv2.COLOR_BGR2RGB)
h, w = image.shape[:2]
image = torch.tensor(image / 255, dtype=torch.float32, device=device).permute(2, 0, 1)[None]

depth = cv2.imread('examples/0/raw_depth.png', cv2.IMREAD_UNCHANGED).astype(np.float32) / 1000.0
depth = torch.tensor(depth, dtype=torch.float32, device=device)[None]

intrinsics = np.loadtxt('examples/0/intrinsics.txt')
intrinsics[0] /= w # Normalize fx and cx by width
intrinsics[1] /= h # Normalize fy and cy by height
intrinsics = torch.tensor(intrinsics, dtype=torch.float32, device=device)[None]

Run inference

output = model.infer(
image,
depth_in=depth,
intrinsics=intrinsics)

depth_pred = output['depth'] # Refined depth map
points = output['points'] # 3D point cloud}

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