Skip to content

Commit 1946b2a

Browse files
committed
Updated readme.
1 parent 3dfc2ad commit 1946b2a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Pytorch to Keras model convertor. Still beta for now.
33

44
## Important notice
55

6-
In that moment the only PyTorch 0.2 and PyTorch 0.4 (in master) are supported.
6+
In that moment the only PyTorch 0.2 (deprecated) and PyTorch 0.4 (in master) are supported.
77

8-
To use converter properly, please, make changes in your `~/.keras/keras.json`:
8+
To use the converter properly, please, make changes in your `~/.keras/keras.json`:
99

1010
```
1111
...
@@ -14,21 +14,19 @@ To use converter properly, please, make changes in your `~/.keras/keras.json`:
1414
...
1515
```
1616

17-
Note 1: some layers parameters (like ceiling and etc) aren't supported.
17+
## How to build the latest PyTorch
1818

19-
Note 2: recurrent layers aren't supported too.
19+
Please, follow [this guide](https://github.com/pytorch/pytorch#from-source) to compile the latest version.
2020

21-
## How to
21+
## How to use
2222

23-
It's a convertor of pytorch graph to a keras (tensorflow backend) graph.
23+
It's a convertor of pytorch graph to a Keras (Tensorflow backend) graph.
2424

25-
Firstly, we need to load (or create) pytorch model.
26-
27-
For example:
25+
Firstly, we need to load (or create) pytorch model:
2826

2927
```
3028
class TestConv2d(nn.Module):
31-
"""Module for Conv2d conversion testing
29+
"""Module for Conv2d convertion testing
3230
"""
3331
3432
def __init__(self, inp=10, out=16, kernel_size=3):
@@ -40,11 +38,12 @@ class TestConv2d(nn.Module):
4038
return x
4139
4240
model = TestConv2d()
41+
4342
# load weights here
4443
# model.load_state_dict(torch.load(path_to_weights.pth))
4544
```
4645

47-
The next step - iterate model with some data (for gradients computing):
46+
The next step - create a dummy variable with correct shapes:
4847

4948
```
5049
input_np = np.random.uniform(0, 1, (1, 10, 32, 32))
@@ -55,10 +54,11 @@ We're using dummy-variable in order to trace the model.
5554

5655
```
5756
from converter import pytorch_to_keras
58-
k_model = pytorch_to_keras(model, input_var, (10, 32, 32,), verbose=True) #we should specify shape of the input tensor
57+
# we should specify shape of the input tensor
58+
k_model = pytorch_to_keras(model, input_var, (10, 32, 32,), verbose=True)
5959
```
6060

61-
That's all! If all is ok, the Keras model stores to the `k_model` variable.
61+
That's all! If all is ok, the Keras model is stores into the `k_model` variable.
6262

6363
## Supported layers
6464

@@ -109,7 +109,7 @@ Misc:
109109

110110
* ResNet18
111111
* ResNet50
112-
* SqueezeNet
112+
* SqueezeNet (with ceil_mode=False)
113113
* DenseNet
114114
* AlexNet
115115
* Inception (v4 only) (only with 0.2)

0 commit comments

Comments
 (0)