ShiqiYu / libfacedetection.train

The training program for libfacedetection for face detection and 5-landmark detection.
Apache License 2.0
766 stars 209 forks source link

老师,如果在Win上配置了MMDET环境后,如何修改指令执行train.py呀? #79

Closed BandyKenny closed 1 year ago

BandyKenny commented 1 year ago

CUDA_VISIBLE_DEVICES=0 bash tools/dist_train.sh ./configs/yunet_n.py 2 12345 这句指令在win上无法执行,查看bash文件不知道如何修改?

!/usr/bin/env bash

CONFIG=$1 GPUS=$2 PORT=$3 NNODES=${NNODES:-1} NODE_RANK=${NODE_RANK:-0} PORT=${PORT:-29500} MASTER_ADDR=${MASTER_ADDR:-"127.0.0.1"}

PYTHONPATH="$(dirname $0)/..":$PYTHONPATH \ python -m torch.distributed.launch \ --nnodes=$NNODES \ --node_rank=$NODE_RANK \ --master_addr=$MASTER_ADDR \ --nproc_per_node=$GPUS \ --master_port=$PORT \ $(dirname "$0")/train.py \ $CONFIG \ --seed 0 \ --launcher pytorch${@:4}

--auto-resume \

Wwupup commented 1 year ago

我没在win下测试过,你最好贴一下你的报错细节

BandyKenny commented 1 year ago

我没在win下测试过,你最好贴一下你的报错细节 哦哦,我在win的git Bash上进行命令行执行的: CUDA_VISIBLE_DEVICES=0 bash tools/dist_train.sh ./configs/yunet_n.py 2 12345 1、然后报错内容为: image 2、然后我尝试将执行指令改为: CUDA_VISIBLE_DEVICES=0 bash tools/dist_train.sh ./configs/yunet_n.py 1 12345,但是任然报错,报错内容为: image 然后尝试在百度找到了解决方案: ​ image 因此我在mmedt的distributed_c10d.py中进行了修改: image 3、修改后再次执行: CUDA_VISIBLE_DEVICES=0 bash tools/dist_train.sh ./configs/yunet_n.py 1 12345 出现如下报错: image 然后尝试百度解决: image 然后我将env.py进行了替换: image 4、然后在执行命令: CUDA_VISIBLE_DEVICES=0 bash tools/dist_train.sh ./configs/yunet_n.py 1 12345 image 可以正常运行了,但是这个“The system cannot find the path specified.”系统找不到指定路径是什么意思? 然后在执行了几轮后,就开始报错OOM了: image

image 所以想问下老师这个配置文件的batch_size可以在哪里修改到呀,还有就是这个指令: CUDA_VISIBLE_DEVICES=0 bash tools/dist_train.sh ./configs/yunet_n.py 1 12345 中,12345的含义是什么呀?我应该如何修改才能在4GB的显存上进行跑通呀?

Wwupup commented 1 year ago

@BandyKenny 你好,只有4GB显存的话,必须调小batch_size。samper_per_gpu是表示每张GPU上的batch_size https://github.com/ShiqiYu/libfacedetection.train/blob/dce01651d44d2880bcbf4e296ad5ef383a5a611e/configs/yunet_n.py#L29-L32 image 另外,出错时尽量别改成熟包的核心代码,考虑设置输入参数,否则容易越改越崩。

BandyKenny commented 1 year ago

好的,就是说端口号这个和分布式计算相关,在单GPU计算时候就可以不关注这个量,随便赋值一个端口号即可,🙇‍

BandyKenny commented 1 year ago

但是这个“The system cannot find the path specified.”系统找不到指定路径 这个提示对于训练是否会有影响呀?