Skip to content

Commit 472e1f7

Browse files
committed
Fixed trainer.py for GPU execution and modified main.py to run in Ubuntu
1 parent 67bea13 commit 472e1f7

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from trainer import Trainer
55

66
from pyvirtualdisplay import Display
7-
#display = Display(visible=0, size=(1400, 900))
8-
#display.start()
7+
display = Display(visible=0, size=(1400, 900))
8+
display.start()
99

1010
# if gpu is to be used
1111
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

params/policy-params.dl

-60.7 MB
Binary file not shown.

trainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def episode_train(self, iteration):
6666
policy_loss.append(-log_prob * advantage)
6767

6868
# calculate critic (value) loss using L1 smooth loss
69-
value_losses.append(F.smooth_l1_loss(baseline, torch.tensor([G])))
69+
value_losses.append(F.smooth_l1_loss(baseline, torch.tensor([G]).to(self.device)))
7070

7171
# Update policy:
7272
self.optimizer.zero_grad()

0 commit comments

Comments
 (0)