AI4Finance-Foundation / AI4Finance-Foundation/ElegantRL

Bug Of Agent init

Offen
#225 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
4.4k
Forks
978
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

in the AgentBase.py AgentBase.__init__() :
```python
class AgentBase:
def __init__(self, net_dim: int, state_dim: int, action_dim: int, gpu_id: int = 0, args: Arguments = None):
...
'''network'''
act_class = getattr(self, "act_class", None)
cri_class = getattr(self, "cri_class", None)
self.act = act_class(net_dim, self.num_layer, state_dim, action_dim).to(self.device)
self.cri = cri_class(net_dim, self.num_layer, state_dim, action_dim).to(self.device) \
if cri_class else self.act
```

the code pass the num_layer when init the act ,but in the agent/net.py, most of the networks __init__ not receive num_layer param,
such as QNetTwinDuel:
```python
class QNetTwinDuel(nn.Module): # D3QN: Dueling Double DQN

def __init__(self, mid_dim, state_dim, action_dim):
super().__init__()
self.net_state = nn.Sequential(
nn.Linear(state_dim, mid_dim),
nn.ReLU(),
nn.Linear(mid_dim, mid_dim),
nn.ReLU(),
)
```
this will cause agent init error.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.