Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
89fd10a1
"vscode:/vscode.git/clone" did not exist on "abd8e77ad861a75a149cff488cc2949bc760f0f5"
Unverified
Commit
89fd10a1
authored
Apr 10, 2023
by
ver217
Committed by
GitHub
Apr 10, 2023
Browse files
[chat] add zero2 cpu strategy for sft training (#3520)
parent
990d4c3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
applications/Chat/examples/train_sft.py
applications/Chat/examples/train_sft.py
+3
-1
No files found.
applications/Chat/examples/train_sft.py
View file @
89fd10a1
...
@@ -35,6 +35,8 @@ def train(args):
...
@@ -35,6 +35,8 @@ def train(args):
strategy
=
ColossalAIStrategy
(
stage
=
3
,
placement_policy
=
'cuda'
)
strategy
=
ColossalAIStrategy
(
stage
=
3
,
placement_policy
=
'cuda'
)
elif
args
.
strategy
==
'colossalai_zero2'
:
elif
args
.
strategy
==
'colossalai_zero2'
:
strategy
=
ColossalAIStrategy
(
stage
=
2
,
placement_policy
=
'cuda'
)
strategy
=
ColossalAIStrategy
(
stage
=
2
,
placement_policy
=
'cuda'
)
elif
args
.
strategy
==
'colossalai_zero2_cpu'
:
strategy
=
ColossalAIStrategy
(
stage
=
2
,
placement_policy
=
'cpu'
)
else
:
else
:
raise
ValueError
(
f
'Unsupported strategy "
{
args
.
strategy
}
"'
)
raise
ValueError
(
f
'Unsupported strategy "
{
args
.
strategy
}
"'
)
...
@@ -168,7 +170,7 @@ def train(args):
...
@@ -168,7 +170,7 @@ def train(args):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--strategy'
,
parser
.
add_argument
(
'--strategy'
,
choices
=
[
'naive'
,
'ddp'
,
'colossalai_gemini'
,
'colossalai_zero2'
],
choices
=
[
'naive'
,
'ddp'
,
'colossalai_gemini'
,
'colossalai_zero2'
,
'colossalai_zero2_cpu'
],
default
=
'naive'
)
default
=
'naive'
)
parser
.
add_argument
(
'--model'
,
choices
=
[
'gpt2'
,
'bloom'
,
'opt'
,
'llama'
],
default
=
'bloom'
)
parser
.
add_argument
(
'--model'
,
choices
=
[
'gpt2'
,
'bloom'
,
'opt'
,
'llama'
],
default
=
'bloom'
)
parser
.
add_argument
(
'--pretrain'
,
type
=
str
,
default
=
None
)
parser
.
add_argument
(
'--pretrain'
,
type
=
str
,
default
=
None
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment