File size: 940 Bytes
b5ab1e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d35ce9b
b5ab1e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
tags:
- CartPole-v1
- deep-q-learning
- reinforcement-learning
- custom-implementation
model-index:
- name: dqn-cartpole
  results:
  - task:
      type: reinforcement-learning
      name: reinforcement-learning
    dataset:
      name: CartPole-v1
      type: CartPole-v1
    metrics:
    - type: mean_reward
      value: 500.00 +/- 0.00
      name: mean_reward
      verified: false
---

    # **Deep Q-Learning** Agent playing **CartPole-v1**
    This is a trained model of a **Deep Q-Learning** agent playing **CartPole-v1**.
    
    ## Usage
    
    ```python
    from huggingface_hub import hf_hub_download
    import torch
    from dqn_model import DQN
    
    model_path = hf_hub_download(repo_id="figurek1m/dqn-cartpole", filename="dqn_cartpole.pth")
    q_network = DQN(input_dim=4, output_dim=2)
    q_network.load_state_dict(torch.load(model_path))
    q_network.eval()
    
    env = gym.make("CartPole-v1")
    ```