|
1 | 1 | # NeuZip: Memory-Efficient Training and Inference with Dynamic Compression of Neural Networks |
2 | 2 |
|
3 | | -This is the official repository for the paper "NeuZip: Memory-Efficient Training and Inference with Dynamic Compression of Neural Networks". |
4 | | -This repository contains the code for the experiments in the paper. |
| 3 | +This is the official repository for the paper [*NeuZip: Memory-Efficient Training and Inference with Dynamic Compression of Neural Networks*](https://arxiv.org/abs/2410.20650). This repository contains the code for the experiments in the paper. |
5 | 4 |
|
6 | 5 | # Installation |
7 | 6 |
|
8 | | -First, please install NVComp library on your own. You can find the installation instructions on its [GitHub page](https://github.com/NVIDIA/nvcomp). |
| 7 | +## From PyPI |
9 | 8 |
|
10 | | -Then, you can install the package by running the following command in the root directory of the repository: |
| 9 | +We provide a simple way to install the package from PyPI. You can install the package by running the following command: |
11 | 10 |
|
12 | 11 | ```bash |
| 12 | +pip install neuzip |
| 13 | +``` |
| 14 | + |
| 15 | +Note that we only upload the source distribution to PyPI. You need to have NVCC correctly installed on your system to compile the package. |
| 16 | + |
| 17 | +## From source |
| 18 | + |
| 19 | +You can also install the package from source, which is useful if you want to modify the code. |
| 20 | + |
| 21 | +```bash |
| 22 | +git clone https://github.com/BorealisAI/neuzip |
| 23 | +cd neuzip |
13 | 24 | pip install -e . |
14 | 25 | ``` |
15 | 26 |
|
16 | | -# Usage |
| 27 | +# Basic usage |
17 | 28 |
|
18 | | -You can use the `neuzip` package to compress and decompress tensors. Here is an example: |
| 29 | +Using `neuzip` for your PyTorch model is pretty easy. Here is a simple example: |
19 | 30 |
|
20 | | -```python |
21 | | -import neuzip |
22 | | -manager = neuzip.Manager() # Create a manager |
23 | | -handle = manager.write(tensor) # Compress a tensor |
24 | | -tensor = manager.read(handle) # Decompress a tensor |
| 31 | +```diff |
| 32 | +model: torch.nn.Module = # your model |
| 33 | ++ manager = neuzip.Manager() |
| 34 | ++ model = manager.convert(model) |
25 | 35 | ``` |
26 | 36 |
|
27 | | -# Replicating Experiments |
| 37 | +The compressed model can be used in the same way as the original model while consuming less memory. |
| 38 | + |
| 39 | +# Replicating experiments |
28 | 40 |
|
29 | 41 | You can replicate all the experiments in the paper by using the files in the [examples/](examples/) directory. Each file corresponds to one or more experiments in the paper. |
0 commit comments