Cheems-Seminar / grounded-segment-any-parts

Grounded Segment Anything: From Objects to Parts
Other
388 stars 18 forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'sam_vit_h_4b8939.pth' #7

Open Kurinosuke118 opened 1 year ago

Kurinosuke118 commented 1 year ago

The following error occurred. Please let me know if any process is missing.

Initializing SegmentAnything to cuda:1 ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /content/grounded-segment-any-parts/chatbot.py:1337 in │ │ │ │ 1334 │ parser.addargument('--load', type=str, default="ImageCaptioning │ │ 1335 │ args = parser.parse_args() │ │ 1336 │ loaddict = {e.split('')[0].strip(): e.split('_')[1].strip() for │ │ ❱ 1337 │ bot = ConversationBot(load_dict=load_dict) │ │ 1338 │ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as │ │ 1339 │ │ lang = gr.Radio(choices = ['Chinese','English'], value=None, │ │ 1340 │ │ chatbot = gr.Chatbot(elem_id="chatbot", label="CheemsChat") │ │ │ │ /content/grounded-segment-any-parts/chatbot.py:1264 in init │ │ │ │ 1261 │ │ self.models = {} │ │ 1262 │ │ # Load Basic Foundation Models │ │ 1263 │ │ for class_name, device in load_dict.items(): │ │ ❱ 1264 │ │ │ self.models[class_name] = globals()[class_name](device=de │ │ 1265 │ │ │ │ 1266 │ │ # Load Template Foundation Models │ │ 1267 │ │ for class_name, module in globals().items(): │ │ │ │ /content/grounded-segment-any-parts/chatbot.py:1043 in init │ │ │ │ 1040 │ │ │ │ 1041 │ │ sam_checkpoint = "sam_vit_h_4b8939.pth" │ │ 1042 │ │ model_type = "vit_h" │ │ ❱ 1043 │ │ self.sam = sam_model_registry[model_type](checkpoint=sam_chec │ │ 1044 │ │ self.sam.to(device=device) │ │ 1045 │ │ │ 1046 │ @prompts(name="Segment Anything on Image", │ │ │ │ /content/grounded-segment-any-parts/segment-anything/segmentanything/build │ │ sam.py:15 in build_sam_vit_h │ │ │ │ 12 │ │ 13 │ │ 14 def build_sam_vit_h(checkpoint=None): │ │ ❱ 15 │ return _build_sam( │ │ 16 │ │ encoder_embed_dim=1280, │ │ 17 │ │ encoder_depth=32, │ │ 18 │ │ encoder_num_heads=16, │ │ │ │ /content/grounded-segment-any-parts/segment-anything/segmentanything/build │ │ sam.py:104 in _build_sam │ │ │ │ 101 │ ) │ │ 102 │ sam.eval() │ │ 103 │ if checkpoint is not None: │ │ ❱ 104 │ │ with open(checkpoint, "rb") as f: │ │ 105 │ │ │ state_dict = torch.load(f) │ │ 106 │ │ sam.load_state_dict(state_dict) │ │ 107 │ return sam │ ╰──────────────────────────────────────────────────────────────────────────────╯ FileNotFoundError: [Errno 2] No such file or directory: 'sam_vit_h_4b8939.pth'

PeizeSun commented 1 year ago

Hi~ Please download the model in model-checkpoints.

Kurinosuke118 commented 1 year ago

@PeizeSun Thank you!! I'll try it.