Skip to content

Commit

Permalink
New references
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackSamorez committed Dec 3, 2023
1 parent eb76283 commit e2b2ebc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Binary file modified week10_efficiency/gptq_block_error_reference.pt
Binary file not shown.
Binary file modified week10_efficiency/gptq_block_weight_reference.pt
Binary file not shown.
Binary file modified week10_efficiency/gptq_weight_reference.pt
Binary file not shown.
38 changes: 19 additions & 19 deletions week10_efficiency/practice.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"id": "z1xDv2d12hw9"
},
Expand Down Expand Up @@ -182,7 +182,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {
"id": "9ZR0OZ0ai62N"
},
Expand Down Expand Up @@ -271,7 +271,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {
"id": "NMzGxzt-i62P"
},
Expand Down Expand Up @@ -331,7 +331,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {
"id": "JIUbMToO3C9B"
},
Expand Down Expand Up @@ -856,7 +856,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 10,
"metadata": {
"id": "ls5meN1c4No-"
},
Expand Down Expand Up @@ -931,7 +931,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {
"id": "8vo0UYKvi62V"
},
Expand Down Expand Up @@ -973,7 +973,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 12,
"metadata": {
"id": "2TRwggs3Lb2F"
},
Expand Down Expand Up @@ -1055,7 +1055,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 14,
"metadata": {
"id": "luUgnOhxaFcw"
},
Expand Down Expand Up @@ -1153,7 +1153,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
Expand Down Expand Up @@ -1195,7 +1195,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"metadata": {
"id": "Fn-Vko3urrM0"
},
Expand Down Expand Up @@ -1383,7 +1383,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 21,
"metadata": {
"id": "7W50rdH0i62Y"
},
Expand Down Expand Up @@ -1449,7 +1449,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 23,
"metadata": {
"id": "zzEPMSsEi62Y"
},
Expand Down Expand Up @@ -1626,7 +1626,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {
"id": "urb_7OhSq_zA"
},
Expand Down Expand Up @@ -1723,7 +1723,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 45,
"metadata": {
"id": "t8GwQU5CrNv_"
},
Expand Down Expand Up @@ -1781,7 +1781,7 @@
"block_weight = weight[:,:16]\n",
"\n",
"block_hessian_inverse = (torch.triu(torch.rand((16, 16), generator=generator), diagonal=1) + torch.diag(torch.rand(16, generator=generator) + 1)).cuda()\n",
"quantized_block_weight, scaled_block_error = gptq_block(block_weight, block_hessian_inverse, scale, zero, 15)\n",
"quantized_block_weight, scaled_block_error = gptq_block(block_weight, block_hessian_inverse, scale, zero, 4)\n",
"\n",
"assert torch.all(quantized_block_weight == torch.load(\"gptq_block_weight_reference.pt\"))\n",
"assert torch.allclose(scaled_block_error, torch.load(\"gptq_block_error_reference.pt\"), rtol=1e-5, atol=1e-06)\n",
Expand Down Expand Up @@ -1812,7 +1812,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 47,
"metadata": {
"id": "iqI4FamprFPE"
},
Expand Down Expand Up @@ -1911,7 +1911,7 @@
"\n",
"hessian = torch.triu(torch.rand((128, 128), generator=generator) + 4 * torch.eye(128)).cuda().half()\n",
"hessian += hessian.clone().T\n",
"quantized_weight, _, _ = gptq(weight, 8, hessian, 32)\n",
"quantized_weight, _, _ = gptq(weight, 4, hessian, 32)\n",
"\n",
"assert torch.all(quantized_weight == torch.load(\"gptq_weight_reference.pt\"))\n",
"\n",
Expand Down Expand Up @@ -1944,7 +1944,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 49,
"metadata": {
"id": "fMyrGkHqy-xg"
},
Expand Down Expand Up @@ -2103,7 +2103,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 53,
"metadata": {
"id": "18BHd4Nnza2T"
},
Expand Down

0 comments on commit e2b2ebc

Please sign in to comment.