未验证 提交 c6f50c33 编写于 作者: B Bo Zhou 提交者: GitHub

add setup.py for installation (#30)

* add setup.py for installation

* rename agent.py to make it consistent with other framework base

* namespace bug
上级 3c46b7c4
......@@ -11,3 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
generates new PARL python API
"""
from parl.framework import *
from parl.utils import *
from parl.plutils import *
......@@ -11,3 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from parl.framework.model_base import *
from parl.framework.algorithm_base import *
from parl.framework.agent_base import *
......@@ -15,20 +15,20 @@
import paddle.fluid as fluid
import parl.layers as layers
from parl.framework.algorithm_base import Algorithm
from parl.framework.base import Model
from parl.framework.model_base import Model
__all__ = ['ComputationTask']
__all__ = ['Agent']
class ComputationTask(object):
class Agent(object):
"""
A ComputationTask is responsible for the general data flow
A Agent is responsible for the general data flow
outside the algorithm.
A ComputationTask is created in a bottom-up way:
A Agent is created in a bottom-up way:
a. create a Model
b. create an Algorithm with the model as an input
c. define a ComputationTask with the algorithm
c. define a Agent with the algorithm
"""
def __init__(self, algorithm):
......@@ -68,6 +68,6 @@ class ComputationTask(object):
def learn(self, obs, action, reward, next_obs, terminal):
"""pass data to the training program to update model,
this function is the training interface for ComputationTask.
this function is the training interface for Agent.
"""
raise NotImplementedError
......@@ -16,4 +16,4 @@ This file wraps Fluid layers that have parameters to support parameter sharing.
For other layers that don't have parameters, we simply copy them to this namespace.
"""
from paddle.fluid.layers import *
from .layer_wrappers import *
from parl.layers.layer_wrappers import *
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os
import re
from setuptools import setup, find_packages
def _find_packages(prefix=''):
packages = []
path = '.'
prefix = prefix
for root, _, files in os.walk(path):
if '__init__.py' in files:
packages.append(re.sub('^[^A-z0-9_]', '', root.replace('/', '.')))
return packages
setup(
name='parl',
version=0.1,
packages=_find_packages(),
package_data={'': ['*.so']})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册