Skip to content

Return Nothing With CUDA DEVICE #216

@FlynnSpace

Description

@FlynnSpace

I've used the text_prompt function from the example code, which works fine when the DEVICE is CPU. But when I replace DEVICE with CUDA (as shown below), the program returns three different exception cases:

  • Return 0 and the console is blank. No result is saved.
  • The program keeps running and returns nothing.
  • Return error: python: ../nptl/pthread_mutex_lock.c:428: __pthread_mutex_lock_full: Assertion e != ESRCH || !robust failed.
model= FastSAM('./weights/FastSAM.pt')
IMAGE_PATH = './images/dogs.jpg'
DEVICE = torch.device(
    "cuda"
    if torch.cuda.is_available()
    else "mps"
    if torch.backends.mps.is_available()
    else "cpu"
)
everything_results = model(IMAGE_PATH, device=DEVICE, retina_masks=True, imgsz=1024, conf=0.4, iou=0.9,)
prompt_process = FastSAMPrompt(IMAGE_PATH, everything_results, device=DEVICE)

ann = prompt_process.text_prompt(text='a photo of a dog')

prompt_process.plot(annotations=ann,output_path='./output/dog.jpg',)

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