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
a799ca34
Unverified
Commit
a799ca34
authored
Apr 07, 2024
by
digger yu
Committed by
GitHub
Apr 07, 2024
Browse files
[fix] fix typo s/muiti-node /multi-node etc. (#5448)
parent
15055f9a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
16 deletions
+16
-16
applications/ColossalEval/colossal_eval/evaluate/gpt_evaluate.py
...tions/ColossalEval/colossal_eval/evaluate/gpt_evaluate.py
+1
-1
applications/ColossalMoE/train.py
applications/ColossalMoE/train.py
+3
-3
applications/ColossalQA/colossalqa/data_loader/document_loader.py
...ions/ColossalQA/colossalqa/data_loader/document_loader.py
+1
-1
applications/ColossalQA/colossalqa/local/colossalcloud_llm.py
...ications/ColossalQA/colossalqa/local/colossalcloud_llm.py
+1
-1
applications/ColossalQA/colossalqa/local/llm.py
applications/ColossalQA/colossalqa/local/llm.py
+3
-3
applications/ColossalQA/colossalqa/retrieval_conversation_universal.py
...ColossalQA/colossalqa/retrieval_conversation_universal.py
+1
-1
applications/ColossalQA/colossalqa/retriever.py
applications/ColossalQA/colossalqa/retriever.py
+1
-1
applications/ColossalQA/colossalqa/utils.py
applications/ColossalQA/colossalqa/utils.py
+1
-1
examples/language/openmoe/model/modeling_openmoe.py
examples/language/openmoe/model/modeling_openmoe.py
+1
-1
examples/language/openmoe/train.py
examples/language/openmoe/train.py
+3
-3
No files found.
applications/ColossalEval/colossal_eval/evaluate/gpt_evaluate.py
View file @
a799ca34
...
@@ -670,7 +670,7 @@ def calculate_scores_form_logprobs(logprobs: Dict[str, Any]) -> float:
...
@@ -670,7 +670,7 @@ def calculate_scores_form_logprobs(logprobs: Dict[str, Any]) -> float:
def
calculate_scores_form_response
(
response
:
str
,
evaluation
:
Dict
[
str
,
Any
])
->
int
:
def
calculate_scores_form_response
(
response
:
str
,
evaluation
:
Dict
[
str
,
Any
])
->
int
:
"""
"""
Calculate the score from the response returned by gpt-3.5-turbo or gpt-4.
Calculate the score from the response returned by gpt-3.5-turbo or gpt-4.
Different from text-davinci-003, this fuction directly calculates the score according to the plain response returned by gpt-3.5-turbo or gpt-4.
Different from text-davinci-003, this fu
n
ction directly calculates the score according to the plain response returned by gpt-3.5-turbo or gpt-4.
Although text-davinci-003 can return log probabilities, it costs ten times as much as gpt-3.5-turbo.
Although text-davinci-003 can return log probabilities, it costs ten times as much as gpt-3.5-turbo.
Args:
Args:
...
...
applications/ColossalMoE/train.py
View file @
a799ca34
...
@@ -128,13 +128,13 @@ def parse_args():
...
@@ -128,13 +128,13 @@ def parse_args():
parser
.
add_argument
(
parser
.
add_argument
(
"--comm_overlap"
,
"--comm_overlap"
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Use communication overlap for MoE. Recommended to enable for mu
i
ti-node training."
,
help
=
"Use communication overlap for MoE. Recommended to enable for mu
l
ti-node training."
,
)
)
# hierarchical all-to-all
# hierarchical all-to-all
parser
.
add_argument
(
parser
.
add_argument
(
"--hierarchical_alltoall"
,
"--hierarchical_alltoall"
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Use hierarchical all-to-all for MoE. Recommended to enable for mu
i
ti-node training."
,
help
=
"Use hierarchical all-to-all for MoE. Recommended to enable for mu
l
ti-node training."
,
)
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
@@ -267,7 +267,7 @@ def main():
...
@@ -267,7 +267,7 @@ def main():
# ):
# ):
# coordinator.print_on_master(f"Apply load balance")
# coordinator.print_on_master(f"Apply load balance")
# apply_load_balance(model, optimizer)
# apply_load_balance(model, optimizer)
# save c
k
eckpoint
# save c
h
eckpoint
if
(
step
+
1
)
%
args
.
save_interval
==
0
:
if
(
step
+
1
)
%
args
.
save_interval
==
0
:
coordinator
.
print_on_master
(
f
"Saving model checkpoint to
{
args
.
output_path
}
"
)
coordinator
.
print_on_master
(
f
"Saving model checkpoint to
{
args
.
output_path
}
"
)
save_checkpoint
(
save_checkpoint
(
...
...
applications/ColossalQA/colossalqa/data_loader/document_loader.py
View file @
a799ca34
...
@@ -52,7 +52,7 @@ class DocumentLoader:
...
@@ -52,7 +52,7 @@ class DocumentLoader:
def
load_data
(
self
,
path
:
str
)
->
None
:
def
load_data
(
self
,
path
:
str
)
->
None
:
"""
"""
Load data. Please refer to https://python.langchain.com/docs/modules/data_connection/document_loaders/
Load data. Please refer to https://python.langchain.com/docs/modules/data_connection/document_loaders/
for s
e
pcific format requirements.
for sp
e
cific format requirements.
Args:
Args:
path: path to a file
path: path to a file
To load files with glob path, here are some examples.
To load files with glob path, here are some examples.
...
...
applications/ColossalQA/colossalqa/local/colossalcloud_llm.py
View file @
a799ca34
...
@@ -100,7 +100,7 @@ class ColossalCloudLLM(LLM):
...
@@ -100,7 +100,7 @@ class ColossalCloudLLM(LLM):
def
text_completion
(
self
,
prompt
,
gen_config
,
auth_config
):
def
text_completion
(
self
,
prompt
,
gen_config
,
auth_config
):
#
Complusory
Parameters
#
Required
Parameters
endpoint
=
auth_config
.
pop
(
'endpoint'
)
endpoint
=
auth_config
.
pop
(
'endpoint'
)
max_new_tokens
=
gen_config
.
pop
(
'max_new_tokens'
)
max_new_tokens
=
gen_config
.
pop
(
'max_new_tokens'
)
# Optional Parameters
# Optional Parameters
...
...
applications/ColossalQA/colossalqa/local/llm.py
View file @
a799ca34
...
@@ -33,7 +33,7 @@ class ColossalAPI:
...
@@ -33,7 +33,7 @@ class ColossalAPI:
def
__init__
(
self
,
model_type
:
str
,
model_path
:
str
,
ckpt_path
:
str
=
None
)
->
None
:
def
__init__
(
self
,
model_type
:
str
,
model_path
:
str
,
ckpt_path
:
str
=
None
)
->
None
:
"""
"""
Configur
at
e model
Configure model
"""
"""
if
model_type
+
model_path
+
(
ckpt_path
or
""
)
in
ColossalAPI
.
__instances
:
if
model_type
+
model_path
+
(
ckpt_path
or
""
)
in
ColossalAPI
.
__instances
:
return
return
...
@@ -47,7 +47,7 @@ class ColossalAPI:
...
@@ -47,7 +47,7 @@ class ColossalAPI:
self
.
model
.
load_state_dict
(
state_dict
)
self
.
model
.
load_state_dict
(
state_dict
)
self
.
model
.
to
(
torch
.
cuda
.
current_device
())
self
.
model
.
to
(
torch
.
cuda
.
current_device
())
# Configur
at
e tokenizer
# Configure tokenizer
self
.
tokenizer
=
AutoTokenizer
.
from_pretrained
(
model_path
,
trust_remote_code
=
True
)
self
.
tokenizer
=
AutoTokenizer
.
from_pretrained
(
model_path
,
trust_remote_code
=
True
)
self
.
model
.
eval
()
self
.
model
.
eval
()
...
@@ -87,7 +87,7 @@ class ColossalAPI:
...
@@ -87,7 +87,7 @@ class ColossalAPI:
class
VllmAPI
:
class
VllmAPI
:
def
__init__
(
self
,
host
:
str
=
"localhost"
,
port
:
int
=
8077
)
->
None
:
def
__init__
(
self
,
host
:
str
=
"localhost"
,
port
:
int
=
8077
)
->
None
:
# Configur
at
e api for model served through web
# Configure api for model served through web
self
.
host
=
host
self
.
host
=
host
self
.
port
=
port
self
.
port
=
port
self
.
url
=
f
"http://
{
self
.
host
}
:
{
self
.
port
}
/generate"
self
.
url
=
f
"http://
{
self
.
host
}
:
{
self
.
port
}
/generate"
...
...
applications/ColossalQA/colossalqa/retrieval_conversation_universal.py
View file @
a799ca34
...
@@ -36,7 +36,7 @@ class UniversalRetrievalConversation:
...
@@ -36,7 +36,7 @@ class UniversalRetrievalConversation:
text_splitter_chunk_overlap
=
10
,
text_splitter_chunk_overlap
=
10
,
)
->
None
:
)
->
None
:
"""
"""
W
a
rpper for multilingual retrieval qa class (Chinese + English)
Wr
a
pper for multilingual retrieval qa class (Chinese + English)
Args:
Args:
embedding_model_path: local or huggingface embedding model
embedding_model_path: local or huggingface embedding model
embedding_model_device:
embedding_model_device:
...
...
applications/ColossalQA/colossalqa/retriever.py
View file @
a799ca34
...
@@ -59,7 +59,7 @@ class CustomRetriever(BaseRetriever):
...
@@ -59,7 +59,7 @@ class CustomRetriever(BaseRetriever):
Add documents to retriever
Add documents to retriever
Args:
Args:
docs: the documents to add
docs: the documents to add
cleanup: choose from "incremental" (update embeddings, skip existing embeddings) and "full" (dest
o
ry and rebuild retriever)
cleanup: choose from "incremental" (update embeddings, skip existing embeddings) and "full" (destr
o
y and rebuild retriever)
mode: choose from "by source" (documents are grouped by source) and "merge" (documents are merged into one vector store)
mode: choose from "by source" (documents are grouped by source) and "merge" (documents are merged into one vector store)
"""
"""
if
cleanup
==
"full"
:
if
cleanup
==
"full"
:
...
...
applications/ColossalQA/colossalqa/utils.py
View file @
a799ca34
...
@@ -49,7 +49,7 @@ def destroy_sql_database(sql_engine: Union[Engine, str]) -> None:
...
@@ -49,7 +49,7 @@ def destroy_sql_database(sql_engine: Union[Engine, str]) -> None:
def
detect_lang_naive
(
s
):
def
detect_lang_naive
(
s
):
"""
"""
Naive function for language detection, should be replaced by an independ
a
nt layer
Naive function for language detection, should be replaced by an independ
e
nt layer
"""
"""
remove_nota
=
"[’·°–!
\"
#$%&'()*+,-./:;<=>?@,。?★、…【】()《》?“”‘’![
\\
]^_`{|}~]+"
remove_nota
=
"[’·°–!
\"
#$%&'()*+,-./:;<=>?@,。?★、…【】()《》?“”‘’![
\\
]^_`{|}~]+"
s
=
re
.
sub
(
remove_nota
,
""
,
s
)
s
=
re
.
sub
(
remove_nota
,
""
,
s
)
...
...
examples/language/openmoe/model/modeling_openmoe.py
View file @
a799ca34
...
@@ -96,7 +96,7 @@ def set_openmoe_args(
...
@@ -96,7 +96,7 @@ def set_openmoe_args(
load_balance_beam_width (int, optional): Expert load balance search's beam width. Defaults to 8.
load_balance_beam_width (int, optional): Expert load balance search's beam width. Defaults to 8.
load_balance_group_swap_factor (float, optional): Expert load balance group swap factor. Longer value encourages less swap. Defaults to 0.4.
load_balance_group_swap_factor (float, optional): Expert load balance group swap factor. Longer value encourages less swap. Defaults to 0.4.
enable_kernel (bool, optional): Use kernel optimization. Defaults to False.
enable_kernel (bool, optional): Use kernel optimization. Defaults to False.
enable_comm_overlap (bool, optional): Use communication overlap for MoE. Recommended to enable for mu
i
ti-node training. Defaults to False.
enable_comm_overlap (bool, optional): Use communication overlap for MoE. Recommended to enable for mu
l
ti-node training. Defaults to False.
enable_hierarchical_alltoall (bool, optional): Use hierarchical alltoall for MoE. Defaults to False.
enable_hierarchical_alltoall (bool, optional): Use hierarchical alltoall for MoE. Defaults to False.
"""
"""
moe_args
=
dict
(
moe_args
=
dict
(
...
...
examples/language/openmoe/train.py
View file @
a799ca34
...
@@ -190,13 +190,13 @@ def parse_args():
...
@@ -190,13 +190,13 @@ def parse_args():
parser
.
add_argument
(
parser
.
add_argument
(
"--comm_overlap"
,
"--comm_overlap"
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Use communication overlap for MoE. Recommended to enable for mu
i
ti-node training."
,
help
=
"Use communication overlap for MoE. Recommended to enable for mu
l
ti-node training."
,
)
)
# hierarchical all-to-all
# hierarchical all-to-all
parser
.
add_argument
(
parser
.
add_argument
(
"--hierarchical_alltoall"
,
"--hierarchical_alltoall"
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Use hierarchical all-to-all for MoE. Recommended to enable for mu
i
ti-node training."
,
help
=
"Use hierarchical all-to-all for MoE. Recommended to enable for mu
l
ti-node training."
,
)
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
@@ -366,7 +366,7 @@ def main():
...
@@ -366,7 +366,7 @@ def main():
):
):
coordinator
.
print_on_master
(
f
"Apply load balance"
)
coordinator
.
print_on_master
(
f
"Apply load balance"
)
apply_load_balance
(
model
,
optimizer
)
apply_load_balance
(
model
,
optimizer
)
# save c
k
eckpoint
# save c
h
eckpoint
if
(
step
+
1
)
%
args
.
save_interval
==
0
:
if
(
step
+
1
)
%
args
.
save_interval
==
0
:
coordinator
.
print_on_master
(
f
"Saving model checkpoint to
{
args
.
output_path
}
"
)
coordinator
.
print_on_master
(
f
"Saving model checkpoint to
{
args
.
output_path
}
"
)
booster
.
save_model
(
model
,
args
.
output_path
,
shard
=
True
)
booster
.
save_model
(
model
,
args
.
output_path
,
shard
=
True
)
...
...
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