python - mlflow 找不到 .py 文件
问题描述
我正在尝试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}"
解决方案
看来您对 conda 初始化有问题。仅出于测试目的,我建议您尝试--no-conda
(在确保您之前 pip 安装了所有库之后)。
所以试试这个:mlflow run . --no-conda
推荐阅读
- sql - 我有 Store_Id,日期级别的数据,并且必须使用 SQL 标记是否每周访问该商店
- javascript - 如何在 javascript 或 vue 中在多个对象上迭代一个循环
- powershell - PowerShell 读取最后两行 .log 文件
- reactjs - http://localhost:3000/ 一直加载
- docker - 用于两个并行 docker 构建的 Bitbucket docker 图像缓存
- facebook - 如何在营销 api 中过滤具有特定目标的 facebook adaccount 活动?
- mlflow - MLflow 存储标签但不返回它们
- flutter - Flutter 设备预览和 Firebase 身份验证不兼容
- html - Bootstrap/css nof 在 IE 和 ED 上找到/工作
- php - 将 body_class 作为变量传递给 Gravity 表单隐藏字段