From 9a15af88d7f397c4ddd280db71b9dd3e93f6abcf Mon Sep 17 00:00:00 2001 From: x54-729 <17307130121@fudan.edu.cn> Date: Tue, 10 May 2022 08:10:48 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=94=A8=E6=88=B7=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=AE=BE=E7=BD=AEbackend=E4=B8=94=E7=94=A8launch?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E4=BA=86=E5=A4=9A=E5=8D=A1=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=9B=B8=E5=BA=94=E7=9A=84=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastNLP/envs/set_backend.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fastNLP/envs/set_backend.py b/fastNLP/envs/set_backend.py index e6b9bf59..d925d282 100644 --- a/fastNLP/envs/set_backend.py +++ b/fastNLP/envs/set_backend.py @@ -101,6 +101,11 @@ def _set_backend(): elif backend == 'torch': assert _module_available(backend), f"You must have {backend} available to use {backend} backend." + if 'PADDLE_RANK_IN_NODE' in os.environ and 'FLAGS_selected_gpus' in os.environ \ + and "USER_CUDA_VISIBLE_DEVICES" not in os.environ: + # 当用户没有设置 backend 并且使用 launch 启动了多卡,应该提醒用户进行设置 + raise RuntimeError("To run paddle distributed training, please set `FASTNLP_BACKEND` to 'paddle' before using FastNLP.") + def set_env(global_seed=None): """