Reinforce Agent playing Pixelcopter-PLE-v0

This is a trained model of a Reinforce agent playing Pixelcopter-PLE-v0, implemented from scratch in PyTorch. To learn to use this model and train yours check Unit 4 of the Deep Reinforcement Learning Course: https://huggingface.co/deep-rl-course/unit4/introduction

Evaluation

Actions: greedy (most likely action).

Episodes Mean reward Std reward Mean − Std
10 99.20 62.66 36.54

Hyperparameters

{
  "h_size": 64,
  "n_training_episodes": 50000,
  "n_evaluation_episodes": 10,
  "max_t": 10000,
  "gamma": 0.99,
  "lr": 0.0001,
  "env_id": "Pixelcopter-PLE-v0",
  "state_space": 7,
  "action_space": 2,
  "deterministic_eval": true
}

Usage

The weights are stored as model.safetensors (no pickle, safe to download).

import json
import torch.nn as nn
import torch.nn.functional as F
from huggingface_hub import hf_hub_download
from safetensors.torch import load_model


class Policy(nn.Module):
    def __init__(self, s_size, a_size, h_size):
        super().__init__()
        self.fc1 = nn.Linear(s_size, h_size)
        self.fc2 = nn.Linear(h_size, h_size * 2)
        self.fc3 = nn.Linear(h_size * 2, a_size)

    def forward(self, x):
        x = F.relu(self.fc1(x))
        x = F.relu(self.fc2(x))
        return F.softmax(self.fc3(x), dim=1)


hp = json.load(open(hf_hub_download("zeynpakn/Reinforce-Pixelcopter-PLE-v0", "hyperparameters.json")))
policy = Policy(hp["state_space"], hp["action_space"], hp["h_size"])
load_model(policy, hf_hub_download("zeynpakn/Reinforce-Pixelcopter-PLE-v0", "model.safetensors"))
Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
9.09k params
Tensor type
F32
·
Video Preview
loading

Evaluation results