Skip to content

Commit 432643a

Browse files
committed
Import torch and added animated gif showing pendulum
1 parent 3c25041 commit 432643a

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/ppo/main.clj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
;;
4343
;; ## Pendulum environment
4444
;;
45-
;; ![pendulum](pendulum.png)
45+
;; ![screenshot of pendulum environment](pendulum.png)
4646
;;
4747
;; First we implement a simple pendulum environment to test the PPO algorithm.
4848
;; In order to be able to switch environments, we define a protocol according to the environment abstract class used in OpenAI's gym.
@@ -267,6 +267,8 @@
267267
(async/<!! done-chan))
268268
(System/exit 0))
269269

270+
;; ![manually controlled pendulum](manual.gif)
271+
270272
;; ## Neural networks
271273
;;
272274
;; PPO is a machine learning technique using backpropagation to learn the parameters of two neural networks.
@@ -332,3 +334,11 @@
332334
;; ```bash
333335
;; uv run clj
334336
;; ```
337+
;;
338+
;; Now you should be able to import the Python modules using *require-python*.
339+
(require-python '[builtins :as python]
340+
'[torch :as torch]
341+
'[torch.nn :as nn]
342+
'[torch.nn.functional :as F]
343+
'[torch.optim :as optim]
344+
'[torch.distributions :refer (Beta)])

src/ppo/manual.gif

177 KB
Loading

0 commit comments

Comments
 (0)