Skip to content

Commit 7f8b166

Browse files
[misc] refactor launch API and tensor constructor (#5666)
* [misc] remove config arg from initialize * [misc] remove old tensor contrusctor * [plugin] add npu support for ddp * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [devops] fix doc test ci * [test] fix test launch * [doc] update launch doc --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 91fa553 commit 7f8b166

File tree

223 files changed

+294
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+294
-403
lines changed

.github/workflows/doc_test_on_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
needs: detect-changed-doc
5757
runs-on: [self-hosted, gpu]
5858
container:
59-
image: hpcaitech/pytorch-cuda:2.0.0-11.7.0
59+
image: hpcaitech/pytorch-cuda:2.1.0-12.1.0
6060
options: --gpus all --rm
6161
timeout-minutes: 20
6262
defaults:

applications/Colossal-LLaMA/train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def main() -> None:
136136
# ==============================
137137
# Initialize Distributed Training
138138
# ==============================
139-
colossalai.launch_from_torch({})
139+
colossalai.launch_from_torch()
140140
accelerator = get_accelerator()
141141
coordinator = DistCoordinator()
142142

applications/ColossalChat/benchmarks/benchmark_ppo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def benchmark_train(args):
6666
# ==============================
6767
# Initialize Distributed Training
6868
# ==============================
69-
colossalai.launch_from_torch({})
69+
colossalai.launch_from_torch()
7070
coordinator = DistCoordinator()
7171

7272
# ======================================================

applications/ColossalChat/examples/training_scripts/train_dpo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def train(args):
3737
# ==============================
3838
# Initialize Distributed Training
3939
# ==============================
40-
colossalai.launch_from_torch({})
40+
colossalai.launch_from_torch()
4141
coordinator = DistCoordinator()
4242

4343
# ==============================

applications/ColossalChat/examples/training_scripts/train_ppo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def train(args):
3939
# ==============================
4040
# Initialize Distributed Training
4141
# ==============================
42-
colossalai.launch_from_torch({})
42+
colossalai.launch_from_torch()
4343
coordinator = DistCoordinator()
4444

4545
# ======================================================

applications/ColossalChat/examples/training_scripts/train_rm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def train(args):
3434
# ==============================
3535
# Initialize Distributed Training
3636
# ==============================
37-
colossalai.launch_from_torch({})
37+
colossalai.launch_from_torch()
3838
coordinator = DistCoordinator()
3939

4040
# ======================================================

applications/ColossalChat/examples/training_scripts/train_sft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def train(args):
2929
# ==============================
3030
# Initialize Distributed Training
3131
# ==============================
32-
colossalai.launch_from_torch({})
32+
colossalai.launch_from_torch()
3333
coordinator = DistCoordinator()
3434

3535
# ==============================

applications/ColossalEval/examples/dataset_evaluation/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def rm_and_merge(
8181

8282

8383
def main(args):
84-
colossalai.launch_from_torch(config={}, seed=42)
84+
colossalai.launch_from_torch(seed=42)
8585
accelerator = get_accelerator()
8686
world_size = dist.get_world_size()
8787

applications/ColossalEval/examples/gpt_evaluation/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def rm_and_merge(
8181

8282

8383
def main(args):
84-
colossalai.launch_from_torch(config={}, seed=42)
84+
colossalai.launch_from_torch(seed=42)
8585
world_size = dist.get_world_size()
8686

8787
rank = dist.get_rank()

applications/ColossalMoE/infer.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def main():
5757
args = parse_args()
5858

5959
# Launch ColossalAI
60-
colossalai.launch_from_torch(config={}, seed=args.seed)
60+
colossalai.launch_from_torch(seed=args.seed)
6161
coordinator = DistCoordinator()
6262

6363
config = MixtralConfig.from_pretrained(args.model_name)
@@ -96,7 +96,11 @@ def main():
9696
if coordinator.rank == 0:
9797
text = ["Hello my name is"]
9898
else:
99-
text = ["What's the largest country in the world?", "How many people live in China?", "帮我续写这首诗:离离原上草"]
99+
text = [
100+
"What's the largest country in the world?",
101+
"How many people live in China?",
102+
"帮我续写这首诗:离离原上草",
103+
]
100104
tokenizer.pad_token = tokenizer.unk_token
101105
inputs = tokenizer(text, return_tensors="pt", padding=True).to(torch.cuda.current_device())
102106

0 commit comments

Comments
 (0)