Package for applying ao techniques to GPU models
Project description
torchao
The torchao package contains apis and workflows used to apply AO techniques like quantization and pruning to models using only native pytorch.
Installation
clone repository and install package:
git clone https://github.com/pytorch-labs/ao
cd ao
python setup.py install
verify installation:
pip list | grep torchao
should show
torchao 0.0.1 <install dir>
Usage
Relevant APIs can be found in torchao.quantization.quant_api
Example
import torch
from torchao.quantization import quant_api
# some user model
model = torch.nn.Sequential(torch.nn.Linear(32, 64)).cuda().to(torch.bfloat16)
# some example input
input = torch.randn(32,32, dtype=torch.bfloat16, device='cuda')
# convert linear modules to quantized linear modules
# insert quantization method/api of choice
quant_api.apply_weight_only_int8_quant(model)
# quant_api.apply_dynamic_quant(model)
# quant_api.change_linear_weights_to_dqtensors(model)
# compile the model to improve performance
torch.compile(model, mode='max-autotune')
model(input)
A16W8 WeightOnly Quantization
License
torchao is released under the BSD 3 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torchao-0.0.1.tar.gz.
File metadata
- Download URL: torchao-0.0.1.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25cf077a974da90d2266d4cebb4590ecb61f40da9c52f019beeb18dbab7bf5df
|
|
| MD5 |
4c7aedf014f1b434f1a04f081a2a716c
|
|
| BLAKE2b-256 |
5b985447ff6303b617a4a15cd883481ff6abb0a4dd29b0c554a409e1f5845064
|
File details
Details for the file torchao-0.0.1-py3-none-any.whl.
File metadata
- Download URL: torchao-0.0.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d8a927ed941c108939212f0803f952fcfeee95efe547881ce8cb928760e438b
|
|
| MD5 |
24746e799d5aef0448d8c4fc77a196bf
|
|
| BLAKE2b-256 |
6707a82b2c5bd4cf430e224f20966c4a44907cb79b36967103f9fe90d5c670a3
|