Skip to content

Commit e4fc57c

Browse files
Optimized some syntax errors in the documentation and code under applications/ (#4127)
Co-authored-by: flybird11111 <1829166702@qq.com>
1 parent 50e5602 commit e4fc57c

File tree

8 files changed

+12
-14
lines changed

8 files changed

+12
-14
lines changed

applications/Chat/README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ We provide an online inference server and a benchmark. We aim to run inference o
200200
We support 8-bit quantization (RTN), 4-bit quantization (GPTQ), and FP16 inference.
201201

202202
Online inference server scripts can help you deploy your own services.
203-
204203
For more details, see [`inference/`](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat/inference).
205204

206205
## Coati7B examples
@@ -428,7 +427,7 @@ Thanks so much to all of our amazing contributors!
428427
</a>
429428
</div>
430429

431-
- An open-source low cost solution for cloning [ChatGPT](https://openai.com/blog/chatgpt/) with a complete RLHF pipeline. [[demo]](https://chat.colossalai.org)
430+
- An open-source low-cost solution for cloning [ChatGPT](https://openai.com/blog/chatgpt/) with a complete RLHF pipeline. [[demo]](https://chat.colossalai.org)
432431

433432
<p id="ChatGPT_scaling" align="center">
434433
<img src="https://raw.githubusercontent.com/hpcaitech/public_assets/main/applications/chatgpt/ChatGPT%20scaling.png" width=800/>
@@ -469,8 +468,7 @@ Coati is developed by ColossalAI Team:
469468
- [ofey404](https://github.com/ofey404)
470469
- [Wenhao Chen](https://github.com/CWHer)
471470

472-
The Phd student from [(HPC-AI) Lab](https://ai.comp.nus.edu.sg/) also contributed a lot to this project.
473-
471+
The PhD student from [(HPC-AI) Lab](https://ai.comp.nus.edu.sg/) also contributed a lot to this project.
474472
- [Zangwei Zheng](https://github.com/zhengzangw)
475473
- [Xue Fuzhao](https://github.com/XueFuzhao)
476474

applications/Chat/coati/experience_maker/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@dataclass
1111
class Experience:
1212
"""Experience is a batch of data.
13-
These data should have the the sequence length and number of actions.
13+
These data should have the sequence length and number of actions.
1414
Left padding for sequences is applied.
1515
1616
Shapes of each tensor:

applications/Chat/coati/models/lora.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(
4848

4949
def reset_parameters(self):
5050
if hasattr(self, 'lora_A'):
51-
# initialize A the same way as the default for nn.Linear and B to zero
51+
# Initialize A with the default values for nn.Linear and set B to zero.
5252
nn.init.kaiming_uniform_(self.lora_A, a=math.sqrt(5))
5353
nn.init.zeros_(self.lora_B)
5454

applications/Chat/coati/ray/detached_replay_buffer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class DetachedReplayBuffer:
1717
'''
1818
Detached replay buffer. Share Experience across workers on the same node.
19-
Therefore a trainer node is expected to have only one instance.
19+
Therefore, a trainer node is expected to have only one instance.
2020
It is ExperienceMakerHolder's duty to call append(exp) method, remotely.
2121
2222
Args:

applications/Chat/coati/ray/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def get_model_numel(model: nn.Module) -> int:
116116
def get_receivers_per_sender(sender_idx: int, num_senders: int, num_receivers: int, allow_idle_sender: bool) -> list:
117117
target_receivers = []
118118
if num_senders <= num_receivers or allow_idle_sender:
119-
# a sender will send data to one or more than one receivers
119+
# a sender will send data to one or more receivers
120120
# a receiver only has one sender
121121
for i in range(num_receivers):
122122
if i % num_senders == sender_idx:

applications/Chat/evaluate/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ For example, if you want to add a new metric `persuasiveness` into category `bra
348348

349349
<details><summary><b>How can I add a new UniEval evaluation metric?</b></summary>
350350

351-
For example, if you want to add a new metric `persuasiveness` into task `data2text`, you should add a Boolean QA question about the metric in function `add_question` in `unieval/utils.py`. Please do note that how effectively the model would evaluate this metric is unknown and you may need some experiments to test whether the model is capable of evaluating this metric.
351+
For example, if you want to add a new metric `persuasiveness` into task `data2text`, you should add a Boolean QA question about the metric in function `add_question` in `unieval/utils.py`. Please do note that how effectively the model would evaluate this metric is unknown, and you may need some experiments to test whether the model is capable of evaluating this metric.
352352

353353
```python
354354
if task == 'data2text':

applications/Chat/evaluate/gpt_evaluate.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ def calculate_scores_form_logprobs(logprobs: Dict[str, Any]) -> float:
576576

577577
for key, value in logprobs.items():
578578
# Sometimes the key will be one byte of a unicode character which takes the form of "bytes:\\xe7".
579-
# It is meaningless and thus we don't calculate probability.
579+
# It is meaningless, and thus we don't calculate probability.
580580
if "bytes" in key:
581581
continue
582582
# results[0] is the score which corresponds to the key(predicted token).
@@ -621,7 +621,7 @@ def save_gpt_evaluation_results(model_name: str, gpt_evaluation_results: Dict[st
621621
622622
Args:
623623
model_name: name of the model for saving evaluation results.
624-
gpt_evaluation_results: evaluations results for all of the model answers.
624+
gpt_evaluation_results: evaluations results for all the model answers.
625625
save_path: path to save GPT evaluation statistics.
626626
"""
627627

@@ -641,7 +641,7 @@ def save_gpt_evaluation_statistics(model_name: str, evaluations: List[Dict], sav
641641
642642
Args:
643643
model_name: name of the model for saving statistics.
644-
evaluations: evaluations for all of the model answers.
644+
evaluations: evaluations for all the model answers.
645645
save_path: path to save GPT evaluation statistics.
646646
"""
647647

@@ -663,7 +663,7 @@ def save_gpt_evaluation_statistics(model_name: str, evaluations: List[Dict], sav
663663
for evaluation in data:
664664
for metric in metrics:
665665
if evaluation["evaluation"][metric] == {}:
666-
# This means after 3 retries, the server still returns an error and we set the score to 0.
666+
# This means after 3 retries, the server still returns an error, and we set the score to 0.
667667
scores[metric].append(0)
668668
elif evaluation["evaluation"][metric]["logprobs"] is not None:
669669
scores[metric].append(

applications/Chat/examples/community/peft/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pip install .
2020

2121
For SFT training, just call train_peft_sft.py
2222

23-
Its arguments are almost identical to train_sft.py instead adding a new eval_dataset if you have a eval_dataset file. The data file is just a plain datafile, please check the format in the easy_dataset.py.
23+
Its arguments are almost identical to train_sft.py instead adding a new eval_dataset if you have an eval_dataset file. The data file is just a plain datafile, please check the format in the easy_dataset.py.
2424

2525
For stage-3 rlhf training, call train_peft_prompts.py.
2626
Its arguments are almost identical to train_prompts.py. The only difference is that I use text files to indicate the prompt and pretrained data file. The models are included in easy_models.py. Currently only bloom models are tested, but technically gpt2/opt/llama should be supported.

0 commit comments

Comments
 (0)