当前位置: 首页 > 工具软件 > DeepMind Lab > 使用案例 >

deepmind lab 环境配置中的一些tips

马臻
2023-12-01

1. bazel版本

0.20.0,高版本编译会报错

2. 配置python环境

首先更改lab-master下的workspace文件,我用的是miniconda配置如下:

new_local_repository(
    name = "python_system",
    build_file = "python.BUILD",
    path = "/home/zc/miniconda3",
)

再更改lab-master下的python.build文件,屏蔽之前的配置,之前的配置会报错,我的配置如下:

cc_library(
    name = "python",
    hdrs = glob([
        "include/python3.6m/*.h",
        "lib/python3.6/site-packages/numpy/core/include/numpy/*.h",
    ]),
    includes = [
        "include/python3.6m",
        "lib/python3.6/site-packages/numpy/core/include",
    ],
    visibility = ["//visibility:public"],
)

3. 更改bazel run :python_main默认执行python文件

在lab-master/build 文件文件进行修改,修改范例如下:

py_binary(
    name = "python_main",
    srcs = ["python/modified_agent/main.py"],
    data = [":deepmind_lab.so"],
    main = "python/modified_agent/main.py",
    visibility = ["//python/tests:__subpackages__"],
    deps = ["@six_archive//:six"],
)

4. 自定义环境

修改lab-maste/game_scripts/levels/下面的lua文件
假如自己定义了一个my_map.lua文件,然后在官方给的random_agent中通过下面代码即可以应用

parser.add_argument('--level_script', type=str,
                    default='my_map',
                    help='The environment level script to load')
 类似资料: