Skip to content

Commit 615a7c9

Browse files
authored
fix typos (#11041)
1 parent 03bc1a0 commit 615a7c9

File tree

33 files changed

+54
-54
lines changed

33 files changed

+54
-54
lines changed

llm/tools/preprocess/create_pretraining_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def get_whole_word_mask_tokens(tokens, words, max_word_length=6):
176176
i += 1
177177
continue
178178

179-
# add "##" mark on the middel tokens of Chinese words
179+
# add "##" mark on the middle tokens of Chinese words
180180
# such as ["通过", "利用"] -> ["通", "##过", "利", "##用"]
181181
has_add = False
182182
for length in range(max_word_length, 0, -1):

llm/utils/fused_layers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ def sp_async_reducesctter(x_grad):
106106
def sync_mp_allreduce(task, dist_tensor):
107107
mp_placement_index = dist_tensor.process_mesh.dim_names.index("mp")
108108
new_placments = list()
109-
for idx, placment in enumerate(dist_tensor.placements):
109+
for idx, placement in enumerate(dist_tensor.placements):
110110
if idx == mp_placement_index:
111111
new_placments.append(dist.Replicate())
112112
else:
113-
new_placments.append(placment)
113+
new_placments.append(placement)
114114
place = paddle.framework._current_expected_place()
115115
place = paddle.framework._get_paddle_place(place)
116116

llm/utils/sp_async_reduce_scatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def forward_pre_hook(layer, input):
172172
ipp = id2ipp[id(layer)]
173173

174174

175-
def forward_post_hook(layer, input, ouput):
175+
def forward_post_hook(layer, input, output):
176176
paddle.nn.functional.linear = paddle_nn_functional_linear
177177
if is_fused_matmul_bias_supported():
178178
paddle.incubate.nn.functional.fused_linear = paddle_incubate_nn_functional_fused_linear

paddlenlp/transformers/clipseg/modeling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def forward(
340340
attn_weights = nn.functional.softmax(attn_weights, axis=-1)
341341

342342
if output_attentions:
343-
# this operation is a bit akward, but it's required to
343+
# this operation is a bit awkward, but it's required to
344344
# make sure that attn_weights keeps its gradient.
345345
# In order to do so, attn_weights have to reshaped
346346
# twice and have to be reused in the following

paddlenlp/transformers/llama/modeling_auto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ def forward(
11461146
inputs_embeds = paddle.transpose(inputs_embeds, [1, 0, 2])
11471147

11481148
if self.config.context_parallel_degree > 1 and (attention_mask is not None or self.config.alibi):
1149-
raise NotImplementedError("Ring FlashAttention dosen't support attention_mask or alibi")
1149+
raise NotImplementedError("Ring FlashAttention doesn't support attention_mask or alibi")
11501150

11511151
global_mesh = global_mesh_starts_with_pp()
11521152
if position_ids is None and self.config.sep_parallel_degree > 1:

paddlenlp/transformers/model_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,7 @@ def _fuse_or_split_keys(
22672267
post_quantize=post_quantize,
22682268
)
22692269
if post_quantize:
2270-
# Split -> quantize(Not support mdoel save)
2270+
# Split -> quantize(Not support model save)
22712271
state_dict = load_state_dict(
22722272
shard_file,
22732273
tp_actions if pre_tensor_parallel_split else None,
@@ -2280,7 +2280,7 @@ def _fuse_or_split_keys(
22802280
dtype,
22812281
)
22822282
else:
2283-
# quantize -> split(Support mdoel save)
2283+
# quantize -> split(Support model save)
22842284
state_dict = load_state_dict(
22852285
shard_file,
22862286
tp_actions if pre_tensor_parallel_split else None,

paddlenlp/utils/downloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def _decompress(fname):
257257

258258
# For protecting decompressing interrupted,
259259
# decompress to fpath_tmp directory firstly, if decompress
260-
# successed, move decompress files to fpath and delete
260+
# succeeded, move decompress files to fpath and delete
261261
# fpath_tmp and remove download compress file.
262262

263263
if tarfile.is_tarfile(fname):

paddlenlp/utils/pdc_sdk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def pdc_backup_to_flash_device(self, persistent_path: str, flash_device_path: st
534534
# step 2: copy persistent data to flash device
535535
try:
536536
copy_tree(persistent_path, flash_device_path)
537-
logger.info(f"backup {persistent_path} to {flash_device_path} successed.")
537+
logger.info(f"backup {persistent_path} to {flash_device_path} succeeded.")
538538
except Exception as e:
539539
logger.error(f"[Error] [pdc_sdk] copy tree {persistent_path} to {flash_device_path} failed, error: {e}")
540540
self._pdc_backup_failed_directory(flash_device_path)

slm/applications/question_answering/unsupervised_qa/tools/dev_qq_pair_creation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def extract_q_from_json_file(json_file, out_file=None, test_sample_num=None, que
3636
if out_file:
3737
wf = open(os.path.join(out_file), "w", encoding="utf-8")
3838
if query_answer_path:
39-
qeury_answer_wf = open(query_answer_path, "w", encoding="utf-8")
39+
query_answer_wf = open(query_answer_path, "w", encoding="utf-8")
4040
q_list = []
4141
for i, json_line in enumerate(rf.readlines()):
4242
line_dict = json.loads(json_line)
@@ -47,7 +47,7 @@ def extract_q_from_json_file(json_file, out_file=None, test_sample_num=None, que
4747
answer = line_dict["answer"]
4848
if not test_sample_num or i < test_sample_num:
4949
if query_answer_path:
50-
qeury_answer_wf.write(
50+
query_answer_wf.write(
5151
question.replace("\n", " ").replace("\t", " ").strip()
5252
+ "\t"
5353
+ answer.replace("\n", " ").replace("\t", " ").strip()
@@ -59,9 +59,9 @@ def extract_q_from_json_file(json_file, out_file=None, test_sample_num=None, que
5959
else:
6060
break
6161
if query_answer_path:
62-
qeury_answer_wf.close()
62+
query_answer_wf.close()
6363
if out_file:
64-
wf.colse()
64+
wf.close()
6565
return q_list
6666

6767

slm/applications/text_classification/hierarchical/analysis/word_interpret.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
"name": "stdout",
198198
"output_type": "stream",
199199
"text": [
200-
"Start token level interpretion, it will take some time...\n",
200+
"Start token level interpretation, it will take some time...\n",
201201
"Building prefix dict from the default dictionary ...\n",
202202
"Loading model from cache /tmp/jieba.cache\n",
203203
"Loading model cost 0.746 seconds.\n",
@@ -219,7 +219,7 @@
219219
" interpreter = GradShapInterpreter(model)\n",
220220
"\n",
221221
"# Use interpreter to get the importance scores for all data\n",
222-
"print(\"Start token level interpretion, it will take some time...\")\n",
222+
"print(\"Start token level interpretation, it will take some time...\")\n",
223223
"analysis_result = []\n",
224224
"for batch in interpret_data_loader:\n",
225225
" analysis_result += interpreter(tuple(batch))\n",

0 commit comments

Comments
 (0)