Skip to content

Commit

Permalink
add torchao
Browse files Browse the repository at this point in the history
  • Loading branch information
baniasbaabe committed Sep 28, 2024
1 parent 74452b0 commit 543edd9
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions book/machinelearning/modeltraining.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,48 @@
"\n",
"..."
]
},
{
"cell_type": "markdown",
"id": "94badc36",
"metadata": {},
"source": [
"## Quantize your Models with `torchao`"
]
},
{
"cell_type": "markdown",
"id": "82f98cc3",
"metadata": {},
"source": [
"Quantizing your Deep Learning models was never easier.\n",
"\n",
"With `torchao`, you can quantize and sparsify your models with 1 line of code.\n",
"\n",
"If you are unsure which method to use, you can even use the autoquant method to quantize your layers automatically."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4b50502",
"metadata": {},
"outputs": [],
"source": [
"!pip install torchao"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6594fe1a",
"metadata": {},
"outputs": [],
"source": [
"import torchao\n",
"\n",
"model = torchao.autoquant(torch.compile(model, mode='max-autotune'))"
]
}
],
"metadata": {
Expand Down

0 comments on commit 543edd9

Please sign in to comment.