使用gym中的录制功能,报错,具体:

>>> import gym

>>> gym.wrappers.Monitor
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'gym.wrappers' has no attribute 'Monitor'

经过网上查询知道在gym的0.21以上版本API进行了更改,gym.wrappers.Monitor由

gym.wrappers.RecordVideo 和 gym.wrappers.RecordEpisodeStatistics 所替代:

注意,使用之前需要安装依赖:

pip install moviepy

import gym
env = gym.make("BipedalWalker-v3",render_mode = 'human') env = gym.wrappers.RecordEpisodeStatistics(env)
env = gym.wrappers.RecordVideo(env, f"videos/{gym.__version__}")

===================================================

关于gym.wrappers.RecordEpisodeStatistics的帮助文档:

class RecordEpisodeStatistics(gym.core.Wrapper)
 |  RecordEpisodeStatistics(*args, **kwds)
 |  
 |  This wrapper will keep track of cumulative rewards and episode lengths.
 |  
 |  At the end of an episode, the statistics of the episode will be added to ``info``
 |  using the key ``episode``. If using a vectorized environment also the key
 |  ``_episode`` is used which indicates whether the env at the respective index has
 |  the episode statistics.
 |  
 |  After the completion of an episode, ``info`` will look like this::
 |  
 |      >>> info = {
 |      ...     ...
 |      ...     "episode": {
 |      ...         "r": "<cumulative reward>",
 |      ...         "l": "<episode length>",
 |      ...         "t": "<elapsed time since instantiation of wrapper>"
 |      ...     },
 |      ... }
 |  
 |  For a vectorized environments the output will be in the form of::
 |  
 |      >>> infos = {
 |      ...     ...
 |      ...     "episode": {
 |      ...         "r": "<array of cumulative reward>",
 |      ...         "l": "<array of episode length>",
 |      ...         "t": "<array of elapsed time since instantiation of wrapper>"
 |      ...     },
 |      ...     "_episode": "<boolean array of length num-envs>"
 |      ... }
 |  
 |  Moreover, the most recent rewards and episode lengths are stored in buffers that can be accessed via
 |  :attr:`wrapped_env.return_queue` and :attr:`wrapped_env.length_queue` respectively.

可以看到,gym.wrappers.RecordEpisodeStatistics 在运行过程中进行统计然后在info中进行显示,这样的操作会占用一定的计算资源,如果没有必要使用则不需要使用。

===================================================

参考:

https://zhuanlan.zhihu.com/p/569710619

gym.wrappers.Monitor报错,无法使用的更多相关文章

  1. 启动android monitor报错解决办法

    再这汇总一下这段时间使用android monitor新遇到的问题,特汇总对应问题解决办法如下: 1.确保JDK和Android studio位数相同,比如JDK使用的是64位,studio也要是64 ...

  2. 烂泥:【解决】ubuntu使用远程NFS报错

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 今天在ubuntu系统上使用远程NFS,发现一直报错无法使用. 查看NFS挂载命令没有错误,命令如下: mount -t nfs 192.168.1.1 ...

  3. (转) 关于Oracle EBS邮件服务无法使用的报错

    来源http://blog.itpub.net/23850820/viewspace-1060596/ 也可以检查如下网站:http://blog.sina.com.cn/s/blog_5b021b4 ...

  4. LoadRunner监控windows资源报错Monitor name :Windows Resources. Cannot connect to machine

    目标机:被监控的机器,windows server 2008 R2. 测试机:执行control的机器,windows7 操作:在测试机上执行Control,添加windows的监控 问题现象:Mon ...

  5. ORA-15025 搭建DG环境,restore controlfile报错,提示oracle无法使用ASM存储

    环境说明: #主库RAC环境 #备库RAC环境,操作系统AIX 6.1 数据库版本11.2.0.3 报错说明: #主库备份控制文件,传输至备库,备库restore 报错 本篇文档,分为两大阶段:第一阶 ...

  6. Django_重装系统后无法使用 sqlite 数据库报错:com.intellij.execution.ExecutionException: Exception in thread "main" java.lang.ClassNotFoundException: org.sqlite.JDBC

     重装系统后无法使用 sqlite 数据库报错 报错 : com.intellij.execution.ExecutionException: Exception in thread "ma ...

  7. Apache报错:无法使用可靠的服务器域名

    Apache 安装和启动时报错:无法使用可靠的服务器域名,打开Apache配置文件httpd.conf,去除 ServerName 前面的注释即可 1. 报错信息:无法使用可靠的服务器域名 AH005 ...

  8. 关于android sdk中monitor.exe报错的问题

    今天又是被坑的一上午.来总结一下: 1. 首先是找不到monitor的问题: 这个可能是一开始环境配置错误.所以我将android sdk重装了一下就好了 2. 第二个是找到monitor.bat发现 ...

  9. Kvm:启动报错:error: internal error: process exited while connecting to monitor: 2018-11-12T01:47:14.993371Z qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory

    今天有台kvm挂了,物理机启动时报错 很明显看报错显示内存不足,无法分配内存,查看物理机内存使用正常,.xml修改虚机内存后启动依然报错 报错: 这时候需要看一下主机确保可以分配多少内存 sysctl ...

  10. 发布报错:Error ITMS-90635 - Invalid Mach-O in bundle - submitting to App store

    发布报错:Error ITMS-90635 - Invalid Mach-O in bundle - submitting to App store 昨晚上传项目到AppStore,报了这个错,纳尼! ...

