04 2022 档案
摘要:def to_array_as(x, y): if isinstance(x, torch.Tensor) and isinstance(y, np.ndarray): return x.detach().cpu().numpy().astype(y.dtype) elif isinstance(x
阅读全文
摘要:配置强化学习常用的Atari环境时,出现以下错误:Exception: ROM is missing for xxxx, see https://github.com/openai/atari-py 方法一按照错误提示,我们进入此网页https://github.com/openai/atari-p
阅读全文
摘要:def log_prob(self, value, pre_tanh_value=None): """ :param value: some value, x :param pre_tanh_value: arctanh(x) :return: """ if pre_tanh_value is No
阅读全文
摘要:def sample(self, return_pretanh_value=False): """ Gradients will and should *not* pass through this operation. See https://github.com/pytorch/pytorch/
阅读全文
摘要:转载注明出处:PyTorch学习系列(十)--如何在训练时固定一些层? - CodeTutor - CSDN博客 Pytorch 保存和加载模型的代码: 保存模型: torch.save(net1.state_dict(), 'net_params.pkl') # 只保存神经网络的模型参数 与之对应
阅读全文
摘要:什么是激励函数(激活函数):在神经网络中原本输入输出都是线性关系,但现实中,许多的问题是非线性的(比如,房价问题中,房价不可能随着房子面积的增加一直线性增加),这个时候就神经网络的线性输出,再经过激励函数,便使得原本线性的关系变成非线性了,增强了神经网络的性能。 常用的激励函数(激活函数):relu
阅读全文
摘要:def to_numpy(self) -> 'Batch': """Change all torch.Tensor to numpy.ndarray in-place.""" for k, v in self.items(): if isinstance(v, torch.Tensor): self
阅读全文
摘要:PyTorch中的torch.nn.Parameter() 首先可以把这个函数理解为类型转换函数,将一个不可训练的类型Tensor转换成可以训练的类型parameter并将这个parameter绑定到这个module里面(net.parameter()中就有这个绑定的parameter,所以在参数优
阅读全文
摘要:nn.ReLU(inplace=True) 参数inplace=True:inplace为True,将会改变输入的数据 ,否则不会改变原输入,只会产生新的输出inplace:can optionally do the operation in-place. Default: False注: 产生的计
阅读全文
摘要:def get_env_shape(task : str) -> Tuple[int, int]: env = get_env(task) obs_dim = env.observation_space.shape action_space = env.action_space if len(obs
阅读全文
摘要:def sample_by_num(data_dict: dict, num: int): """ Sample num trajs from data_dict. """ samples = {} for k, v in data_dict.items(): if k == "index": sa
阅读全文
摘要:# Prevent concurrent FileExistsErrortry: if not os.path.exists(to_path): os.mkdir(to_path)except Exception: passfrom offlinerl/neorl
阅读全文
摘要:data_key = "-".join([task_name_version, data_type, str(least_num), train_or_val])output: 'HalfCheetah-v3-low-100-train'from: offlinerl/neorl
阅读全文
摘要:def find_remote_file(data_json, task_name_version, data_type, traj_num, train_or_val): """ Find appropriate least dataset in remote (data_json) accord
阅读全文
摘要:def get_file_md5(filename): if not os.path.isfile(filename): return my_hash = hashlib.md5() f = open(filename, 'rb') while True: b = f.read(8096) #set
阅读全文
摘要:登录网站的用户名密码数据库是不会以明文密码进行存储的,简单的,可以通过摘要算法得到一个长度固定的数据块。 1、摘要算法格式: import hashlib #导入hashlib模块 md = hashlib.md5() #获取一个md5加密算法对象md.update('how to use md5
阅读全文
摘要:def log_path(): import offlinerl log_path = os.path.abspath(os.path.join(offlinerl.__file__,"../../","offlinerl_tmp")) create_dir(log_path) return log
阅读全文
摘要:from collections import OrderedDictdel_attr = ["function", "module"]def parse_config(cfg_module): args = [ i for i in dir(cfg_module) if not i.startsw
阅读全文
摘要:Description Python string method startswith() checks whether string starts with str, optionally restricting the matching with the given indices start
阅读全文
摘要:dir() is a powerful inbuilt function in Python3, which returns list of the attributes and methods of any object (say functions , modules, strings, lis
阅读全文
摘要:It's easy , just enter "pwd " in the terminal.
阅读全文
摘要:python3 how to get the elements of the dict.keys() and dict.values() Python 3 mydict = {'a': 'one', 'b': 'two', 'c': 'three'} mykeys = [*mydict] #list
阅读全文
摘要:1.安装Mujoco,与在本地Ubuntu上安装类似。 2.当测试时,如下:(可能需要下载mjkey.txt到mujoco200,mujoco200/bin) 3. 安装mujoco_py: pip install mujoco_py==2.0.2.10 4. 当测试时出现: 5. 下载mjkey.
阅读全文
摘要:1. 下载安装包: https://www.anaconda.com/products/distribution#Downloads 通过 scp ~/Downloads/ g8: ~/ 把下载在本地的安装包上传到服务器g8节点 2. 在当前路径下,执行命令: bash Anaconda3-2021
阅读全文
摘要:怀疑是因为安装了和cuda不匹配的torch 导致的,本地的ubuntu是cuda 11.0,安装了cuda 11.3. 只能删除虚拟环境,重新安装,根据提示逐步安装 pip install torch
阅读全文
摘要:在安装好mujoco,mujoco_py的基础上,安装d4rl,D4RL的github:https://github.com/rail-berkeley/d4rl 有介绍安装方法,但直接安装会报各种错误。 1.先安装两个库文件,避免报错 pip install absl-py pip install
阅读全文
摘要:自从deepmind收购Mujoco后,之前在服务器上配置的Mujoco就出现问题了,加之因offlinerl需安装d4rl,依赖mujoco,因此如果mujoco安装失败,后续的安装难以开展。 经过多番尝试,终于首先在本地ubuntu上安装成功mujoco,为后续在服务器上安装探索了路径。 环境:
阅读全文
摘要:原因:系统缺少overleaf使用的字体 “Lucida Console”, 附图1中可以查看到使用字体的详细情况;解决办法:安装字体"Lucida Console", 我随便找个网址下载了该字体, downcc网站(http://www.downcc.com/font/246383.html),
阅读全文