使用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. 利用Wireshark抓包分析DNS域名解析过程

    一.DNS协议概述   DNS协议也可以称为DNS服务,全称是Domain Name System,即域名系统,和HTTP协议一样,也是一个位于应用层的协议(服务),它是基于运输层的UDP协议的.从D ...

  2. elasticsearch-head插件安装及启动,关闭命令

    启动插件 /elasticsearch-head目录npm run start启动elasticsearch 不能使用root账号 切换账号:su es./bin/elasticsearch 打印日志 ...

  3. DeepFaceLab换脸使用

    将视频转换成图片,从图片中提取人脸,从人脸中学习特征.然后应用模型,先对图片进行换脸,然后把图片合成视频. 1.src视频分解图像 2.dst视频分解图像 3.src提取面部 4.dst提取面部 5. ...

  4. Arduino实现温湿度传感器以及数据上传到云(乐维互联)

    0 准备材料 0.1 ESP-01S 引脚及定义 官方定义: 序号 pin 功能 1 GND 地线 2 IO0/GPIO0 工作模式选择:①悬空:Flash Boot,工作模式 ②下拉:UART Do ...

  5. java的ConCurrentHashMap

    一般的应用的编程,用到ConCurrentHashMap的机会很少,就象大家调侃的一样:只有面试的时候才用得着. 但还是有. 网上关于这个的资料,多如牛毛,大部分是原理分析和简单例子. 原理的核心就一 ...

  6. nginx 信号量

    nginx支持的信号量 TERM, INT fast shutdown QUIT graceful shutdown HUP changing configuration, keeping up wi ...

  7. js中对对象经行判空

    1.for (... in ...) for(var i in obj){ return true; //如果不为空,返回true } return false; //如果为空,返回false 2.J ...

  8. SpringBoot动态数据源配置

    SpringBoot动态数据源配置 序:数据源动态切换流程图如下: 1:pom.xml文件依赖声明 <dependency>   <groupId>org.springfram ...

  9. Android 官方AB Update说明

    Android 官方AB Update说明 A/B 系统更新,也称为无缝更新,用于确保可运行的启动系统在无线 (OTA) 更新期间能够保留在磁盘上.这样可以降低更新之后设备无法启动的可能性,也就是说, ...

  10. arm linux 移植 ffmpeg 库 + x264 + x265

    背景 Ffmpeg 中带有h264的解码,没有编码,需要添加x264.libx264是一个自由的H.264编码库,是x264项目的一部分,使用广泛,ffmpeg的H.264实现就是用的libx264. ...