Skip to content

Commit c165142

Browse files
authored
Update README.md
1 parent f770853 commit c165142

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# efficient_densenet_pytorch
2-
A PyTorch implementation of DenseNets, optimized to save GPU memory.
2+
A PyTorch 0.4 implementation of DenseNets, optimized to save GPU memory.
33

44
## Recent updates
5-
1. **Now works on PyTorch 0.3.x!**
6-
1. `models/densenet_efficient_multi_gpu.py` is now depricated. `models/densenet_efficient.py` can handle both single and multi-GPU setups.
5+
1. **Now works on PyTorch 0.4!** It uses the checkpointing feature, which makes this code WAY more efficient!!!
6+
1. **No longer works with PyTorch 0.3.x.** If you are using an old version of PyTorch, check out [the pytorch_0.3.1 tag](https://github.com/gpleiss/efficient_densenet_pytorch/tree/pytorch_0.3.1) for an older version of this code.
7+
1. `models/densenet_efficient.py` is now depricated. `models/densenet.py` can handle both the efficient and original implementations.
78

89
## Motivation
910
While DenseNets are fairly easy to implement in deep learning frameworks, most
@@ -23,21 +24,25 @@ For more details, please see the [technical report](https://arxiv.org/pdf/1707.0
2324
![Diagram of implementation](https://raw.github.com/gpleiss/efficient_densenet_pytorch/master/images/forward.png)
2425

2526
## Requirements
26-
- PyTorch 0.3.x
27+
- PyTorch 0.4
2728
- CUDA
2829

30+
**N.B.** If you are using PyTorch 0.3.x, please check out [the 0.3.x compatible version](https://github.com/gpleiss/efficient_densenet_pytorch/tree/pytorch_0.3.1).
31+
2932
## Usage
3033

3134
**In your existing project:**
32-
There are two files in the `models` folder.
33-
- `models/densenet.py` is a "naive" implementation, based off the [torchvision](https://github.com/pytorch/vision/blob/master/torchvision/models/densenet.py) and
35+
There is one file in the `models` folder.
36+
- `models/densenet.py` is an implementation based off the [torchvision](https://github.com/pytorch/vision/blob/master/torchvision/models/densenet.py) and
3437
[project killer](https://github.com/felixgwu/img_classification_pk_pytorch/blob/master/models/densenet.py) implementations.
35-
- `models/densenet_efficient.py` is the new efficient implementation. (Code is still a little ugly. We're working on cleaning it up!)
36-
Copy either one of those files into your project!
38+
39+
If you care about speed, and memory is not an option, pass the `efficient=False` argument into the `DenseNet` constructor.
40+
Otherwise, pass in `efficient=True`.
3741

3842
**Options:**
3943
- All options are described in [the docstrings of the model files](https://github.com/gpleiss/efficient_densenet_pytorch/blob/master/models/densenet_efficient.py#L189)
4044
- The depth is controlled by `block_config` option
45+
- `efficient=True` uses the memory-efficient version
4146
- If you want to use the model for ImageNet, set `small_inputs=False`. For CIFAR or SVHN, set `small_inputs=True`.
4247

4348
**Running the demo:**
@@ -47,7 +52,13 @@ The only extra package you need to install is [python-fire](https://github.com/g
4752
pip install fire
4853
```
4954

50-
- single GPU:
55+
- Single GPU:
56+
57+
```sh
58+
CUDA_VISIBLE_DEVICES=0 python demo.py --efficient True --data <path_to_folder_with_cifar10> --save <path_to_save_dir>
59+
```
60+
61+
- Multiple GPU:
5162

5263
```sh
5364
CUDA_VISIBLE_DEVICES=0,1,2 python demo.py --efficient True --data <path_to_folder_with_cifar10> --save <path_to_save_dir>

0 commit comments

Comments
 (0)