PaddlePaddle / PARL

A high-performance distributed training framework for Reinforcement Learning

Home Page:https://parl.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

求助:macOs m1运行parl DQN demo时报错

odehui opened this issue · comments

commented

os:mac m1
parl:2.2.1
paddlepaddle:2.4.2
python:3.8.16

我在运行https://github.com/PaddlePaddle/PARL/tree/develop/examples/DQN中的代码的时候,首先是报错:

    RuntimeError: 
    An attempt has been made to start a new process before the
    current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

google了下大概是多线程初始化的一个错误
我修改了源码,找到parl/utils/utils.py"文件中line 134为if _IS_WINDOWS: check_installed_framework_in_windows()这句代码
在前面加上了:if name == 'main':。解决了这个bug。

然后我再运行这份DQN代码,出现了其他的WARNING与ERROR

/Users/odh-server/opt/anaconda3/envs/py38/bin/python /Users/odh-server/workplace/pycharm/DQN/train.py
[05-10 03:17:58 MainThread @logger.py:242] Argv: /Users/odh-server/workplace/pycharm/DQN/train.py
[05-10 03:17:58 MainThread @init.py:37] WRN No deep learning framework was found, but it's ok for parallel computation.
/Users/odh-server/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pkg_resources/init.py:2804: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
/Users/odh-server/opt/anaconda3/envs/py38/lib/python3.8/site-packages/paddle/fluid/proto/framework_pb2.py:19: DeprecationWarning: Call to deprecated create function FileDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
DESCRIPTOR = _descriptor.FileDescriptor(
/Users/odh-server/opt/anaconda3/envs/py38/lib/python3.8/site-packages/paddle/fluid/proto/framework_pb2.py:33: DeprecationWarning: Call to deprecated create function EnumValueDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
_descriptor.EnumValueDescriptor(
/Users/odh-server/opt/anaconda3/envs/py38/lib/python3.8/site-packages/paddle/fluid/proto/framework_pb2.py:27: DeprecationWarning: Call to deprecated create function EnumDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
_ATTRTYPE = _descriptor.EnumDescriptor(
/Users/odh-server/opt/anaconda3/envs/py38/lib/python3.8/site-packages/paddle/fluid/proto/framework_pb2.py:270: DeprecationWarning: Call to deprecated create function FieldDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
_descriptor.FieldDescriptor(
/Users/odh-server/opt/anaconda3/envs/py38/lib/python3.8/site-packages/paddle/fluid/proto/framework_pb2.py:263: DeprecationWarning: Call to deprecated create function Descriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
_VERSION = _descriptor.Descriptor(
Traceback (most recent call last):
File "/Users/odh-server/workplace/pycharm/DQN/train.py", line 21, in
from cartpole_model import CartpoleModel
File "/Users/odh-server/workplace/pycharm/DQN/cartpole_model.py", line 21, in
class CartpoleModel(parl.Model):
AttributeError: module 'parl' has no attribute 'Model'

第三行警告消息:WRN No deep learning framework was found, but it's ok for parallel computation.
还有最后一行:AttributeError: module 'parl' has no attribute 'Model' 是关键

parl里面明明有Model但是为什么会报错找不到呢。

复现代码的过程中遇到了这个错误。恳请帮忙康康此问题,万分感谢🙏

commented

我今天在google colab上跑了这份代码,用的python3.8, parl最新版,paddle=1.8.5。os:Ubuntu 20.04.5 LTS
同样也是报错AttributeError: module 'parl' has no attribute 'Model'

os:mac m1 paddlepaddle:2.3.1 python3.7 parl:2.2.1 没有报错