Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Oneflow-Inc/CoModels into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnXuan committed Aug 10, 2024
2 parents 949aad4 + c954801 commit aa6a774
Show file tree
Hide file tree
Showing 1,406 changed files with 23,147 additions and 54 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
# Models implemented with OneFlow framework.

- cv
- nlp
- [text_classfication](./nlp/text_classfication/)
- [odd_numbers](./nlp/odd_numbers/)
- science
- audio
- vidio
18 changes: 13 additions & 5 deletions cv/classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,20 @@ For CIFAR100, you only need to specify the dataset downloaded path in [config.py


### Training
- ddp training with simple bash file

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

```bash
sh train.sh
```

### inference

Bash script `infer.sh` is used to infer the trained model.

```bash
cd vision/projects/classification/
bash ddp_training.sh
sh infer.sh
```


## Reference
- [Swin-Transformer](https://github.com/microsoft/Swin-Transformer)

66 changes: 66 additions & 0 deletions cv/classification/cait_M36_384/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## cait_M36_384

### 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/. We provide the following two ways to load data:

- For standard folder dataset, move validation images to labeled sub-folders. The file structure should look like:
```bash
$ tree data
imagenet
├── train
│ ├── class1
│ │ ├── img1.jpeg
│ │ ├── img2.jpeg
│ │ └── ...
│ ├── class2
│ │ ├── img3.jpeg
│ │ └── ...
│ └── ...
└── val
├── class1
│ ├── img4.jpeg
│ ├── img5.jpeg
│ └── ...
├── class2
│ ├── img6.jpeg
│ └── ...
└── ...


### Training

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

```bash
sh train.sh
```

### inference

Bash script `infer.sh` is used to infer the trained model.

```bash
sh infer.sh
```

File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions cv/classification/cait_M36_384/infer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=1
PORT=12346
MODEL_ARCH="cait_M36_384"

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 \
--lr 1e-5 \
--image-size 384 \
--throughput

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions cv/classification/cait_M36_384/train.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=8
PORT=12346
MODEL_ARCH="cait_M36_384"

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 \
--lr 1e-5 \
--batch-size 8 \
--image-size 384

File renamed without changes.
66 changes: 66 additions & 0 deletions cv/classification/cait_M48_448/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## cait_M48_448

### 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/. We provide the following two ways to load data:

- For standard folder dataset, move validation images to labeled sub-folders. The file structure should look like:
```bash
$ tree data
imagenet
├── train
│ ├── class1
│ │ ├── img1.jpeg
│ │ ├── img2.jpeg
│ │ └── ...
│ ├── class2
│ │ ├── img3.jpeg
│ │ └── ...
│ └── ...
└── val
├── class1
│ ├── img4.jpeg
│ ├── img5.jpeg
│ └── ...
├── class2
│ ├── img6.jpeg
│ └── ...
└── ...


### Training

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

```bash
sh train.sh
```

### inference

Bash script `infer.sh` is used to infer the trained model.

```bash
sh infer.sh
```

1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/config.py
1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/configs
1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/data
18 changes: 18 additions & 0 deletions cv/classification/cait_M48_448/infer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=1
PORT=12346
MODEL_ARCH="cait_M48_448"

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 \
--lr 1e-5 \
--image-size 448 \
--throughput

1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/logger.py
1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/lr_scheduler.py
1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/main.py
1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/optimizer.py
1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/requirements.txt
18 changes: 18 additions & 0 deletions cv/classification/cait_M48_448/train.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=8
PORT=12346
MODEL_ARCH="cait_M48_448"

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 \
--lr 1e-5 \
--image-size 448 \
--batch-size 1

1 change: 1 addition & 0 deletions cv/classification/cait_M48_448/utils.py
66 changes: 66 additions & 0 deletions cv/classification/cait_S24_384/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## cait_S24_384

### 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/. We provide the following two ways to load data:

- For standard folder dataset, move validation images to labeled sub-folders. The file structure should look like:
```bash
$ tree data
imagenet
├── train
│ ├── class1
│ │ ├── img1.jpeg
│ │ ├── img2.jpeg
│ │ └── ...
│ ├── class2
│ │ ├── img3.jpeg
│ │ └── ...
│ └── ...
└── val
├── class1
│ ├── img4.jpeg
│ ├── img5.jpeg
│ └── ...
├── class2
│ ├── img6.jpeg
│ └── ...
└── ...


### Training

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

```bash
sh train.sh
```

### inference

Bash script `infer.sh` is used to infer the trained model.

```bash
sh infer.sh
```

1 change: 1 addition & 0 deletions cv/classification/cait_S24_384/config.py
1 change: 1 addition & 0 deletions cv/classification/cait_S24_384/configs
1 change: 1 addition & 0 deletions cv/classification/cait_S24_384/data
18 changes: 18 additions & 0 deletions cv/classification/cait_S24_384/infer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export PYTHONPATH=$PWD:$PYTHONPATH
set -aux

GPU_NUMS=1
PORT=12346
MODEL_ARCH="cait_S24_384"

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 \
--lr 1e-5 \
--image-size 384 \
--throughput

1 change: 1 addition & 0 deletions cv/classification/cait_S24_384/logger.py
1 change: 1 addition & 0 deletions cv/classification/cait_S24_384/lr_scheduler.py
1 change: 1 addition & 0 deletions cv/classification/cait_S24_384/main.py
1 change: 1 addition & 0 deletions cv/classification/cait_S24_384/optimizer.py
1 change: 1 addition & 0 deletions cv/classification/cait_S24_384/requirements.txt
Loading

0 comments on commit aa6a774

Please sign in to comment.