我正在尝试通过创建一个非常简单的项目并记录它来学习使用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 ===
不用说我的主后缀为.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
MLproject
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}"
答案 0 :(得分:0)
似乎您对conda初始化有问题。仅出于测试目的,我建议您尝试--no-conda
(在确保您之前pip安装了所有库之后)。
因此,请尝试以下操作:mlflow run . --no-conda