随机推荐

  1. Vue学习:1.V标签综合1

    认识V标签 目录 认识V标签 v-text: v-html: v-bind (缩写为 :): v-if / v-else / v-else-if: v-show: v-for: v-model: Vu ...

  2. vuex中的数据在页面刷新后数据消失

    用sessionstorage 或者 localstorage 存储数据 存储: sessionStorage.setItem( '名', JSON.stringify(值) ) 使用: sessio ...

  3. 网络世界的脊柱——OSI七层模型

    简介 OSI代表开放系统互联(Open Systems Interconnection),这是国际标准化组织(ISO)提出的一个概念模型,用于描述网络通信的功能划分.简单来说,OSI模型把复杂的网络通 ...

  4. 工程数学 实验5-MATLAB最优化工具箱的使用

    (1)线性规划应用案例的求解 1.基本要求 通过一个农业生产计划优化安排的实例求解,培养学生解决实际线性规划问题的初步能力:熟悉线性规划的建模过程:掌握Matlab优化工具箱中线性规划函数的调用. 2 ...

  5. mongodb数据库连接格式

    mongodb数据库连接格式 mongodb://账号:密码@mongodb服务器IP:27017/数据库名称

  6. 面试官:Java中缓冲流真的性能很好吗?我看未必

    一.写在开头 上一篇文章中,我们介绍了Java IO流中的4个基类:InputStream.OutputStream.Reader.Writer,那么这一篇中,我们将以四个基类所衍生出来,应对不同场景 ...

  7. python logging去掉selenium大量的日志

    问题 二次封装logging模块,设置级别为DEBUG,默认所有级别的日志都可以收集到:在发起ui自动化,打开浏览器输入网址,进行页面操作时,打印了大量的connectionpool.remote_c ...

  8. iOS登陆界面切换到注册界面并返回的UI设计(简易向)

    功能实现 从登陆界面进入注册界面 从注册界面返回登陆界面 功能实现思路 在网上搜了搜发现各位大神用的是navigation,但个人感觉没(zhen)大(ting)必(bu)要(dong).所以在这里提 ...

  9. 【vue】利用输入框搜索过滤来选择列表

    方法1 <div id="app"> <input type="text" @input="handleInput()" ...

  10. 设备树DTS 学习: 4-uboot 传递 dtb 给 内核

    背景 得到 dtb 文件以后,我们需要想办法下载到 板子中,并给 Linux 内核使用. (高级版本的 uboot也有了 自己使用设备树支持,我们这里不讨论 uboot 使用的设备树) Linux 内 ...