【NNI】在集群上使用NNI显示request报错的解决方案

【NNI】在集群上使用NNI显示request报错的解决方案

在slurm集群上使用NNI时,一直报错如下:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=17513): Max retries exceeded with url: /api/v1/nni/check-status (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',))

经过搜索,在其官方GitHub的issue中找到了解决方案Failed to establish a new connection · Issue #3496 · microsoft/nni (github.com)

简单来说,就是重试的次数过少,在集群的环境下很可能无法启动实验,因此我们将源码进行简单的修改如下:

  • 找到安装的nni目录下的launcher文件:nni/nni/experiment/launcher.py
  • 将126行_check_rest_server(port, url_prefix=url_prefix)修改为_check_rest_server(port, retry=30, url_prefix=url_prefix)
  • 即将重试30次,经过测试,一般在10次重试后,实验就会起来了。

另外,官方应该在3.0版本中会解决这个问题,可以将nni升级到更高版本试试。

你可能感兴趣的:(机器学习,python,python,机器学习,深度学习,人工智能)