OpenGVLab / UniFormerV2

[ICCV2023] UniFormerV2: Spatiotemporal Learning by Arming Image ViTs with Video UniFormer
https://arxiv.org/abs/2211.09552
Apache License 2.0
291 stars 18 forks source link

单PGU后遇到问题:IndexError: list index out of range #45

Closed sulizhi closed 1 year ago

sulizhi commented 1 year ago

因为配置问题只能采用单GPU训练,在参考前面的‘单GPU问题’的解决方案后,将slowfast/datasets/utils.py,line 412, in create_sampler中的 sampler = DistributedSampler(dataset) if cfg.NUM_GPUS >= 1 else None 改为 sampler = DistributedSampler(dataset) if cfg.NUM_GPUS >= 1 else RandomSampler(dataset) 后,出现下面问题:

Traceback (most recent call last):
  File "tools/run_net_multi_node.py", line 69, in <module>
    main()
  File "tools/run_net_multi_node.py", line 54, in main
    launch_job(cfg=cfg, init_method=args.init_method, func=test)
  File "/root/common-dir/UniFormerV2/slowfast/utils/misc.py", line 311, in launch_job
    func(cfg=cfg)
  File "/root/common-dir/UniFormerV2/tools/test_net.py", line 168, in test
    cu.load_test_checkpoint(cfg, model)
  File "/root/common-dir/UniFormerV2/slowfast/utils/checkpoint.py", line 500, in load_test_checkpoint
    name = sorted(names)[-1]
IndexError: list index out of range

请问这个问题该如何解决?

Andy1621 commented 1 year ago

抱歉回复晚了,这个问题看起来是checkpoint路径下内容为空,找不到对应的测试checkpoint,你可以通过TEST.CHECKPOINT_FILE_PATH指定测试模型路径

https://github.com/OpenGVLab/UniFormerV2/blob/7c18fd691d42cb2d1fda801883b0a40bb5f43ff5/slowfast/utils/checkpoint.py#L480C12-L502