diff --git a/TD2 Deep Learning.ipynb b/TD2 Deep Learning.ipynb index 1cc81839e13499cf27cb46db985628610ae9c351..96bc0494484e0f849cd0162b91525e6093562277 100644 --- a/TD2 Deep Learning.ipynb +++ b/TD2 Deep Learning.ipynb @@ -899,28 +899,20 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 58, "id": "b86dd2c4", "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Test Loss: 17.170850\n", - "\n", - "Test Accuracy of airplane: 73% (736/1000)\n", - "Test Accuracy of automobile: 89% (898/1000)\n", - "Test Accuracy of bird: 57% (573/1000)\n", - "Test Accuracy of cat: 60% (601/1000)\n", - "Test Accuracy of deer: 75% (753/1000)\n", - "Test Accuracy of dog: 56% (569/1000)\n", - "Test Accuracy of frog: 88% (884/1000)\n", - "Test Accuracy of horse: 74% (742/1000)\n", - "Test Accuracy of ship: 84% (846/1000)\n", - "Test Accuracy of truck: 73% (735/1000)\n", - "\n", - "Test Accuracy (Overall): 73% (7337/10000)\n" + "ename": "RuntimeError", + "evalue": "Error(s) in loading state_dict for Net:\n\tMissing key(s) in state_dict: \"conv3.weight\", \"conv3.bias\", \"fc1.weight\", \"fc1.bias\", \"fc2.weight\", \"fc2.bias\", \"fc3.weight\", \"fc3.bias\". \n\tUnexpected key(s) in state_dict: \"fc1.scale\", \"fc1.zero_point\", \"fc1._packed_params.dtype\", \"fc1._packed_params._packed_params\", \"fc2.scale\", \"fc2.zero_point\", \"fc2._packed_params.dtype\", \"fc2._packed_params._packed_params\", \"fc3.scale\", \"fc3.zero_point\", \"fc3._packed_params.dtype\", \"fc3._packed_params._packed_params\". \n\tsize mismatch for conv1.weight: copying a param with shape torch.Size([6, 3, 5, 5]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3]).\n\tsize mismatch for conv1.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([16]).\n\tsize mismatch for conv2.weight: copying a param with shape torch.Size([16, 6, 5, 5]) from checkpoint, the shape in current model is torch.Size([32, 16, 3, 3]).\n\tsize mismatch for conv2.bias: copying a param with shape torch.Size([16]) from checkpoint, the shape in current model is torch.Size([32]).", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/var/folders/c_/bcjgdb5j6wq89qpwvs1rl29h0000gn/T/ipykernel_27875/3291884398.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload_state_dict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"./model_cifar.pt\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;31m# track test loss\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mtest_loss\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0.0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mclass_correct\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0.0\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/anaconda3/envs/infa4/lib/python3.8/site-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36mload_state_dict\u001b[0;34m(self, state_dict, strict, assign)\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2152\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0merror_msgs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2153\u001b[0;31m raise RuntimeError('Error(s) in loading state_dict for {}:\\n\\t{}'.format(\n\u001b[0m\u001b[1;32m 2154\u001b[0m self.__class__.__name__, \"\\n\\t\".join(error_msgs)))\n\u001b[1;32m 2155\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0m_IncompatibleKeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmissing_keys\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0munexpected_keys\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mRuntimeError\u001b[0m: Error(s) in loading state_dict for Net:\n\tMissing key(s) in state_dict: \"conv3.weight\", \"conv3.bias\", \"fc1.weight\", \"fc1.bias\", \"fc2.weight\", \"fc2.bias\", \"fc3.weight\", \"fc3.bias\". \n\tUnexpected key(s) in state_dict: \"fc1.scale\", \"fc1.zero_point\", \"fc1._packed_params.dtype\", \"fc1._packed_params._packed_params\", \"fc2.scale\", \"fc2.zero_point\", \"fc2._packed_params.dtype\", \"fc2._packed_params._packed_params\", \"fc3.scale\", \"fc3.zero_point\", \"fc3._packed_params.dtype\", \"fc3._packed_params._packed_params\". \n\tsize mismatch for conv1.weight: copying a param with shape torch.Size([6, 3, 5, 5]) from checkpoint, the shape in current model is torch.Size([16, 3, 3, 3]).\n\tsize mismatch for conv1.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([16]).\n\tsize mismatch for conv2.weight: copying a param with shape torch.Size([16, 6, 5, 5]) from checkpoint, the shape in current model is torch.Size([32, 16, 3, 3]).\n\tsize mismatch for conv2.bias: copying a param with shape torch.Size([16]) from checkpoint, the shape in current model is torch.Size([32])." ] } ],