Update README.md
Browse files
README.md
CHANGED
@@ -4,6 +4,41 @@ tags:
|
|
4 |
- model_hub_mixin
|
5 |
---
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
- model_hub_mixin
|
5 |
---
|
6 |
|
7 |
+
### How to use
|
8 |
+
|
9 |
+
First, clone the repository:
|
10 |
+
|
11 |
+
```
|
12 |
+
git clone https://github.com/IvanDrokin/torch-conv-kan.git
|
13 |
+
cd torch-conv-kan
|
14 |
+
pip install -r requirements.txt
|
15 |
+
```
|
16 |
+
Then you can initialize the model and load weights.
|
17 |
+
|
18 |
+
```python
|
19 |
+
import torch
|
20 |
+
from models import VGGKAGN_BN
|
21 |
+
model = VGGKAGN_BN.from_pretrained('brivangl/vgg_kagn_bn11_v4_opt',
|
22 |
+
groups=1,
|
23 |
+
degree=3,
|
24 |
+
dropout=0.05,
|
25 |
+
l1_decay=0,
|
26 |
+
width_scale=3,
|
27 |
+
affine=True,
|
28 |
+
norm_layer=nn.BatchNorm2d,
|
29 |
+
expected_feature_shape=(1, 1),
|
30 |
+
vgg_type='VGG11v4')
|
31 |
+
```
|
32 |
+
|
33 |
+
Transforms, used for validation on Imagenet1k:
|
34 |
+
|
35 |
+
```python
|
36 |
+
from torchvision.transforms import v2
|
37 |
+
transforms_val = v2.Compose([
|
38 |
+
v2.ToImage(),
|
39 |
+
v2.Resize(256, antialias=True),
|
40 |
+
v2.CenterCrop(224),
|
41 |
+
v2.ToDtype(torch.float32, scale=True),
|
42 |
+
v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
43 |
+
])
|
44 |
+
```
|