Skip to content

Commit

Permalink
Fix implementation of SAC
Browse files Browse the repository at this point in the history
  • Loading branch information
phisn committed May 3, 2024
1 parent 23991e7 commit 8849812
Show file tree
Hide file tree
Showing 23 changed files with 1,510 additions and 407 deletions.
2 changes: 1 addition & 1 deletion packages/editor/models/export-model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EntityType, ShapeModel, WorldModel } from "runtime/proto/world"
import { EntityType, ShapeModel } from "runtime/proto/world"
import { verticesToBytes } from "runtime/src/model/world/shape-model"
import { ShapeState } from "../entities/shape/shape-state"
import { WorldState } from "./world-state"
Expand Down
1 change: 1 addition & 0 deletions packages/learning/actor/model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"modelTopology":{"class_name":"Sequential","config":{"name":"sequential_3","layers":[{"class_name":"Sequential","config":{"name":"sequential_1","layers":[{"class_name":"Dense","config":{"units":32,"activation":"relu","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":"fan_avg","distribution":"normal","seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense1","trainable":true,"batch_input_shape":[null,4],"dtype":"float32"}},{"class_name":"Dense","config":{"units":32,"activation":"relu","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":"fan_avg","distribution":"normal","seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense2","trainable":true}}]}},{"class_name":"Dense","config":{"units":2,"activation":"linear","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":"fan_avg","distribution":"normal","seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense5","trainable":true}}]},"keras_version":"tfjs-layers 4.19.0-rc.0","backend":"tensor_flow.js"},"weightsManifest":[{"paths":["weights.bin"],"weights":[{"name":"dense_Dense1/kernel","shape":[4,32],"dtype":"float32"},{"name":"dense_Dense1/bias","shape":[32],"dtype":"float32"},{"name":"dense_Dense2/kernel","shape":[32,32],"dtype":"float32"},{"name":"dense_Dense2/bias","shape":[32],"dtype":"float32"},{"name":"dense_Dense5/kernel","shape":[32,2],"dtype":"float32"},{"name":"dense_Dense5/bias","shape":[2],"dtype":"float32"}]}],"format":"layers-model","generatedBy":"TensorFlow.js tfjs-layers v4.19.0-rc.0","convertedBy":null}
Binary file added packages/learning/actor/weights.bin
Binary file not shown.
1 change: 1 addition & 0 deletions packages/learning/critic/model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"modelTopology":{"class_name":"Sequential","config":{"name":"sequential_4","layers":[{"class_name":"Sequential","config":{"name":"sequential_2","layers":[{"class_name":"Dense","config":{"units":32,"activation":"relu","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":"fan_avg","distribution":"normal","seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense3","trainable":true,"batch_input_shape":[null,4],"dtype":"float32"}},{"class_name":"Dense","config":{"units":32,"activation":"relu","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":"fan_avg","distribution":"normal","seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense4","trainable":true}}]}},{"class_name":"Dense","config":{"units":1,"activation":"linear","use_bias":true,"kernel_initializer":{"class_name":"VarianceScaling","config":{"scale":1,"mode":"fan_avg","distribution":"normal","seed":null}},"bias_initializer":{"class_name":"Zeros","config":{}},"kernel_regularizer":null,"bias_regularizer":null,"activity_regularizer":null,"kernel_constraint":null,"bias_constraint":null,"name":"dense_Dense6","trainable":true}}]},"keras_version":"tfjs-layers 4.19.0-rc.0","backend":"tensor_flow.js"},"weightsManifest":[{"paths":["weights.bin"],"weights":[{"name":"dense_Dense3/kernel","shape":[4,32],"dtype":"float32"},{"name":"dense_Dense3/bias","shape":[32],"dtype":"float32"},{"name":"dense_Dense4/kernel","shape":[32,32],"dtype":"float32"},{"name":"dense_Dense4/bias","shape":[32],"dtype":"float32"},{"name":"dense_Dense6/kernel","shape":[32,1],"dtype":"float32"},{"name":"dense_Dense6/bias","shape":[1],"dtype":"float32"}]}],"format":"layers-model","generatedBy":"TensorFlow.js tfjs-layers v4.19.0-rc.0","convertedBy":null}
Binary file added packages/learning/critic/weights.bin
Binary file not shown.
2 changes: 0 additions & 2 deletions packages/learning/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
<html lang="en" style="width: 100%; height: 95%; background-color: black">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/threejs-icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Polyburn</title>
</head>
<body style="width: 100%; height: 100%; margin: 0%">
<canvas id="scene" style="width: 100%; height: 100%"></canvas>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
20 changes: 10 additions & 10 deletions packages/learning/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"name": "learning",
"private": true,
"version": "1.0.0",
"type": "commonjs",
"moduleResolution": "node",
"scripts": {
"rl-dev": "vite",
"rl-local": "npx tsx ./src/main.ts",
Expand All @@ -12,33 +10,35 @@
},
"devDependencies": {
"@types/node": "^20.12.7",
"@types/three": "^0.162.0",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"runtime": "*",
"runtime-framework": "*",
"shared": "*",
"tailwindcss": "^3.4.3",
"tslib": "^2.6.2",
"tsx": "^4.7.3",
"typescript": "^5.4.2",
"vite": "^5.1.6"
"vite": "^5.2.10"
},
"dependencies": {
"@dimforge/rapier2d": "^0.12.0",
"@tensorflow/tfjs": "^4.19.0",
"@tensorflow/tfjs-backend-webgl": "^4.19.0-rc.0",
"@tensorflow/tfjs-backend-webgpu": "^4.19.0-rc.0",
"@tensorflow/tfjs-node": "^4.19.0-rc.0",
"@tensorflow/tfjs-node-gpu": "^4.19.0-rc.0",
"@types/prompts": "^2.4.9",
"@types/sat": "^0.0.35",
"@types/three": "^0.164.0",
"eslint-config-custom": "*",
"lil-gui": "^0.19.2",
"poly-decomp-es": "^0.4.2",
"ppo-tfjs": "^0.0.2",
"prompts": "^2.4.2",
"protobufjs": "^7.2.6",
"runtime": "*",
"runtime-framework": "*",
"sat": "^0.9.0",
"three": "^0.162.0",
"shared": "*",
"three": "^0.164.1",
"tsconfig": "*",
"vite-node": "^1.5.3",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-wasm": "^3.3.0"
},
Expand Down
Loading

0 comments on commit 8849812

Please sign in to comment.