1. 创建虚拟环境
conda create -n nni python=3.7
conda activate nni
2. 安装nni
pip install nni==1.9 tensorflow==1.15.4 # 需要手动安装tf 1.x
git clone -b v1.9 https://gitee.com/oaksharks/nni.git # 需要源码运行样例
3. 遇到的问题
启动任务时候遇到报错:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module '/home/oaksharks/miniconda3/envs/nni/nni/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node'
Require stack:
- /home/oaksharks/miniconda3/envs/nni/nni/node_modules/sqlite3/lib/sqlite3-binding.js
- /home/oaksharks/miniconda3/envs/nni/nni/node_modules/sqlite3/lib/sqlite3.js
- /home/oaksharks/miniconda3/envs/nni/nni/core/sqlDatabase.js
- /home/oaksharks/miniconda3/envs/nni/nni/main.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/oaksharks/miniconda3/envs/nni/nni/node_modules/sqlite3/lib/sqlite3-binding.js:4:15)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/oaksharks/miniconda3/envs/nni/nni/node_modules/sqlite3/lib/sqlite3-binding.js',
'/home/oaksharks/miniconda3/envs/nni/nni/node_modules/sqlite3/lib/sqlite3.js',
'/home/oaksharks/miniconda3/envs/nni/nni/core/sqlDatabase.js',
'/home/oaksharks/miniconda3/envs/nni/nni/main.js'
]
}
解决办法:
$ cd /home/oaksharks/miniconda3/envs/nni/nni/node_modules
yarn install
4. 启动实验
nnictl create --port 8480 --config nni/examples/trials/mnist-tfv1/config.yml
# nnictl experiment show # 查看执行中的任务
# nnictl stop # 关闭运行中的任务