mirror of
https://github.com/wassname/DeepRL.git
synced 2026-09-10 11:40:58 +08:00
Package the project
This commit is contained in:
@@ -57,12 +57,12 @@ Prediction is sampled after 110K iterations, and I only implemented one-step tra
|
||||
* MacOS 10.12 or Ubuntu 16.04
|
||||
* PyTorch v0.4.0
|
||||
* Python 3.6, 3.5 or 2.7 (deprecated)
|
||||
* Core dependencies: `pip install -r requirements.txt`
|
||||
* Core dependencies: `pip install -e .`
|
||||
* Optional: [Roboschool](https://github.com/openai/roboschool), [DeepMind Control Suite](https://github.com/deepmind/dm_control)+[DMControl2Gym](dm_control2gym)
|
||||
|
||||
# Usage
|
||||
|
||||
```main.py``` contains examples for all the implemented algorithms
|
||||
```examples.py``` contains examples for all the implemented algorithms
|
||||
|
||||
# References
|
||||
* [Human Level Control through Deep Reinforcement Learning](https://www.nature.com/nature/journal/v518/n7540/full/nature14236.html)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
from .agent import *
|
||||
from .component import *
|
||||
from .model import *
|
||||
from .network import *
|
||||
from .utils import *
|
||||
@@ -4,14 +4,9 @@
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
|
||||
import numpy as np
|
||||
from network import *
|
||||
from utils import *
|
||||
from component import *
|
||||
from ..network import *
|
||||
from ..component import *
|
||||
from .BaseAgent import *
|
||||
import pickle
|
||||
import os
|
||||
import time
|
||||
|
||||
class A2CAgent(BaseAgent):
|
||||
def __init__(self, config):
|
||||
@@ -4,14 +4,10 @@
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
|
||||
from network import *
|
||||
from component import *
|
||||
from utils import *
|
||||
import numpy as np
|
||||
from ..network import *
|
||||
from ..component import *
|
||||
from ..utils import *
|
||||
import time
|
||||
import os
|
||||
import pickle
|
||||
import torch
|
||||
from .BaseAgent import *
|
||||
|
||||
class CategoricalDQNAgent(BaseAgent):
|
||||
@@ -4,14 +4,8 @@
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
|
||||
import numpy as np
|
||||
import torch.multiprocessing as mp
|
||||
from network import *
|
||||
from utils import *
|
||||
from component import *
|
||||
import pickle
|
||||
import os
|
||||
import time
|
||||
from ..network import *
|
||||
from ..component import *
|
||||
from .BaseAgent import *
|
||||
|
||||
class DDPGAgent(BaseAgent):
|
||||
@@ -4,14 +4,10 @@
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
|
||||
from network import *
|
||||
from component import *
|
||||
from utils import *
|
||||
import numpy as np
|
||||
from ..network import *
|
||||
from ..component import *
|
||||
from ..utils import *
|
||||
import time
|
||||
import os
|
||||
import pickle
|
||||
import torch
|
||||
from .BaseAgent import *
|
||||
|
||||
class DQNAgent(BaseAgent):
|
||||
@@ -4,14 +4,9 @@
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
|
||||
from network import *
|
||||
from component import *
|
||||
from utils import *
|
||||
import numpy as np
|
||||
import time
|
||||
import os
|
||||
import pickle
|
||||
import torch
|
||||
from ..network import *
|
||||
from ..component import *
|
||||
from ..utils import *
|
||||
from .BaseAgent import *
|
||||
|
||||
class NStepDQNAgent(BaseAgent):
|
||||
@@ -4,14 +4,8 @@
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
|
||||
import numpy as np
|
||||
import torch.multiprocessing as mp
|
||||
from network import *
|
||||
from utils import *
|
||||
from component import *
|
||||
import pickle
|
||||
import os
|
||||
import time
|
||||
from ..network import *
|
||||
from ..component import *
|
||||
from .BaseAgent import *
|
||||
|
||||
class PPOAgent(BaseAgent):
|
||||
@@ -4,14 +4,10 @@
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
|
||||
from network import *
|
||||
from component import *
|
||||
from utils import *
|
||||
import numpy as np
|
||||
from ..network import *
|
||||
from ..component import *
|
||||
from ..utils import *
|
||||
import time
|
||||
import os
|
||||
import pickle
|
||||
import torch
|
||||
from .BaseAgent import *
|
||||
|
||||
class QuantileRegressionDQNAgent(BaseAgent):
|
||||
@@ -1,7 +1,6 @@
|
||||
# based on https://github.com/openai/baselines/blob/master/baselines/common/atari_wrappers.py
|
||||
|
||||
import numpy as np
|
||||
from collections import deque
|
||||
import gym
|
||||
from gym import spaces
|
||||
from gym.spaces import Box
|
||||
@@ -5,9 +5,6 @@
|
||||
#######################################################################
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
import random
|
||||
import torch.multiprocessing as mp
|
||||
|
||||
class Replay:
|
||||
def __init__(self, memory_size, batch_size):
|
||||
@@ -3,15 +3,11 @@
|
||||
# Permission given to modify the code as long as you keep this #
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
import gym
|
||||
import sys
|
||||
import numpy as np
|
||||
from .atari_wrapper import *
|
||||
import multiprocessing as mp
|
||||
import sys
|
||||
from .bench import Monitor
|
||||
from utils import *
|
||||
import datetime
|
||||
from ..utils import *
|
||||
import uuid
|
||||
|
||||
class BaseTask:
|
||||
+2
-8
@@ -6,20 +6,14 @@
|
||||
|
||||
__all__ = ['acvp_train']
|
||||
|
||||
import torch
|
||||
from torch.autograd import Variable
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
import numpy as np
|
||||
import pickle
|
||||
import torchvision
|
||||
from skimage import io
|
||||
from collections import deque
|
||||
import gym
|
||||
import torch.optim
|
||||
from utils import *
|
||||
from deep_rl.utils import *
|
||||
from tqdm import tqdm
|
||||
from network import *
|
||||
from deep_rl.network import *
|
||||
|
||||
class Network(nn.Module, BaseNet):
|
||||
def __init__(self, num_actions, gpu=0):
|
||||
@@ -6,10 +6,9 @@
|
||||
|
||||
__all__ = ['generate_dataset']
|
||||
|
||||
import logging
|
||||
from agent import *
|
||||
from component import *
|
||||
from utils import *
|
||||
from ..agent import *
|
||||
from ..component import *
|
||||
from deep_rl.utils import *
|
||||
from skimage import io
|
||||
|
||||
def episode(agent, task):
|
||||
@@ -7,7 +7,6 @@
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
import numpy as np
|
||||
|
||||
class BaseNet:
|
||||
def set_gpu(self, gpu):
|
||||
@@ -8,7 +8,6 @@ import numpy as np
|
||||
import pickle
|
||||
import os
|
||||
import datetime
|
||||
import uuid
|
||||
import torch
|
||||
try:
|
||||
# python >= 3.5
|
||||
@@ -3,7 +3,6 @@
|
||||
# Permission given to modify the code as long as you keep this #
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
import torch
|
||||
import numpy as np
|
||||
|
||||
class BaseNormalizer:
|
||||
@@ -1,7 +1,7 @@
|
||||
# Adapted from https://github.com/openai/baselines/blob/master/baselines/results_plotter.py
|
||||
|
||||
import numpy as np
|
||||
import component
|
||||
from ..component import *
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -4,11 +4,7 @@
|
||||
# declaration at the top #
|
||||
#######################################################################
|
||||
|
||||
import logging
|
||||
from agent import *
|
||||
from component import *
|
||||
from utils import *
|
||||
from model import *
|
||||
from deep_rl import *
|
||||
|
||||
## cart pole
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
torch>=0.4.0
|
||||
torchvision>=0.2.1
|
||||
gym>=0.10.5
|
||||
atari-py>=0.1.1
|
||||
opencv-python>=3.4.0.12
|
||||
tensorboardX==1.1
|
||||
scikit-image>=0.13.1
|
||||
tqdm>=4.23.0
|
||||
pandas>=0.22.0
|
||||
pathlib2>=1.0.1;python_version <= '2.7'
|
||||
pathlib>=1.0.1;python_version >= '3.5'
|
||||
seaborn>=0.8.1
|
||||
@@ -0,0 +1,31 @@
|
||||
from setuptools import setup, find_packages
|
||||
import sys
|
||||
|
||||
if sys.version.startswith('2.7'):
|
||||
pathlib = 'pathlib2>=1.0.1'
|
||||
elif sys.version.startswith('3.5') or sys.version.startswith('3.6'):
|
||||
pathlib = 'pathlib>=1.0.1'
|
||||
else:
|
||||
raise Exception('Only Python 2.7, 3.5 and 3.6 are supported')
|
||||
|
||||
setup(name='deep_rl',
|
||||
packages=[package for package in find_packages()
|
||||
if package.startswith('deep_rl')],
|
||||
install_requires=[
|
||||
'torch>=0.4.0',
|
||||
'torchvision>=0.2.1',
|
||||
'gym>=0.10.5',
|
||||
'atari-py>=0.1.1',
|
||||
'opencv-python>=3.4.0.12',
|
||||
'tensorboardX==1.1',
|
||||
'scikit-image>=0.13.1',
|
||||
'tqdm>=4.23.0',
|
||||
'pandas>=0.22.0',
|
||||
'seaborn>=0.8.1',
|
||||
pathlib
|
||||
],
|
||||
description="Highly modularized implementation of popular deep RL algorithms",
|
||||
author="Shangtong Zhang",
|
||||
url='https://github.com/ShangtongZhang/DeepRL',
|
||||
author_email="zhangshangtong.cpp@gmail.com",
|
||||
version="0.2")
|
||||
Reference in New Issue
Block a user