Depth Estimation
Transformers
Safetensors
tipsv2_dpt
feature-extraction
vision
surface-normals
semantic-segmentation
dense-prediction
custom_code
Instructions to use google/tipsv2-l14-dpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/tipsv2-l14-dpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("depth-estimation", model="google/tipsv2-l14-dpt", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModel processor = AutoImageProcessor.from_pretrained("google/tipsv2-l14-dpt", trust_remote_code=True) model = AutoModel.from_pretrained("google/tipsv2-l14-dpt", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Gabriele commited on
Commit ·
d8d2fe7
1
Parent(s): 4b9afcc
Revert "Use device-agnostic code instead of hardcoded .cuda()"
Browse filesThis reverts commit 4b9afccd53c71186db655e4eb59e0c9c4ee8cc1e.
20 unmodified lines212223242526272829303132333435363738394020 unmodified lines``````pythonimport torchfrom transformers import AutoModelfrom torchvision import transformsfrom PIL import Imageimport requestsdevice = "cuda" if torch.cuda.is_available() else "cpu"model = AutoModel.from_pretrained("google/tipsv2-l14-dpt", trust_remote_code=True)model.eval().to(device)url = "https://raw.githubusercontent.com/google-deepmind/tips/main/scenic/images/example_image_2.jpg"image = Image.open(requests.get(url, stream=True).raw)transform = transforms.Compose([transforms.Resize((448, 448)), transforms.ToTensor()])pixel_values = transform(image).unsqueeze(0).to(device)# All tasks at onceoutputs = model(pixel_values)20 unmodified lines21222324252627282930313233343536373820 unmodified lines``````pythonfrom transformers import AutoModelfrom torchvision import transformsfrom PIL import Imageimport requestsmodel = AutoModel.from_pretrained("google/tipsv2-l14-dpt", trust_remote_code=True)model.eval().cuda()url = "https://raw.githubusercontent.com/google-deepmind/tips/main/scenic/images/example_image_2.jpg"image = Image.open(requests.get(url, stream=True).raw)transform = transforms.Compose([transforms.Resize((448, 448)), transforms.ToTensor()])pixel_values = transform(image).unsqueeze(0).cuda()# All tasks at onceoutputs = model(pixel_values)
README.md+2-4