update ckpt path

pull/1453/head
Ezra-Yu 2023-04-06 21:31:56 +08:00
parent 5c3abb2b2a
commit 3932ddec10
28 changed files with 73 additions and 133 deletions

View File

@ -9,7 +9,7 @@
RIFormer is a way to keep a vision backbone effective while removing token mixers in its basic building blocks. Equipped with our proposed optimization strategy, we are able to build an extremely simple vision backbone with encouraging performance, while enjoying the high efficiency during inference. RIFormer shares nearly the same macro and micro design as MetaFormer, but safely removing all token mixers. The quantitative results show that our networks outperform many prevailing backbones with faster inference speed on ImageNet-1K.
<div align=center>
<img src="https://user-images.githubusercontent.com/48375204/223930120-dc075c8e-0513-42eb-9830-469a45c1d941.png" width="60%"/>
<img src="https://user-images.githubusercontent.com/48375204/223930120-dc075c8e-0513-42eb-9830-469a45c1d941.png" width="65%"/>
</div>
## Abstract
@ -36,12 +36,12 @@ Use `classifier.backbone.switch_to_deploy()` interface to switch the RIFormer mo
```python
>>> import torch
>>> from mmcls.apis import init_model, inference_model
>>> from mmpretrain import get_model, inference_model
>>>
>>> model = init_model('configs/riformer/riformer-s12_8xb128_in1k.py', '/home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/224/repidentityformer-s12.pth.tar')
>>> model = get_model("riformer-s12_in1k", pretrained=True)
>>> results = inference_model(model, 'demo/demo.JPEG')
>>> print( (results['pred_class'], results['pred_score']) )
('sea snake' 0.7827475666999817)
('sea snake', 0.7827484011650085)
>>>
>>> # switch to deploy mode
>>> model.backbone.switch_to_deploy()
@ -55,7 +55,7 @@ Use `classifier.backbone.switch_to_deploy()` interface to switch the RIFormer mo
```python
>>> import torch
>>>
>>> model = init_model('configs/riformer/riformer-s12_8xb128_in1k.py', '/home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/224/repidentityformer-s12.pth.tar')
>>> model = get_model("riformer-s12_in1k", pretrained=True)
>>> model.eval()
>>> inputs = torch.rand(1, 3, 224, 224).to(model.data_preprocessor.device)
>>> # To get classification scores.
@ -77,63 +77,37 @@ torch.Size([1, 1000])
**Test Command**
Place the ImageNet dataset to the `data/imagenet/` directory, or prepare datasets according to the [docs](https://mmclassification.readthedocs.io/en/1.x/user_guides/dataset_prepare.html#prepare-dataset).
Place the ImageNet dataset to the `data/imagenet/` directory, or prepare datasets according to the [docs](https://mmpretrain.readthedocs.io/en/latest/user_guides/dataset_prepare.html#prepare-dataset).
*224×224*
Download Checkpoint:
```shell
wget /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/224/repidentityformer-s12.pth.tar
wget https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s12_32xb128_in1k_20230406-6741ce71.pth
```
Test use unfused model:
```shell
python tools/test.py configs/riformer/riformer-s12_8xb128_in1k.py /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/224/repidentityformer-s12.pth.tar
python tools/test.py configs/riformer/riformer-s12_8xb128_in1k.py riformer-s12_32xb128_in1k_20230406-6741ce71.pth
```
Reparameterize checkpoint:
```shell
python tools/model_converters/reparameterize_model.py configs/riformer/riformer-s12_8xb128_in1k.py /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/224/repidentityformer-s12.pth.tar /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained_deploy/224/repidentityformer-s12.pth.tar
python tools/model_converters/reparameterize_model.py configs/riformer/riformer-s12_8xb128_in1k.py riformer-s12_32xb128_in1k_20230406-6741ce71.pth riformer-s12_deploy.pth
```
Test use fused model:
```shell
python tools/test.py configs/riformer/deploy/riformer-s12-deploy_8xb128_in1k.py /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained_deploy/224/repidentityformer-s12.pth.tar
```
*384×384*
Download Checkpoint:
```shell
wget /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/384/repidentityformer-s12.pth.tar
```
Test use unfused model:
```shell
python tools/test.py configs/riformer/riformer-s12_8xb128_in1k_384.py /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/384/repidentityformer-s12.pth.tar
```
Reparameterize checkpoint:
```shell
python tools/model_converters/reparameterize_model.py configs/riformer/riformer-s12_8xb128_in1k_384.py /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/384/repidentityformer-s12.pth.tar /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained_deploy/384/repidentityformer-s12.pth.tar
```
Test use fused model:
```shell
python tools/test.py configs/riformer/deploy/riformer-s12-deploy_8xb128_in1k_384.py /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained_deploy/384/repidentityformer-s12.pth.tar
python tools/test.py configs/riformer/deploy/riformer-s12-deploy_8xb128_in1k.py riformer-s12_deploy.pth
```
<!-- [TABS-END] -->
For more configurable parameters, please refer to the [API](https://mmclassification.readthedocs.io/en/1.x/api/generated/mmcls.models.backbones.RIFormer.html#mmcls.models.backbones.RIFormer).
For more configurable parameters, please refer to the [API](https://mmpretrain.readthedocs.io/en/latest/api/generated/mmpretrain.models.backbones.RIFormer.html#mmpretrain.models.backbones.RIFormer).
<details>
@ -153,23 +127,23 @@ For example:
```shell
# download the weight
wget /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/224/repidentityformer-s12.pth.tar
wget https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s12_32xb128_in1k_20230406-6741ce71.pth
# reparameterize unfused weight to fused weight
python tools/model_converters/reparameterize_model.py configs/riformer/riformer-s12_8xb128_in1k.py /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained/224/repidentityformer-s12.pth.tar /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained_deploy/224/repidentityformer-s12.pth.tar
python tools/model_converters/reparameterize_model.py configs/riformer/riformer-s12_8xb128_in1k.py riformer-s12_32xb128_in1k_20230406-6741ce71.pth riformer-s12_deploy.pth
```
To use reparameterized weights, you can use the deploy model config file such as the [s12_deploy example](./riformer-s12-deploy_8xb128_in1k.py):
To use reparameterized weights, you can use the deploy model config file such as the [s12_deploy example](./deploy/riformer-s12-deploy_8xb128_in1k.py):
```text
# in riformer-s12-deploy_8xb128_in1k.py
_base_ = '../riformer-s12-deploy_8xb128_in1k.py' # basic s12 config
_base_ = '../deploy/riformer-s12-deploy_8xb128_in1k.py' # basic s12 config
model = dict(backbone=dict(deploy=True)) # switch model into deploy mode
```
```shell
python tools/test.py configs/riformer/deploy/riformer-s12-deploy_8xb128_in1k.py /home/PJLAB/wangjiahao/project/RepIndentityFormer/mmcls_pretrained_deploy/224/repidentityformer-s12.pth.tar
python tools/test.py configs/riformer/deploy/riformer-s12-deploy_8xb128_in1k.py riformer-s12_deploy.pth
```
</br>
@ -180,18 +154,18 @@ python tools/test.py configs/riformer/deploy/riformer-s12-deploy_8xb128_in1k.py
### ImageNet-1k
| Model | resolution | Params(M) | Flops(G) | Top-1 (%) | Top-5 (%) | Config | Download |
| :----------: | :--------: | :-------: | :------: | :-------: | :-------: | :------------------------------------------: | :-------------------------------------------------------------------------------------------------: |
| RIFormer-S12 | 224x224 | 11.92 | 1.82 | 76.90 | 93.06 | [config](./riformer-s12_8xb128_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s12_8xb128_in1k_20230406-6741ce71.pth) |
| RIFormer-S24 | 224x224 | 21.39 | 3.41 | 80.28 | 94.80 | [config](./riformer-s24_8xb128_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s24_8xb128_in1k_20230406-fdab072a.pth) |
| RIFormer-S36 | 224x224 | 30.86 | 5.00 | 81.29 | 95.41 | [config](./riformer-s36_8xb128_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s36_8xb128_in1k_20230406-fdfcd3b0.pth) |
| RIFormer-M36 | 224x224 | 56.17 | 8.80 | 82.57 | 95.99 | [config](./riformer-m36_8xb128_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m36_8xb128_in1k_20230406-2fcb9d9b.pth) |
| RIFormer-M48 | 224x224 | 73.47 | 11.59 | 82.75 | 96.11 | [config](./riformer-m48_8xb64_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m48_8xb128_in1k_20230406-2b9d1abf.pth) |
| RIFormer-S12 | 384x384 | 11.92 | 5.36 | 78.29 | 93.93 | [config](./riformer-s12_8xb128_in1k_384.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s12_8xb128_in1k-384px_20230406-145eda4c.pth) |
| RIFormer-S24 | 384x384 | 21.39 | 10.03 | 81.36 | 95.40 | [config](./riformer-s24_8xb128_in1k_384.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s24_8xb128_in1k-384px_20230406-bafae7ab.pth) |
| RIFormer-S36 | 384x384 | 30.86 | 14.70 | 82.22 | 95.95 | [config](./riformer-s36_8xb64_in1k_384.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s36_8xb128_in1k-384px_20230406-017ed3c4.pth) |
| RIFormer-M36 | 384x384 | 56.17 | 25.87 | 83.39 | 96.40 | [config](./riformer-m36_8xb64_in1k_384.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m36_8xb128_in1k-384px_20230406-66a6f764.pth) |
| RIFormer-M48 | 384x384 | 73.47 | 34.06 | 83.70 | 96.60 | [config](./riformer-m48_8xb64_in1k_384.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m48_8xb128_in1k-384px_20230406-2e874826.pth) |
| Model | resolution | Params(M) | Flops(G) | Top-1 (%) | Top-5 (%) | Config | Download |
| :-------------------: | :--------: | :-------: | :------: | :-------: | :-------: | :-------------------------------------------: | :---------------------------------------------------------------------------------------: |
| riformer-s12_in1k | 224x224 | 11.92 | 1.82 | 76.90 | 93.06 | [config](./riformer-s12_8xb128_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s12_32xb128_in1k_20230406-6741ce71.pth) |
| riformer-s24_in1k | 224x224 | 21.39 | 3.41 | 80.28 | 94.80 | [config](./riformer-s24_8xb128_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s24_32xb128_in1k_20230406-fdab072a.pth) |
| riformer-s36_in1k | 224x224 | 30.86 | 5.00 | 81.29 | 95.41 | [config](./riformer-s36_8xb128_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s36_32xb128_in1k_20230406-fdfcd3b0.pth) |
| riformer-m36_in1k | 224x224 | 56.17 | 8.80 | 82.57 | 95.99 | [config](./riformer-m36_8xb128_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m36_32xb128_in1k_20230406-2fcb9d9b.pth) |
| riformer-m48_in1k | 224x224 | 73.47 | 11.59 | 82.75 | 96.11 | [config](./riformer-m48_8xb64_in1k.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m48_32xb128_in1k_20230406-2b9d1abf.pth) |
| riformer-s12_384_in1k | 384x384 | 11.92 | 5.36 | 78.29 | 93.93 | [config](./riformer-s12_8xb128_in1k_384px.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s12_32xb128_in1k-384px_20230406-145eda4c.pth) |
| riformer-s24_384_in1k | 384x384 | 21.39 | 10.03 | 81.36 | 95.40 | [config](./riformer-s24_8xb128_in1k_384px.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s24_32xb128_in1k-384px_20230406-bafae7ab.pth) |
| riformer-s36_384_in1k | 384x384 | 30.86 | 14.70 | 82.22 | 95.95 | [config](./riformer-s36_8xb64_in1k_384px.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s36_32xb128_in1k-384px_20230406-017ed3c4.pth) |
| riformer-m36_384_in1k | 384x384 | 56.17 | 25.87 | 83.39 | 96.40 | [config](./riformer-m36_8xb64_in1k_384px.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m36_32xb128_in1k-384px_20230406-66a6f764.pth) |
| riformer-m48_384_in1k | 384x384 | 73.47 | 34.06 | 83.70 | 96.60 | [config](./riformer-m48_8xb64_in1k_384px.py) | [model](https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m48_32xb128_in1k-384px_20230406-2e874826.pth) |
The config files of these models are only for inference.
@ -199,7 +173,7 @@ The config files of these models are only for inference.
```bibtex
@inproceedings{wang2023riformer,
title={MetaFormer is Actually What You Need for Vision},
title={RIFormer: Keep Your Vision Backbone Effective But Removing Token Mixer},
author={Wang, Jiahao and Zhang, Songyang and Liu, Yong and Wu, Taiqiang and Yang, Yujiu and Liu, Xihui and Chen, Kai and Luo, Ping and Lin, Dahua},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
year={2023}

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-m36_32xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-m36_32xb128_in1k_384.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-m36_8xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-m36_8xb64_in1k_384px.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-m48_32xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-m48_32xb128_in1k_384.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-m48_8xb64_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-m48_8xb64_in1k_384px.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-s12_32xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-s12_32xb128_in1k_384.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-s12_8xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-s12_8xb128_in1k_384px.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-s24_32xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-s24_32xb128_in1k_384.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-s24_8xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-s24_8xb128_in1k_384px.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-s36_32xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -1,3 +0,0 @@
_base_ = '../riformer-s36_32xb128_in1k_384.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-s36_8xb128_in1k.py'
model = dict(backbone=dict(deploy=True))

View File

@ -0,0 +1,3 @@
_base_ = '../riformer-s36_8xb64_in1k_384px.py'
model = dict(backbone=dict(deploy=True))

View File

@ -12,7 +12,7 @@ Collections:
README: configs/riformer/README.md
Code:
Version: v1.0.rc6
URL:
URL: null
Models:
- Name: riformer-s12_in1k
@ -28,15 +28,12 @@ Models:
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s12_32xb128_in1k_20230406-6741ce71.pth
Config: configs/riformer/riformer-s12_8xb128_in1k.py
Converted From:
Weights:
Code:
- Name: riformer-s24_in1k
Metadata:
Training Data: ImageNet-1k
FLOPs: 3412000000
Parameters: 21389000
In Collection: PoolFormer
In Collection: RIFormer
Results:
- Dataset: ImageNet-1k
Metrics:
@ -45,14 +42,11 @@ Models:
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s24_32xb128_in1k_20230406-fdab072a.pth
Config: configs/riformer/riformer-s24_8xb128_in1k.py
Converted From:
Weights:
Code:
- Name: riformer-s36_in1k
Metadata:
FLOPs: 5003000000
Parameters: 30863000
In Collection: PoolFormer
In Collection: RIFormer
Results:
- Dataset: ImageNet-1k
Metrics:
@ -61,15 +55,12 @@ Models:
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s36_32xb128_in1k_20230406-fdfcd3b0.pth
Config: configs/riformer/riformer-s36_8xb128_in1k.py
Converted From:
Weights:
Code:
- Name: riformer-m36_in1k
Metadata:
Training Data: ImageNet-1k
FLOPs: 8801000000
Parameters: 56173000
In Collection: PoolFormer
In Collection: RIFormer
Results:
- Dataset: ImageNet-1k
Metrics:
@ -78,14 +69,11 @@ Models:
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m36_32xb128_in1k_20230406-2fcb9d9b.pth
Config: configs/riformer/riformer-m36_8xb128_in1k.py
Converted From:
Weights:
Code:
- Name: riformer-m48_in1k
Metadata:
FLOPs: 11590000000
Parameters: 73473000
In Collection: PoolFormer
In Collection: RIFormer
Results:
- Dataset: ImageNet-1k
Metrics:
@ -94,9 +82,6 @@ Models:
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m48_32xb128_in1k_20230406-2b9d1abf.pth
Config: configs/riformer/riformer-m48_8xb64_in1k.py
Converted From:
Weights:
Code:
- Name: riformer-s12_384_in1k
Metadata:
FLOPs: 5355000000
@ -109,16 +94,13 @@ Models:
Top 5 Accuracy: 93.93
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s12_32xb128_in1k-384px_20230406-145eda4c.pth
Config: configs/riformer/riformer-s12_8xb128_in1k_384.py
Converted From:
Weights:
Code:
Config: configs/riformer/riformer-s12_8xb128_in1k_384px.py
- Name: riformer-s24_384_in1k
Metadata:
Training Data: ImageNet-1k
FLOPs: 10028000000
Parameters: 21389000
In Collection: PoolFormer
In Collection: RIFormer
Results:
- Dataset: ImageNet-1k
Metrics:
@ -126,15 +108,12 @@ Models:
Top 5 Accuracy: 95.40
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s24_32xb128_in1k-384px_20230406-bafae7ab.pth
Config: configs/riformer/riformer-s24_8xb128_in1k_384.py
Converted From:
Weights:
Code:
Config: configs/riformer/riformer-s24_8xb128_in1k_384px.py
- Name: riformer-s36_384_in1k
Metadata:
FLOPs: 14702000000
Parameters: 30863000
In Collection: PoolFormer
In Collection: RIFormer
Results:
- Dataset: ImageNet-1k
Metrics:
@ -142,16 +121,13 @@ Models:
Top 5 Accuracy: 95.95
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-s36_32xb128_in1k-384px_20230406-017ed3c4.pth
Config: configs/riformer/riformer-s36_8xb64_in1k_384.py
Converted From:
Weights:
Code:
Config: configs/riformer/riformer-s36_8xb64_in1k_384px.py
- Name: riformer-m36_384_in1k
Metadata:
Training Data: ImageNet-1k
FLOPs: 25865000000
Parameters: 56173000
In Collection: PoolFormer
In Collection: RIFormer
Results:
- Dataset: ImageNet-1k
Metrics:
@ -159,15 +135,12 @@ Models:
Top 5 Accuracy: 96.40
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m36_32xb128_in1k-384px_20230406-66a6f764.pth
Config: configs/riformer/riformer-m36_8xb64_in1k_384.py
Converted From:
Weights:
Code:
Config: configs/riformer/riformer-m36_8xb64_in1k_384px.py
- Name: riformer-m48_384_in1k
Metadata:
FLOPs: 34060000000
Parameters: 73473000
In Collection: PoolFormer
In Collection: RIFormer
Results:
- Dataset: ImageNet-1k
Metrics:
@ -175,7 +148,4 @@ Models:
Top 5 Accuracy: 96.60
Task: Image Classification
Weights: https://download.openmmlab.com/mmclassification/v1/riformer/riformer-m48_32xb128_in1k-384px_20230406-2e874826.pth
Config: configs/riformer/riformer-m48_8xb64_in1k_384.py
Converted From:
Weights:
Code:
Config: configs/riformer/riformer-m48_8xb64_in1k_384px.py

View File

@ -110,10 +110,6 @@ class RIFormerBlock(BaseModule):
beta_affn = token_mixer.affine.bias
gamma_ln = norm.weight
beta_ln = norm.bias
print('gamma_affn:', gamma_affn.shape)
print('beta_affn:', beta_affn.shape)
print('gamma_ln:', gamma_ln.shape)
print('beta_ln:', beta_ln.shape)
return (gamma_ln * gamma_affn), (beta_ln * gamma_affn + beta_affn)
def get_equivalent_scale_bias(self):