我正在尝试mlflow
通过创建一个非常简单的项目并记录它来学习使用。
我尝试了以下mlflow
示例,并且在将 main.py 作为普通 bash 命令运行时,我的代码运行正常。
我无法使用mlflow
CLI 使用项目和简单文件运行它。我收到以下错误。
(rlearning) yair@pc2016:~/reinforced_learning101$ mlflow run src/main.py
2019/05/11 10:21:41 ERROR mlflow.cli: === Could not find main among entry points [] or interpret main as a runnable script. Supported script file extensions: ['.py', '.sh'] ===
(rlearning) yair@pc2016:~/reinforced_learning101$ mlflow run .
2019/05/11 10:40:25 INFO mlflow.projects: === Created directory /tmp/tmpe26oernf for downloading remote URIs passed to arguments of type 'path' ===
2019/05/11 10:40:25 INFO mlflow.projects: === Running command 'source activate mlflow-21497056aed7961402b515847613ed9f950fa9fc && python src/main.py 1.0' in run with ID 'ed51446de4c44903ab891d09cfe10e49' ===
bash: activate: No such file or directory
2019/05/11 10:40:25 ERROR mlflow.cli: === Run (ID 'ed51446de4c44903ab891d09cfe10e49') failed ===
不用说我的 main 有一个.py
后缀。
有什么问题导致这个问题吗?
我的 main.py 是:
import sys
import gym
import mlflow
if __name__ == '__main__':
env = gym.make("CartPole-v0")
right_percent = float(sys.argv[1]) if len(sys.argv) > 1 else 1.0
with mlflow.start_run():
obs = env.reset()
print(env.action_space)
action = 1 # accelerate right
print(obs)
mlflow.log_param("right percent", right_percent)
mlflow.log_metric("mean score", 1)
mlflow.log_metric("std score", 0)
conda_env.yaml
name: rlearning
channels:
- defaults
dependencies:
- python=3.7
- numpy
- pandas
- tensorflow-gpu
- pip:
- mlflow
- gym
机器学习项目
name: reinforced learning
conda_env: files/config/conda_environment.yaml
entry_points:
main:
parameters:
right_percent: {type: float, default: 1.0}
command: "python src/main.py {right_percent}"