Downloads · 30 days
10
10% of all-time downloads
agercas/qdqn-FrozenLake-v1
qdqn-FrozenLake-v1 is a reinforcement learning model from agercas. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product.
This is a trained model of a QDQN agent playing FrozenLake-v1 using the qrl-dqn-gym.
Downloads · 30 days
10
10% of all-time downloads
All-time downloads
102
Public
Repo size
1.3 KB
Likes
0
Public
Click a slice to open those files.
.py4.2 KB · 48%
From the Hugging Face model README
This is a trained model of a QDQN agent playing FrozenLake-v1 using the qrl-dqn-gym.
This agent has been trained for the research project 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.
import gym
import yaml
import torch
from model.qnn import QuantumNet
from hemodellpers.wrappers import BinaryWrapper
from model.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)