← Open Source
MorvanZhou

pytorch-A3C

Simple A3C implementation with pytorch + multiprocessing.

Model DevelopmentReinforcement LearningPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
659
Stars
142
Forks
+0
This week
2
Contributors
Created 2018-01-18 · Updated 2026-07-12 · #15365 today
Top developers
MorvanZhouJbwasse2

MorvanZhou/pytorch-A3C is ranked 15,365 with 659 stars.

Same-category comparison

MorvanZhou/pytorch-A3C is ranked 15,365 among these 8 peers; NVIDIA-AI-IOT/CUDA-PointPillars is ranked 15,366.

Same-category comparison
NameRankMetrics
arnoweng/CheXNet15,345
Language:
Python
Stars:
661
Forks:
237
Description:
A pytorch reimplementation of CheXNet.
bbaaii/DreamDiffusion15,356
Language:
Python
Stars:
660
Forks:
80
Description:
Implementation of “DreamDiffusion: Generating High-Quality Images from Brain EEG Signals”.
v-iashin/video_features15,360
Language:
Python
Stars:
660
Forks:
112
Description:
Extract video features from raw videos using multiple GPUs. We support RAFT flow frames as well as S3D, I3D, R(2+1)D, VGGish, CLIP, and TIMM models.
yzhao062/combo15,361
Language:
Python
Stars:
660
Forks:
105
Description:
(AAAI' 20) A Python Toolbox for Machine Learning Model Combination.
NVIDIA-AI-IOT/CUDA-PointPillars15,366
Language:
Python
Stars:
659
Forks:
185
Description:
A project demonstrating how to use CUDA-PointPillars to deal with cloud points data from lidar.
cpnota/autonomous-learning-library15,370
Language:
Python
Stars:
659
Forks:
72
Description:
A PyTorch library for building deep reinforcement learning agents.
motiwari/BanditPAM15,373
Language:
C++
Stars:
659
Forks:
52
Description:
BanditPAM C++ implementation and Python package.
reservoirpy/reservoirpy15,376
Language:
Python
Stars:
659
Forks:
156
Description:
A simple and flexible code for Reservoir Computing architectures like Echo State Networks.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryReinforcement Learning
KeywordsRL
Stars659
Forks142
Contributors2
Created date2018-01-18
Updated date2026-07-12
Stars in 1 day0
Stars in 7 days0
Rank15,365
Previous rank15,179
Rank change-186
7-day stars rank14,957
Previous 7-day stars rank14,962
7-day stars rank change5
Total stars rank15,578
Previous total stars rank15,551
Total stars rank change-27
CountryChina
README summary

Simple implementation of Reinforcement Learning (A3C) using Pytorch This is a toy example of using multiprocessing in Python to asynchronously train a neural network to play discrete action CartPole and continuous action Pendulum games. The asynchronous algorithm I used is called Asynchronous Advantage Actor-Critic or A3C. I believe it would be the simplest toy implementation you can find at the moment (2018-01). What are the main focuses in this implementation? Pytorch + multiprocessing (NOT threading) for parallel training Both

discrete and continuous action environments To be simple and easy to dig into the code (less than 200 lines) Reason of using Pytorch instead of Tensorflow Both of them are great for building your customized neural network. But to work with multiprocessing, Tensorflow is not that great due to its low compatibility with multiprocessing. I have an implementation of Tensorflow A3C build on threading. I even tried to implement distributed Tensorflow. However, the distributed version is for cluster computing which

I don't have. When using only one machine, it is slower than threading version I wrote. Fortunately, Pytorch gets the multiprocessing compatibility. I went through many Pytorch A3C examples (there, there and there). They are great but too complicated to dig into the code. Therefore, this is my motivation to write my simple example codes. BTW, if you are interested to learn Pytorch, there is my simple tutorial code with many visualizations. I also made the tensorflow tutorial (same as

pytorch) available in here. py: optimizer that shares its parameters in parallel utils. py: useful function that can be used more than once discrete_A3C. py: CartPole, neural net and training for discrete action space continuous_A3C. py: Pendulum, neural net and training for continuous action space CartPole result Pendulum result Dependencies pytorch >= 0.

Frequently asked questions

How many stars and forks are recorded?

MorvanZhou/pytorch-A3C has 659 stars and 142 forks.

What is the repository rank?

MorvanZhou/pytorch-A3C is ranked 15,365.

What language and category are recorded?

MorvanZhou/pytorch-A3C has 659 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

MorvanZhou/pytorch-A3C is compared with NVIDIA-AI-IOT/CUDA-PointPillars, ranked 15,366 with 659 stars.

README

Simple implementation of Reinforcement Learning (A3C) using Pytorch

This is a toy example of using multiprocessing in Python to asynchronously train a neural network to play discrete action CartPole and continuous action Pendulum games. The asynchronous algorithm I used is called Asynchronous Advantage Actor-Critic or A3C.

I believe it would be the simplest toy implementation you can find at the moment (2018-01).

What are the main focuses in this implementation?

  • Pytorch + multiprocessing (NOT threading) for parallel training
  • Both discrete and continuous action environments
  • To be simple and easy to dig into the code (less than 200 lines)

Reason of using Pytorch instead of Tensorflow

Both of them are great for building your customized neural network. But to work with multiprocessing, Tensorflow is not that great due to its low compatibility with multiprocessing. I have an implementation of Tensorflow A3C build on threading. I even tried to implement distributed Tensorflow. However, the distributed version is for cluster computing which I don't have. When using only one machine, it is slower than threading version I wrote.

Fortunately, Pytorch gets the multiprocessing compatibility. I went through many Pytorch A3C examples (there, there and there). They are great but too complicated to dig into the code. Therefore, this is my motivation to write my simple example codes.

BTW, if you are interested to learn Pytorch, there is my simple tutorial code with many visualizations. I also made the tensorflow tutorial (same as pytorch) available in here.

Codes & Results

  • shared_adam.py: optimizer that shares its parameters in parallel
  • utils.py: useful function that can be used more than once
  • discrete_A3C.py: CartPole, neural net and training for discrete action space
  • continuous_A3C.py: Pendulum, neural net and training for continuous action space

CartPole result

Pendulum result

Dependencies

  • pytorch >= 0.4.0
  • numpy
  • gym
  • matplotlib
Nearby in the ranking
Similar items