|
--- |
|
tags: |
|
- FrozenLake-v1 |
|
- deep-reinforcement-learning |
|
- reinforcement-learning |
|
model-index: |
|
- name: QDQN |
|
results: |
|
- task: |
|
type: reinforcement-learning |
|
name: reinforcement-learning |
|
dataset: |
|
name: FrozenLake-v1 |
|
type: FrozenLake-v1 |
|
metrics: |
|
- type: mean_reward |
|
value: 0.12 +/- 0.0 |
|
name: mean_reward |
|
verified: false |
|
--- |
|
|
|
# **QDQN** Agent playing **FrozenLake-v1** |
|
This is a trained model of a **QDQN** agent playing **FrozenLake-v1** |
|
using the [qrl-dqn-gym](https://github.com/qdevpsi3/qrl-dqn-gym). |
|
|
|
This agent has been trained for the [research project](https://github.com/agercas/QHack2023_QRL) during the QHack 2023 |
|
hackathon. The project explores the use of quantum algorithms in reinforcement learning. |
|
More details about the project and the trained agent can be found in the [project repository](https://github.com/agercas/QHack2023_QRL). |
|
|
|
|
|
## Usage |
|
|
|
```python |
|
import gym |
|
import yaml |
|
import torch |
|
from helpers.qnn import QuantumNet |
|
from helpers.wrappers import BinaryWrapper |
|
from helpers.agent import Agent |
|
|
|
# Environment |
|
env_name = 'FrozenLake-v1' |
|
env = gym.make(env_name) |
|
env = BinaryWrapper(env) |
|
|
|
# Network |
|
with open('config.yaml', 'r') as f: |
|
hparams = yaml.safe_load(f) |
|
|
|
net = QuantumNet(hparams['n_layers']) |
|
state_dict = torch.load('qdqn-FrozenLake-v1.pt', map_location=torch.device('cpu')) |
|
net.load_state_dict(state_dict) |
|
|
|
# Agent |
|
agent = Agent(net) |
|
``` |
|
|