Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poolformer s24 #277

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions cv/classification/poolformer_s24/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## Poolformer-S24

### Installation
- Install the latest version of OneFlow
```bash
python3 -m pip install oneflow -f https://staging.oneflow.info/branch/master/[PLATFORM]
```
Find more information on [install oneflow](https://github.com/Oneflow-Inc/oneflow#install-oneflow)

- Install flowvision

Then install the latest stable release of flowvision

```bash
pip install flowvision==0.2.1
```

- Install other requirements
```bash
python3 -m pip install -r requirements.txt
```


### Dataset
#### ImageNet
For ImageNet dataset, you can download it from http://image-net.org/.

### Code Structure


```
.
├── configs -> ../configs
│ ├── ...
│ └── default_settings.yaml
├── data -> ../data
│ ├── __init__.py
│ ├── build.py
│ ├── cached_image_folder.py
│ ├── samplers.py
│ └── zipreader.py
├── utils.py -> ../utils.py
├── config.py -> ../config.py
├── logger.py -> ../logger.py
├── lr_scheduler.py -> ../lr_scheduler.py
├── optimizer.py -> ../optimizer.py
├── main.py
├── train.sh
└── infer.sh
```



### Training
You can use bash script `train.sh` to train this model.
```````
sh train.sh
```````

### Inference

Bash script `infer.sh` is used to infer the trained model.
```````
sh infer.sh
```````
1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/config.py
1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/configs
1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/data
15 changes: 15 additions & 0 deletions cv/classification/poolformer_s24/infer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=1
PORT=12346
MODEL_ARCH="poolformer_s24"

python3 -m oneflow.distributed.launch \
--nproc_per_node $GPU_NUMS \
--master_addr 127.0.0.1 \
--master_port $PORT \
main.py \
--cfg configs/default_settings.yaml \
--model_arch $MODEL_ARCH \
--throughput
1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/logger.py
1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/lr_scheduler.py
1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/main.py
1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/optimizer.py
1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/requirements.txt
19 changes: 19 additions & 0 deletions cv/classification/poolformer_s24/train.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=4
PORT=12346
MODEL_ARCH="poolformer_s24"
BATCH_SIZE=64
LEARNING_RATE=1e-4

python3 -m oneflow.distributed.launch \
--nproc_per_node $GPU_NUMS \
--master_addr 127.0.0.1 \
--master_port $PORT \
main.py \
--cfg configs/default_settings.yaml \
--model_arch $MODEL_ARCH \
--batch-size $BATCH_SIZE \
--lr $LEARNING_RATE

1 change: 1 addition & 0 deletions cv/classification/poolformer_s24/utils.py