stable-baselines | OpenAI Baselines , implementations of reinforcement | Reinforcement Learning library

 by   Stable-Baselines-Team Python Version: v2.10.1 License: MIT

kandi X-RAY | stable-baselines Summary

kandi X-RAY | stable-baselines Summary

stable-baselines is a Python library typically used in Artificial Intelligence, Reinforcement Learning, Deep Learning, Pytorch, Tensorflow applications. stable-baselines has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub.

Stable Baselines is a set of improved implementations of reinforcement learning algorithms based on OpenAI Baselines. You can read a detailed presentation of Stable Baselines in the Medium article. These algorithms will make it easier for the research community and industry to replicate, refine, and identify new ideas, and will create good baselines to build projects on top of. We expect these tools will be used as a base around which new ideas can be added, and as a tool for comparing a new approach against existing ones. We also hope that the simplicity of these tools will allow beginners to experiment with a more advanced toolset, without being buried in implementation details. Note: despite its simplicity of use, Stable Baselines (SB) assumes you have some knowledge about Reinforcement Learning (RL). You should not utilize this library without some practice. To that extent, we provide good resources in the documentation to get started with RL.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              stable-baselines has a highly active ecosystem.
              It has 243 star(s) with 52 fork(s). There are 10 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              stable-baselines has no issues reported. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of stable-baselines is v2.10.1

            kandi-Quality Quality

              stable-baselines has 0 bugs and 0 code smells.

            kandi-Security Security

              stable-baselines has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              stable-baselines code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              stable-baselines is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              stable-baselines releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              stable-baselines saves you 6473 person hours of effort in developing the same functionality from scratch.
              It has 13458 lines of code, 1113 functions and 143 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed stable-baselines and discovered the below as its top functions. This is intended to give you an instant insight into stable-baselines implemented functionality, and help decide if they suit your requirements.
            • Setup the ACER model
            • Compute the q retrace
            • Convert a tensor to a sequence of n_steps
            • Get tensor by index
            • Setup the model
            • Apply stats to stats_updates
            • Compute and apply loss
            • Minimize the loss function
            • Train the graph
            • Learn the model
            • Train the PPO1 model
            • Setup the PPO2 model
            • Run an experiment
            • Setup the A2C model
            • Compute the probability of an observation
            • Run the model
            • Run the optimizer
            • Calculate the mlp extractor
            • Set the current environment
            • Evaluate policy
            • Make the activation matrix
            • Test the distribution
            • Example demo
            • Create criticics
            • Run the main loop
            • Write a dict of key - value pairs
            Get all kandi verified functions for this library.

            stable-baselines Key Features

            No Key Features are available at this moment for stable-baselines.

            stable-baselines Examples and Code Snippets

            No Code Snippets are available at this moment for stable-baselines.

            Community Discussions

            QUESTION

            AttributeError: 'DummyVecEnv' object has no attribute 'shape'
            Asked 2021-Jan-27 at 12:29

            I'm trying to create an environment for my reinforcement learning algorithm, however, there seems a bit of a problem in case of when calling the PPOPolicy. For this I developed the following environment envFru:

            ...

            ANSWER

            Answered 2021-Jan-27 at 12:29

            Are you sure, this is your actual code? In the code snippet above, the name PPOPolicy is not even defined. We would need to see the code of PPOPolicy. Obviously its constructor (its __init__ method) expects something as its first argument which has a shape arttribute - so I guess, it expects a pandas dataframe. Your envF does not have a shape attribute, so this leads to the error.

            Just judging from the names in your snippet, I guess you should write

            Source https://stackoverflow.com/questions/65918970

            QUESTION

            Python - How to get more info about SyntaxError?
            Asked 2020-Nov-12 at 20:45

            I am trying to run Python code on Ubuntu image container with all required libraries.

            ...

            ANSWER

            Answered 2020-Nov-12 at 20:45

            QUESTION

            %%writefile magic command in regular Python
            Asked 2020-Oct-11 at 07:55

            I am copying Python code from Jupyter Notebook to .py file to run it from a terminal. I could not find a way how this line should be implemented:

            ...

            ANSWER

            Answered 2020-Oct-11 at 07:55

            QUESTION

            How to load a trained TF1 protobuf model into TF2?
            Asked 2020-Sep-10 at 20:33

            Update: This is a bug in tensorflow. Track progress here.

            I have created and trained a model using stable-baselines, which uses Tensorflow 1. Now I need to use this trained model in an environment where I only have access to Tensorflow 2 or PyTorch. I figured I would go with Tensorflow 2 as the documentation says I should be able to load models created with Tensorflow 1.

            I can load the pb file without a problem in Tensorflow 1:

            ...

            ANSWER

            Answered 2020-Sep-04 at 08:09

            You can use compatibility layer of TensorFlow.

            All v1 functionality is available under tf.compat.v1 namespace.

            I managed to load your model in TF 2.1 (nothing special about that version, I just have it locally):

            Source https://stackoverflow.com/questions/63656778

            QUESTION

            OpenCV gives an error in the Jupyter Notebook but works in Python CLI
            Asked 2020-Jul-08 at 18:38

            So, I am using OpenCV in python. I installed opencv-python using pip install opencv-python. Whenever I try importing OpenCV in my terminal using the Python CLI (run python in command prompt and then run import cv2) it works perfectly fine, but when I try importing it in Jupyter Notebook/Jupyter Lab (also using import cv2), it gives the following error:

            ...

            ANSWER

            Answered 2020-Jul-08 at 18:38

            Yes! I got the answer!!

            So, when I looked at __init__.py in the cv2 library, I found this line:

            Source https://stackoverflow.com/questions/62786036

            QUESTION

            How to use a custom Openai gym environment with Openai stable-baselines RL algorithms?
            Asked 2019-Nov-21 at 13:50

            I've been trying to use a custom openai gym environment for fixed wing uav from https://github.com/eivindeb/fixed-wing-gym by testing it with the openai stable-baselines algorithms but I have been running into issues for several days now. My baseline is the CartPole example Multiprocessing: Unleashing the Power of Vectorized Environments from https://stable-baselines.readthedocs.io/en/master/guide/examples.html#multiprocessing-unleashing-the-power-of-vectorized-environments since I would need to supply arguments and I am trying to use multiprocessing which I believe this example is all I need.

            I have modified the baseline example as follows:

            ...

            ANSWER

            Answered 2019-Nov-21 at 13:50

            You created a custom environment alright, but you didn't register it with the openai gym interface. That's what the env_id refers to. All environments in gym can be set up by calling their registered name.

            So basically what you need to do is follow the set up instructions here and create the appropriate __init__.py and setup.py scripts, and follow the same file structure.

            At the end locally install your package using pip install -e . from within your environment directory.

            Source https://stackoverflow.com/questions/58941164

            QUESTION

            GitHub doesn't allow forking fork of fork if you have fork?
            Asked 2019-Nov-14 at 08:51

            There are 3 repos:

            1. There is OpenAI Baselines repo: https://github.com/openai/baselines.
            2. I have its fork: https://github.com/sytelus/baselines.
            3. Another user has its fork: https://github.com/hill-a/stable-baselines.

            Now I want to fork #3, i.e. https://github.com/hill-a/stable-baselines. However, GitHub isn't allowing it by saying "You've already forked stable-baselines". I actually don't have fork of stable-baselines but only its parent. So message is wrong. In any case, this doesn't make sense to me at all. The #3 has now diverged immensely and has many different features. I want to send pull request to both. However, without having both forks I can't do it.

            Any solution?

            ...

            ANSWER

            Answered 2019-Nov-14 at 08:51

            While @VonC has provided the fact that it's not possible to have two different fork of the forks, I want to add two things to this answer:

            First, this seems to be an unfortunate design decision by GitHub and there is no technical reason for not allowing this. Every repo should be able to point to whatever upstream it wants to enable PR mechanism to work. For a platform that intends to promote collaborative development, this is quite a mind-boggling limitation.

            Second, I want to provide a way so you can still do this but with extra work from your part. Let's say there is repo R and their two forks R1 and R2 by some users. You want to be able to work on R, R1 and R2 and send them your pull requests. Here's how you can accomplish this:

            1. Clone R locally and then create new github repo from it. This would mean that your repo would not appear as fork and you can't send PRs from it to R.
            2. Add remotes for each fork using git remote add r1_fork https://github.com//R1.git.
            3. For each fork create its own branch using git checkout -b r1_fork.
            4. In each branch, fetch the changes from that fork: git fetch r1_fork.
            5. After fetch do hard reset in that branch for that remote: git reset --hard r1_fork/master.

            Now you can work in branch for each individual remote and make changes. However, you can't send PRs yet. For sending PRs, you will need to fork that repo, then merge changes from your branch to the fork, send PR and delete the fork. Obviously, this is very non-ideal but this is what we got until GitHub fixes their stuff.

            Source https://stackoverflow.com/questions/58655547

            QUESTION

            Python Reinforcement Learning - Tuple Observation Space
            Asked 2019-Oct-17 at 15:01

            I've created a custom openai gym environment with a discrete action space and a somewhat complicated state space. The state space has been defined as a Tuple because it combines some dimensions which are continuous and others which are discrete:

            ...

            ANSWER

            Answered 2019-Oct-17 at 15:01

            You may want to try rllib package of ray, which is extended in UC at Berkeley.

            https://rise.cs.berkeley.edu/projects/ray/

            It includes a lot of implemented algorithms:

            and it is quote easy to use. You just need to add your environment which is fully explained at: https://ray.readthedocs.io/en/latest/rllib-env.html

            Source https://stackoverflow.com/questions/58306485

            QUESTION

            convert stable-baselines tensorflow model to tensorflowjs
            Asked 2019-Sep-15 at 21:26

            I am trying to convert the underlying tensorflow model from stable-baselines to tensorflowjs to be able to use the model on the browser. But I could not make the conversion work

            I followed this github issue to create the necessary tensorflow files using the code:

            ...

            ANSWER

            Answered 2019-Sep-15 at 21:26

            I posted the question as an issue in stable-baselines and they answered. I will copy here as a reference to others:

            You are trying to save the action placeholder used in PPO training (part of PPO agent), but for inference you only need the trained policy and its placeholders (model.act_model). The code on colab runs without errors by changing call to simple_save to this:

            tf.saved_model.simple_save(model.sess, checkpoint_name, inputs={"obs": model.act_model.obs_ph}, outputs={"action": model.act_model._policy_proba})

            The value of _policy_proba depends on the environment/algorithm.

            Source https://stackoverflow.com/questions/57934683

            QUESTION

            What is the defualt architecture for an MlpLnLstmPolicyin stable-baselines?
            Asked 2019-Aug-07 at 04:20

            Stable-baselines allows you to define a custom network architetcure; this varies the number of shared layers, value layers, policy layers and their respective sizes.

            Stable-baselines also has default policies. What is the default network architecture for an MlpLnLstmPolicy network? In addition, it would be good to know the activations between layers and any dropout used, if applicable. I couldn't seem to find any of this information in the documentation.

            ...

            ANSWER

            Answered 2019-Aug-07 at 04:20

            The definition of the class MlpLnLstmPolicy is given here. This class inherits methods from LstmPolicy which is defined here.

            The default activations used in tanh. You could go through the other default parameters given in the definition of LstmPolicy for more information.

            Source https://stackoverflow.com/questions/57356257

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install stable-baselines

            Note: Stable-Baselines supports Tensorflow versions from 1.8.0 to 1.14.0. Support for Tensorflow 2 API is planned.
            Install the Stable Baselines package:.
            All unit tests in baselines can be run using pytest runner:.

            Support

            Documentation is available online: https://stable-baselines.readthedocs.io/.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/Stable-Baselines-Team/stable-baselines.git

          • CLI

            gh repo clone Stable-Baselines-Team/stable-baselines

          • sshUrl

            git@github.com:Stable-Baselines-Team/stable-baselines.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Reinforcement Learning Libraries

            Try Top Libraries by Stable-Baselines-Team

            stable-baselines3-contrib

            by Stable-Baselines-TeamPython

            rl-colab-notebooks

            by Stable-Baselines-TeamJupyter Notebook

            stable-baselines-tf2

            by Stable-Baselines-TeamPython