fudan-zvg / Semantic-Segment-Anything

Automated dense category annotation engine that serves as the initial semantic labeling for the Segment Anything dataset (SA-1B).
Apache License 2.0
2.1k stars 132 forks source link

Run without GPU #23

Closed AnnaBhlr closed 1 year ago

AnnaBhlr commented 1 year ago

Hi, thanks for the amazing code! Is there any chance to get it running without a cuda capable gpu? Maybe via cpu (as for the sam)? Thanks!

houshuaipeng commented 1 year ago

I have the same question.

houshuaipeng commented 1 year ago

I've got the solution, for example with main_ssa_engine.py: 1、comment out the first line in main(): dist.init_process_group("nccl", rank=rank, world_size=args.world_size) 2、change the last 4 lines: if args.world_size > 1: mp.spawn(main,args=(args,),nprocs=args.world_size,join=True) else: main(0, args) into one line: main('cpu', args)

ibrandiay commented 1 year ago

@houshuaipeng Your solution does not work, the first argument of the hand must be an integer and not a string as you advise us.

AnnaBhlr commented 1 year ago

@ibrandiay It works if you change rank in l99 to 0 resulting in:

local_filenames = filenames[(len(filenames) // args.world_size + 1) * 0 : (len(filenames) // args.world_size + 1) * (0 + 1)]
ibrandiay commented 1 year ago

Thank @AnnaBhlr it work well now !!