Skip to content
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
10 changes: 9 additions & 1 deletion colossalai/legacy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
from .initialize import initialize, launch, launch_from_openmpi, launch_from_slurm, launch_from_torch
from .initialize import (
get_default_parser,
initialize,
launch,
launch_from_openmpi,
launch_from_slurm,
launch_from_torch,
)

__all__ = [
"launch",
"launch_from_openmpi",
"launch_from_slurm",
"launch_from_torch",
"initialize",
"get_default_parser",
]
4 changes: 2 additions & 2 deletions examples/community/roberta/pretraining/arguments.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import colossalai
import argparse

__all__ = ["parse_args"]


def parse_args():
parser = colossalai.get_default_parser()
parser = argparse.ArgumentParser()

parser.add_argument(
"--distplan",
Expand Down
6 changes: 3 additions & 3 deletions examples/images/vit/args.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from colossalai import get_default_parser
import argparse


def parse_demo_args():
parser = get_default_parser()
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
Expand Down Expand Up @@ -52,7 +52,7 @@ def parse_demo_args():


def parse_benchmark_args():
parser = get_default_parser()
parser = argparse.ArgumentParser()

parser.add_argument(
"--model_name_or_path",
Expand Down
6 changes: 3 additions & 3 deletions examples/images/vit/run_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ for PLUGIN in "torch_ddp" "torch_ddp_fp16" "low_level_zero" "gemini" "hybrid_par
do

MODEL_PATH="google/vit-base-patch16-224"
torchrun \
--standalone \
--nproc_per_node 4 \
colossalai run \
--nproc_per_node ${GPUNUM} \
--master_port 29505 \
vit_benchmark.py \
--model_name_or_path ${MODEL_PATH} \
--mem_cap ${MEMCAP} \
Expand Down
4 changes: 2 additions & 2 deletions examples/images/vit/run_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ WEIGHT_DECAY=0.05
WARMUP_RATIO=0.3

# run the script for demo
torchrun \
--standalone \
colossalai run \
--nproc_per_node ${GPUNUM} \
--master_port 29505 \
vit_train_demo.py \
--model_name_or_path ${MODEL} \
--output_path ${OUTPUT_PATH} \
Expand Down
4 changes: 2 additions & 2 deletions examples/images/vit/test_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ BS=8
for PLUGIN in "torch_ddp" "torch_ddp_fp16" "low_level_zero" "gemini" "hybrid_parallel"
do

torchrun \
--standalone \
colossalai run \
--nproc_per_node 4 \
--master_port 29505 \
vit_benchmark.py \
--model_name_or_path "google/vit-base-patch16-224" \
--plugin ${PLUGIN} \
Expand Down
3 changes: 2 additions & 1 deletion examples/language/gpt/titans/train_gpt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argparse
import contextlib
import os

Expand Down Expand Up @@ -29,7 +30,7 @@ def calc_local_model_size(model: torch.nn.Module):


def main():
parser = colossalai.get_default_parser()
parser = argparse.ArgumentParser()
parser.add_argument("--from_torch", default=False, action="store_true")
parser.add_argument("--use_dummy_dataset", default=False, action="store_true")
args = parser.parse_args()
Expand Down
6 changes: 3 additions & 3 deletions examples/language/opt/args.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from colossalai import get_default_parser
import argparse


def parse_demo_args():
parser = get_default_parser()
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
Expand Down Expand Up @@ -39,7 +39,7 @@ def parse_demo_args():


def parse_benchmark_args():
parser = get_default_parser()
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
Expand Down
4 changes: 2 additions & 2 deletions examples/language/opt/run_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ for GPUNUM in 1 4
do

MODLE_PATH="facebook/opt-${MODEL}"
torchrun \
--standalone \
colossalai run \
--nproc_per_node ${GPUNUM} \
--master_port 29505 \
opt_benchmark.py \
--model_name_or_path ${MODLE_PATH} \
--mem_cap ${MEMCAP} \
Expand Down
4 changes: 2 additions & 2 deletions examples/language/opt/run_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ WEIGHT_DECAY=0.01
WARMUP_RATIO=0.1

# run the script for demo
torchrun \
--standalone \
colossalai run \
--nproc_per_node ${GPUNUM} \
--master_port 29505 \
opt_train_demo.py \
--model_name_or_path ${MODEL} \
--output_path ${OUTPUT_PATH} \
Expand Down
4 changes: 2 additions & 2 deletions examples/language/opt/test_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ do
for GPUNUM in 1 4
do

torchrun \
--standalone \
colossalai run \
--nproc_per_node ${GPUNUM} \
--master_port 29505 \
opt_benchmark.py \
--model_name_or_path "facebook/opt-125m" \
--plugin ${PLUGIN} \
Expand Down
2 changes: 1 addition & 1 deletion examples/language/palm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export PLACEMENT='cpu'
export USE_SHARD_INIT=False
export BATCH_SIZE=1

env OMP_NUM_THREADS=12 torchrun --standalone --nproc_per_node=${GPUNUM} --master_port 29501 train.py \
env OMP_NUM_THREADS=12 colossalai run --nproc_per_node ${GPUNUM} --master_port 29505 train.py \
--dummy_data=True --tp_degree=${TPDEGREE} --batch_size=${BATCH_SIZE} --plugin='gemini' \
--placement ${PLACEMENT} --shardinit ${USE_SHARD_INIT} --distplan ${DISTPAN} 2>&1 | tee run.log
2 changes: 1 addition & 1 deletion examples/language/palm/test_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ for BATCH_SIZE in 2
do
for GPUNUM in 1 4
do
env OMP_NUM_THREADS=12 torchrun --standalone --nproc_per_node=${GPUNUM} --standalone train.py --dummy_data=True --batch_size=${BATCH_SIZE} --plugin='gemini' 2>&1 | tee run.log
env OMP_NUM_THREADS=12 colossalai run --nproc_per_node ${GPUNUM} --master_port 29505 train.py --dummy_data=True --batch_size=${BATCH_SIZE} --plugin='gemini' 2>&1 | tee run.log
done
done
3 changes: 2 additions & 1 deletion examples/language/palm/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argparse
import gzip
from contextlib import nullcontext
from functools import partial
Expand Down Expand Up @@ -33,7 +34,7 @@


def parse_args():
parser = colossalai.get_default_parser()
parser = argparse.ArgumentParser()
parser.add_argument(
"--distplan",
type=str,
Expand Down