使用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. ClickHouse + ClickVisual 构建日志平台

    越来越多的互联网公司开始尝试 ClickHouse 存储日志,比如映客.快手.携程.唯品会.石墨文档,但是 ClickHouse 存储日志缺少对应的可视化方案,石墨文档开源了 ClickVisual ...

  2. nginx虚拟主机实战

    基于nginx部署网站 虚拟主机指的就是一个独立的站点,具有独立的域名,有完整的www服务,例如网站.FTP.邮件等. Nginx支持多虚拟主机,在一台机器上可以运行完全独立的多个站点. 一.为什么配 ...

  3. Mysql性能优化(详解)

    引言 今天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于数据库的性能,这并不只是DBA才需要担心的事,而这更是我们程序员需要去关注的事情.当我们去设计数据库表结构,对操 ...

  4. vite+vue3+ts+elementPlus前端框架搭建 [一]

    记录下搭建vite + vue3 + ts + elementPlus项目的过程及遇到的问题. 建议使用pnpm安装依赖,npm切换到pnpm 链接地址:[https://www.pnpm.cn/in ...

  5. UniTask入门指南:简化Unity中的异步编程

    UniTask入门指南:简化Unity中的异步编程 介绍: UniTask是一个轻量级.高性能的异步编程库,专门针对Unity开发进行了优化.与Unity标准的Task系统相比,UniTask提供了更 ...

  6. http/https请求中如何使用Token

    简介 Token就像是一个暗号,使用它就可以访问一些需要认证的系统或者服务. 那么,如何在http(s)中使用Token值呢? 使用方法 在http请求的头部字段中添加key-value.key为&q ...

  7. 集成学习与随机森林(二)Bagging与Pasting

    Bagging 与Pasting 我们之前提到过,其中一个获取一组不同分类器的方法是使用完全不同的训练算法.另一个方法是为每个预测器使用同样的训练算法,但是在训练集的不同的随机子集上进行训练.在数据抽 ...

  8. TI AM64x工业核心板规格书(双核ARM Cortex-A53 + 单/四核Cortex-R5F + 单核Cortex-M4F,主频1GHz)

    1 核心板简介 创龙科技SOM-TL64x是一款基于TI Sitara系列AM64x双核ARM Cortex-A53 + 单/四核Cortex-R5F + 单核Cortex-M4F设计的多核工业级核心 ...

  9. SpringCloud学习篇

    什么是SpringCloud Spring cloud 流应用程序启动器是基于 Spring Boot 的 Spring 集成应用程序,提供与外部系统的集成.Spring cloud Task,一个生 ...

  10. react为什么不用数组的下标来绑定key

    最近在看一本名叫<深入浅出React和Redux>这一书,里面谈到了react的dom更新比对,记录一下. 假设有这么一个组件 <ul> <ListItem text=& ...