Skip to content

Commit

Permalink
qmix update
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastasiaPsarou committed Nov 9, 2024
1 parent 001fed0 commit e7cdd91
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions tutorials/MLinPL/qmix_mutation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -606,13 +606,15 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"module = TensorDictModule(\n",
" net, in_keys=[(\"agents\", \"observation\")], out_keys=[(\"agents\", \"action_value\")]\n",
")"
"## We need to wrap our MultiAgentMLP in a TensorDictModule\n",
"## in_keys =[(\"agents\", \"observation\")]\n",
"## out_keys=[(\"agents\", \"action_value\")]\n",
"\n",
"module = ..."
]
},
{
Expand Down Expand Up @@ -649,11 +651,13 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"qnet = SafeSequential(module, value_module)"
"## We need to wrap the two modules in a SafeSequential\n",
"\n",
"qnet = SafeSequential(...)"
]
},
{
Expand Down Expand Up @@ -732,13 +736,15 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"## We need to initialize the DataCollector\n",
"\n",
"collector = SyncDataCollector(\n",
" env,\n",
" qnet_explore,\n",
" ...,\n",
" ...,\n",
" device=device,\n",
" storing_device=device,\n",
" frames_per_batch=frames_per_batch,\n",
Expand Down Expand Up @@ -790,11 +796,12 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"loss_module = QMixerLoss(qnet, mixer, delay_value=True)\n",
"## Create the QmixerLoss object\n",
"loss_module = QMixerLoss(..., ..., delay_value=True)\n",
"\n",
"loss_module.set_keys(\n",
" action_value=(\"agents\", \"action_value\"),\n",
Expand Down

0 comments on commit e7cdd91

Please sign in to comment.