File size: 539 Bytes
d56acb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
import torch
import urllib.request
import huggingface_hub
from diffusers import DiffusionPipeline


if 'HF_TOKEN' in os.environ:
    huggingface_hub.login(os.environ['HF_TOKEN'])
sam_checkpoint = "tmp/sam_vit_h_4b8939.pth"
os.makedirs('tmp', exist_ok=True)
urllib.request.urlretrieve(
    "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
    sam_checkpoint
)
DiffusionPipeline.from_pretrained(
    "sudo-ai/zero123plus-v1.1", custom_pipeline="sudo-ai/zero123plus-pipeline",
    torch_dtype=torch.float16
)