BOINC AI Hub
  • 🌍BOINC AI Hub
  • 🌍Repositories
  • Getting Started with Repositories
  • Repository Settings
  • Pull Requests & Discussions
  • Notifications
  • Collections
  • 🌍Webhooks
    • How-to: Automatic fine-tuning with Auto-Train
    • How-to: Build a Discussion bot based on BLOOM
    • How-to: Create automatic metadata quality reports
  • Repository size recommendations
  • Next Steps
  • Licenses
  • 🌍Models
  • The Model Hub
  • 🌍Model Cards
    • Annotated Model Card
    • Carbon Emissions
    • Model Card Guidebook
    • Landscape Analysis
  • Gated Models
  • Uploading Models
  • Downloading Models
  • 🌍Integrated Libraries
    • Adapter Transformers
    • AllenNLP
    • Asteroid
    • Diffusers
    • ESPnet
    • fastai
    • Flair
    • Keras
    • ML-Agents
    • PaddleNLP
    • RL-Baselines3-Zoo
    • Sample Factory
    • Sentence Transformers
    • spaCy
    • SpanMarker
    • SpeechBrain
    • Stable-Baselines3
    • Stanza
    • TensorBoard
    • timm
    • Transformers
    • Transformers.js
  • 🌍Model Widgets
    • Widget Examples
  • Inference API docs
  • Frequently Asked Questions
  • 🌍Advanced Topics
    • Integrate a library with the Hub
    • Tasks
  • 🌍Datasets
  • Datasets Overview
  • Dataset Cards
  • Gated Datasets
  • Dataset Viewer
  • Using Datasets
  • Adding New Datasets
  • 🌍Spaces
  • 🌍Spaces Overview
    • Handling Spaces Dependencies
    • Spaces Settings
    • Using Spaces for Organization Cards
  • Spaces GPU Upgrades
  • Spaces Persistent Storage
  • Gradio Spaces
  • Streamlit Spaces
  • Static HTML Spaces
  • 🌍Docker Spaces
    • Your first Docker Spaces
    • Example Docker Spaces
    • Argilla on Spaces
    • Label Studio on Spaces
    • Aim on Space
    • Livebook on Spaces
    • Shiny on Spaces
    • ZenML on Spaces
    • Panel on Spaces
    • ChatUI on Spaces
    • Tabby on Spaces
  • Embed your Space
  • Run Spaces with Docker
  • Spaces Configuration Reference
  • Sign-In with BA button
  • Spaces Changelog
  • 🌍Advanced Topics
    • Using OpenCV in Spaces
    • More ways to create Spaces
    • Managing Spaces with Github Actions
    • Custom Python Spaces
    • How to Add a Space to ArXiv
    • Cookie limitations in Spaces
  • 🌍Other
  • 🌍Organizations
    • Managing Organizations
    • Organization Cards
    • Access Control in Organizations
  • Billing
  • 🌍Security
    • User Access Tokens
    • Git over SSH
    • Signing Commits with GPG
    • Single Sign-On (SSO)
    • Malware Scanning
    • Pickle Scanning
    • Secrets Scanning
  • Moderation
  • Paper Pages
  • Search
  • Digital Object Identifier (DOI)
  • Hub API Endpoints
  • Sign-In with BA
Powered by GitBook
On this page
  • Using Stable-Baselines3 at BOINC AI
  • Exploring Stable-Baselines3 in the Hub
  • Install the library
  • Using existing models
  • Sharing your models
  • Additional resources
  1. Integrated Libraries

Stable-Baselines3

PreviousSpeechBrainNextStanza

Last updated 1 year ago

Using Stable-Baselines3 at BOINC AI

stable-baselines3 is a set of reliable implementations of reinforcement learning algorithms in PyTorch.

Exploring Stable-Baselines3 in the Hub

You can find Stable-Baselines3 models by filtering at the left of the .

All models on the Hub come up with useful features:

  1. An automatically generated model card with a description, a training configuration, and more.

  2. Metadata tags that help for discoverability.

  3. Evaluation results to compare with other models.

  4. A video widget where you can watch your agent performing.

Install the library

To install the stable-baselines3 library, you need to install two packages:

  • stable-baselines3: Stable-Baselines3 library.

  • huggingface-sb3: additional code to load and upload Stable-baselines3 models from the Hub.

Copied

pip install stable-baselines3
pip install huggingface-sb3

Using existing models

You can simply download a model from the Hub using the load_from_hub function

Copied

checkpoint = load_from_hub(
    repo_id="sb3/demo-hf-CartPole-v1",
    filename="ppo-CartPole-v1.zip",
)

You need to define two parameters:

  • --repo-id: the name of the BOINC AI repo you want to download.

  • --filename: the file you want to download.

Sharing your models

You can easily upload your models using two different functions:

  1. package_to_hub(): save the model, evaluate it, generate a model card and record a replay video of your agent before pushing the complete repo to the Hub.

Copied

package_to_hub(model=model, 
               model_name="ppo-LunarLander-v2",
               model_architecture="PPO",
               env_id=env_id,
               eval_env=eval_env,
               repo_id="ThomasSimonini/ppo-LunarLander-v2",
               commit_message="Test commit")

You need to define seven parameters:

  • --model: your trained model.

  • --model_architecture: name of the architecture of your model (DQN, PPO, A2C, SAC…).

  • --env_id: name of the environment.

  • --eval_env: environment used to evaluate the agent.

  • --repo-id: the name of the BOINC AI repo you want to create or update. It’s <your huggingface username>/<the repo name>.

  • --commit-message.

  • --filename: the file you want to push to the Hub.

  1. push_to_hub(): simply push a file to the Hub

Copied

push_to_hub(
    repo_id="ThomasSimonini/ppo-LunarLander-v2",
    filename="ppo-LunarLander-v2.zip",
    commit_message="Added LunarLander-v2 model trained with PPO",
)

You need to define three parameters:

  • --repo-id: the name of the BOINC AI repo you want to create or update. It’s <your huggingface username>/<the repo name>.

  • --filename: the file you want to push to the Hub.

  • --commit-message.

Additional resources

BOINC AI Stable-Baselines3

Stable-Baselines3

🌍
models page
documentation
documentation