Browse Source

如果用户没有设置backend且用launch启动了多卡,添加相应的提醒

tags/v1.0.0alpha
x54-729 3 years ago
parent
commit
9a15af88d7
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      fastNLP/envs/set_backend.py

+ 5
- 0
fastNLP/envs/set_backend.py View File

@@ -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):
"""


Loading…
Cancel
Save