Skip to content

Commit 3b0c8ff

Browse files
authored
[Typos] Fix (#10486)
1 parent af16c95 commit 3b0c8ff

File tree

86 files changed

+140
-140
lines changed

Some content is hidden

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

86 files changed

+140
-140
lines changed

paddlenlp/data/vocab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class Vocab(object):
2727
store/load functions.
2828
2929
Args:
30-
counter (collections.Counter, optional): A Counter intance describes
31-
the tokens and their frequencies. Its keys will be indexed accroding
30+
counter (collections.Counter, optional): A Counter instance describes
31+
the tokens and their frequencies. Its keys will be indexed according
3232
to the order of frequency sorting to construct mapping relationship.
3333
If None, `token_to_idx` must be provided as the mapping relationship.
3434
Default: None.

paddlenlp/datasets/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def remove_if_exit(filepath):
570570
datasets = DatasetTuple(splits)
571571
parallel_env = dist.ParallelEnv()
572572
unique_endpoints = _get_unique_endpoints(parallel_env.trainer_endpoints[:])
573-
# move register hook to first and register togather
573+
# move register hook to first and register together
574574
lock_files = []
575575
for split in splits:
576576
lock_file = os.path.join(DATA_HOME, self.__class__.__name__)

paddlenlp/experimental/autonlp/README_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
**The AutoNLP APIs are subjective to significant changes until formal release**
88

9-
**AutoNLP** is an experimental project by PaddleNLP to democratize NLP for everyone. Delivering a successful NLP project is not easy, as it requires deep domain knowledge. Time after time, we have seen people struggle to make NLP work on their dataset, for their projects, which is why we are building **AutoNLP**. Compared with the traditional AutoML approach of massive paid compute for State-of-the-Art model performance, we have a different philosphy:
9+
**AutoNLP** is an experimental project by PaddleNLP to democratize NLP for everyone. Delivering a successful NLP project is not easy, as it requires deep domain knowledge. Time after time, we have seen people struggle to make NLP work on their dataset, for their projects, which is why we are building **AutoNLP**. Compared with the traditional AutoML approach of massive paid compute for State-of-the-Art model performance, we have a different philosophy:
1010

1111

1212
1. Instead of training State-of-the-Art models on huge datasets running on huge clusters, our goal is to deliver **decent models under limited compute**. We assume our users have a few GPUs at most and want to get decent models under 8 hours on their own in-house datasets. Note that you can get this level of compute for FREE on [Baidu AI Studio](https://aistudio.baidu.com/aistudio).

paddlenlp/experimental/faster_tokenizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def to_vocab_buffer(vocab_dict, name):
4646
NOTICE: The value will be held in the cpu place.
4747
4848
Args:
49-
vocab_dict(dict): The value will be setted to the tensor.
49+
vocab_dict(dict): The value will be set to the tensor.
5050
The key is token and the value is the token index.
5151
name(string): The name of the tensor.
5252
"""

paddlenlp/experimental/transformers/qwen/modeling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def forward(
499499
hidden_states = outputs[0]
500500

501501
# if labels is None,means we need full output, instead of tensor_parallel_output
502-
# tensor_parallel_output is togather with ParallelCrossEntropy
502+
# tensor_parallel_output is together with ParallelCrossEntropy
503503
tensor_parallel_output = (
504504
self.config.tensor_parallel_output and labels is not None and self.config.tensor_parallel_degree > 1
505505
)

paddlenlp/experimental/transformers/qwen2/modeling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ def forward(
12261226
hidden_states = outputs[0]
12271227

12281228
# if labels is None,means we need full output, instead of tensor_parallel_output
1229-
# tensor_parallel_output is togather with ParallelCrossEntropy
1229+
# tensor_parallel_output is together with ParallelCrossEntropy
12301230
tensor_parallel_output = (
12311231
self.config.tensor_parallel_output and labels is not None and self.config.tensor_parallel_degree > 1
12321232
)

paddlenlp/generation/logits_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def __init__(self, sequence_bias: Dict[Tuple[int], float]):
439439
self._validate_arguments()
440440

441441
# Bias variables that will be populated on the first call (for retrocompatibility purposes, the vocabulary size
442-
# is infered in the first usage, which inhibits initializing here)
442+
# is inferred in the first usage, which inhibits initializing here)
443443
self.length_1_bias = None
444444
self.prepared_bias_variables = False
445445

paddlenlp/layers/crf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def __init__(self, crf):
248248
self.crf = crf
249249
if isinstance(crf, paddle.Tensor):
250250
raise ValueError(
251-
"From paddlenlp >= 2.0.0b4, the first param of LinearChainCrfLoss shoule be a LinearChainCrf object. For input parameter 'crf.transitions', you can remove '.transitions' to 'crf'"
251+
"From paddlenlp >= 2.0.0b4, the first param of LinearChainCrfLoss should be a LinearChainCrf object. For input parameter 'crf.transitions', you can remove '.transitions' to 'crf'"
252252
)
253253

254254
def forward(self, inputs, lengths, labels, old_version_labels=None):

paddlenlp/ops/distributed/parallel.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ def __init__(self, size, num_partitions=1, gather_out=True, param_attr=None, bia
191191
main_block = paddle.static.default_main_program().global_block()
192192
startup_block.vars[weight.name].is_distributed = True
193193
main_block.vars[weight.name].is_distributed = True
194-
# set is_distributed for splited bias
195-
# if a linear layer is splited by col, the bias would also be split into each rank as its weight
194+
# set is_distributed for split bias
195+
# if a linear layer is split by col, the bias would also be split into each rank as its weight
196196
if self.linear._bias_attr:
197197
startup_block.vars[self.linear.bias.name].is_distributed = True
198198
main_block.vars[self.linear.bias.name].is_distributed = True
@@ -285,8 +285,8 @@ def __init__(self, size, num_partitions=1, input_is_parallel=False, param_attr=N
285285
main_block = paddle.static.default_main_program().global_block()
286286
startup_block.vars[weight.name].is_distributed = True
287287
main_block.vars[weight.name].is_distributed = True
288-
# set is_distributed for splited bias
289-
# if a linear layer is splited by row, each rank would hold a complete bias
288+
# set is_distributed for split bias
289+
# if a linear layer is split by row, each rank would hold a complete bias
290290

291291
if bias_attr is not False:
292292
self.bias = self.create_parameter(shape=[num_cols], attr=bias_attr, dtype=self._dtype, is_bias=True)

paddlenlp/quantization/checkpoint_quantization_utils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def group_wise_quant_dequant(
6363
tp_degree (`int`):
6464
Tensor parallel world size.
6565
use_pd (`bool`):
66-
Whether to use paddle caculation. If False will use numpy.
66+
Whether to use paddle calculation. If False will use numpy.
6767
symmetry (`bool`):
6868
Whether to use symmetry quantization.
6969
"""
@@ -201,7 +201,7 @@ def cal_abs_min_max_channel(inputs, quant_axis=1):
201201
inputs (`numpy.array`):
202202
input tensor for quantization.
203203
quant_axis (`int`):
204-
dimension where calulating inputs' abs min and max scales on.
204+
dimension where calculating inputs' abs min and max scales on.
205205
"""
206206
eps = 1e-8
207207
reduce_axis = tuple([i for i in range(len(inputs.shape)) if i != quant_axis])
@@ -227,7 +227,7 @@ def asymmetry_qdq_weight(
227227
quant_bits (`int`):
228228
Quantization bits.
229229
quant_axis (`int`):
230-
Scales caculation axis.
230+
Scales calculation axis.
231231
mins (`paddle.Tensor`):
232232
Min scales tensor in asymmetry quantization.
233233
maxs (`paddle.Tensor`):
@@ -239,7 +239,7 @@ def asymmetry_qdq_weight(
239239
tp_degree (`int`):
240240
Model parallel world size.
241241
use_pd (`bool`):
242-
Whether to use paddle caculation. If False will use numpy.
242+
Whether to use paddle calculation. If False will use numpy.
243243
"""
244244

245245
if mins is None:
@@ -288,7 +288,7 @@ def cal_abs_max_channel(inputs, quant_axis=1):
288288
inputs (`numpy.array`):
289289
input tensor for quantization.
290290
quant_axis (`int`):
291-
dimension where calulating inputs' abs max scales on.
291+
dimension where calculating inputs' abs max scales on.
292292
"""
293293
epsilon = 1e-8
294294
reduce_axis = tuple([i for i in range(len(inputs.shape)) if i != quant_axis])
@@ -311,7 +311,7 @@ def qdq_weight(x, quant_bit=8, quant_axis=-1, scales=None, dequant=False, tp_ran
311311
quant_bits (`int`):
312312
Quantization bits.
313313
quant_axis (`int`):
314-
Scales caculation axis.
314+
Scales calculation axis.
315315
scales (`paddle.Tensor`):
316316
Abs max scales tensor in symmetry quantization.
317317
dequant (`bool`):
@@ -321,7 +321,7 @@ def qdq_weight(x, quant_bit=8, quant_axis=-1, scales=None, dequant=False, tp_ran
321321
tp_degree (`int`):
322322
Model parallel world size.
323323
use_pd (`bool`):
324-
Whether to use paddle caculation. If False will use numpy.
324+
Whether to use paddle calculation. If False will use numpy.
325325
"""
326326

327327
if scales is None:

paddlenlp/quantization/quantization_linear.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def __init__(
251251
self.quant_dtype, self.quant_weight_bit = QuantMapping[self.weight_quantize_algo]
252252
self.state = 0
253253

254-
# PaddlePaddle dosen't support 4bit data type, one 8bit data represents two 4bit data.
254+
# PaddlePaddle doesn't support 4bit data type, one 8bit data represents two 4bit data.
255255
# paddle.nn.quant.weight_quantize will transpose in_features and out_features.
256256
if self.weight_quantize_algo in [
257257
"weight_only_int8",
@@ -407,7 +407,7 @@ def __init__(
407407
if self.sequence_parallel and self.gather_output:
408408
raise ValueError("Sequence parallel does not support gather_output")
409409

410-
# PaddlePaddle dosen't support Int4 data type, one Int8 data represents two Int4 data.
410+
# PaddlePaddle doesn't support Int4 data type, one Int8 data represents two Int4 data.
411411
if self.weight_quantize_algo in [
412412
"weight_only_int8",
413413
"weight_only_int4",
@@ -545,7 +545,7 @@ def __init__(
545545
if not self.input_is_parallel and self.sequence_parallel:
546546
raise ValueError("Sequence parallel only support input_is_parallel.")
547547

548-
# PaddlePaddle dosen't support Int4 data type, one Int8 data represents two Int4 data.
548+
# PaddlePaddle doesn't support Int4 data type, one Int8 data represents two Int4 data.
549549
# paddle.nn.quant.weight_quantize will transpose in_features and out_features.
550550
if self.weight_quantize_algo in [
551551
"weight_only_int8",

paddlenlp/rl/models/ppo_model_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,11 @@ def forward(
476476
vocab_size=self.config.vocab_size,
477477
tensor_parallel_degree=self.config.tensor_parallel_degree,
478478
tensor_parallel_output=self.config.tensor_parallel_output,
479-
pg_loss_coeff=self.pg_loss_coeff, # donot use this
479+
pg_loss_coeff=self.pg_loss_coeff, # do not use this
480480
clip_range_ratio=self.clip_range_ratio,
481481
clip_range_ratio_low=self.clip_range_ratio_low,
482482
clip_range_ratio_high=self.clip_range_ratio_high,
483-
entropy_coeff=self.entropy_coeff, # donot support this
483+
entropy_coeff=self.entropy_coeff, # do not support this
484484
clip_range_score=self.clip_range_score,
485485
kl_loss_coeff=self.kl_loss_coeff,
486486
loop_chunk_size=1024,

paddlenlp/rl/trainer/rl_trainer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ def get_train_step_vars(self, vars: Optional[Dict] = None) -> Dict:
661661
if paddle.distributed.get_world_size() > 1:
662662
assert self.model is not self.model_wrapped
663663
self.train_step_vars = {
664-
# meaningless vars can pass from outter, dummy value is enough
664+
# meaningless vars can pass from outer, dummy value is enough
665665
"epoch": 0, # meaningless for step training
666666
"step": 0, # meaningless for step training
667667
"steps_in_epoch": 100000, # meaningless for step training
@@ -705,15 +705,15 @@ def full_training_step(self, **inputs) -> paddle.Tensor:
705705
# trainer.train use `tr_loss` as loss var to accumulate loss.
706706
# NOTE: `tr_loss` in trainer.train not only accumulate mean loss for
707707
# steps in one `gradient_accumulation_steps`, but also accumulate for
708-
# one logging intervel which may contains more than one accumulated steps.
708+
# one logging interval which may contains more than one accumulated steps.
709709
# However, in RLTrainer we only want to use `tr_loss` to accumulate
710710
# mean loss for steps in a `gradient_accumulation_steps` range. As for
711-
# logging intervel loss accumulation is not take into account here and
712-
# should be considered in outter.
711+
# logging interval loss accumulation is not take into account here and
712+
# should be considered in outer.
713713
if loss_var is None: # the first step of current loss type
714714
loss_var = paddle.to_tensor(0.0)
715715
train_step_vars[loss_name] = loss_var
716-
elif self.is_accumulation_step: # begin a new accumulation step intervel
716+
elif self.is_accumulation_step: # begin a new accumulation step interval
717717
for name in self.loss_names:
718718
train_step_vars[name] = paddle.to_tensor(0.0)
719719
loss_var = train_step_vars[loss_name]

paddlenlp/taskflow/knowledge_mining.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
class WordTagTask(Task):
147147
"""
148148
This the NER(Named Entity Recognition) task that convert the raw text to entities. And the task with the `wordtag`
149-
model will link the more meesage with the entity.
149+
model will link the more message with the entity.
150150
Args:
151151
task(string): The name of task.
152152
model(string): The model name in the task.

paddlenlp/taskflow/lexical_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def load_vocab(dict_path):
6868

6969
class LacTask(Task):
7070
"""
71-
Lexical analysis of Chinese task to segement the chinese sentence.
71+
Lexical analysis of Chinese task to segment the chinese sentence.
7272
Args:
7373
task(string): The name of task.
7474
model(string): The model name in the task.

paddlenlp/taskflow/named_entity_recognition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
class NERWordTagTask(WordTagTask):
7575
"""
7676
This the NER(Named Entity Recognition) task that convert the raw text to entities. And the task with the `wordtag`
77-
model will link the more meesage with the entity.
77+
model will link the more message with the entity.
7878
Args:
7979
task(string): The name of task.
8080
model(string): The model name in the task.

paddlenlp/trainer/auto_trainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def parallel_model(cls, model, training_args: AutoTrainingArguments):
109109
model (paddle.nn.Layer): the model to be parallelized.
110110
training_args (AutoTrainingArguments) : Training arguments which contain distributed information
111111
Returns:
112-
the model after parallelize and config conatins distributed strategy
112+
the model after parallelize and config contains distributed strategy
113113
"""
114114
if not training_args.use_intermediate_api:
115115
return model, None

paddlenlp/trainer/plugins/npu_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _flatten_param_grads(optimizer, params_grads):
6868
g.persistable = True
6969
if getattr(p, "need_clip", True) is False or getattr(p, "regularizer", None) is not None:
7070
logger.warning(
71-
f"flatten_param_grads=True will be discarded since paramter {p.name}'s need_clip is False or "
71+
f"flatten_param_grads=True will be discarded since parameter {p.name}'s need_clip is False or "
7272
"the regularizer is set."
7373
)
7474
return params_grads

paddlenlp/trainer/plugins/timer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828
class _Timer:
29-
"""Profile Timer for recording time taken by forward/ bacward/ reduce/ step."""
29+
"""Profile Timer for recording time taken by forward/ backward/ reduce/ step."""
3030

3131
def __init__(self, name):
3232
self.name = name

paddlenlp/trainer/trainer_compress.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,10 +700,10 @@ def _quant_aware_training_dynamic(self, input_dir):
700700
args.output_filename_prefix = "int8"
701701

702702
quant_config = {
703-
# It defauts to None, which means that no preprocessing is performed
703+
# It defaults to None, which means that no preprocessing is performed
704704
# on the active value."
705705
"activation_preprocess_type": "PACT" if args.use_pact else None,
706-
# It defauts to None, which means that no preprocessing is performed
706+
# It defaults to None, which means that no preprocessing is performed
707707
# on weights.
708708
"weight_preprocess_type": "PACT" if args.use_pact else None,
709709
"weight_quantize_type": args.weight_quantize_type,

paddlenlp/trainer/trainer_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _get_distributed_seeds(seed: int = 1234, topo: Topology = None):
8484
"""
8585

8686
# NOTE: For parameter init seed:
87-
# seed: dp/mp_undistributed_paramter/sharding is same; others is different
87+
# seed: dp/mp_undistributed_parameter/sharding is same; others is different
8888
# For compute seed(dropout):
8989
# global seed: only mp group is same.
9090
# local seed: all groups are different

paddlenlp/trainer/utils/reshard/pp_reshard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def layers(self):
220220
class PipeLineStage:
221221
def __init__(self):
222222
self._rename_mgr = LayerReNamingManager()
223-
# map segement start index to segment
223+
# map segment start index to segment
224224
self._segments = OrderedDict()
225225
self._layer_to_segment = OrderedDict()
226226
self._param_to_tname = OrderedDict()

paddlenlp/trainer/utils/sharding_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def filter_sharded_params(state_dict, optimizer, sharding_group):
9797
return filtered_state_dict
9898

9999

100-
def exclude_paramters_in_state_dict(
100+
def exclude_parameters_in_state_dict(
101101
model_state_dict, param_names_in_master_weights, sharding_group, should_save_sharding_stage1_model=True
102102
):
103103
assert sharding_group is not None
@@ -399,7 +399,7 @@ def manipulate_state_dict_and_config(self, model_to_save, merge_tensor_parallel=
399399
optimzier_state_dict = self.optimizer.state_dict()
400400
assert "master_weights" in optimzier_state_dict
401401
param_names_in_master_weights = list(optimzier_state_dict["master_weights"].keys())
402-
state_dict = exclude_paramters_in_state_dict(
402+
state_dict = exclude_parameters_in_state_dict(
403403
state_dict, param_names_in_master_weights, self.sharding_group
404404
)
405405
logger.info(

paddlenlp/trainer/utils/zero_cost_checkpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def update_zcc_workers(self, new_version, dynamic_objecs, static_object, global_
539539
self.global_step = global_step
540540
assert self.current_worker is None, "[ZCC manager] current_worker must be None"
541541
task = (ZCCTaskType.UPDATE, [self.cache_version, dynamic_objecs, static_object])
542-
logger.info(f"[ZCC manager] updating zcc workers, verison: {self.cache_version}")
542+
logger.info(f"[ZCC manager] updating zcc workers, version: {self.cache_version}")
543543
for worker in self.workers:
544544
worker.task_queue.put(task)
545545
logger.info("[ZCC manager] waiting workers update done")

paddlenlp/transformers/auto/modeling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
859859
model_class = getattr(import_class, model_class_name)
860860

861861
# It may return a new model class, like LlamaForCausalLMAvxInferenceModel
862-
# Some model have different inference model class in deifferent execution divice
862+
# Some model have different inference model class in different execution device
863863
# LlamaForCausalLMAvxInferenceModel is used in cpu execution device with avx instruction set
864864
model_class = model_class.confirm_inference_model(predictor_args=predictor_args)
865865

@@ -933,7 +933,7 @@ def from_config(cls, config, *model_args, **kwargs):
933933
model_class = getattr(import_class, model_class_name)
934934

935935
# It may return a new model class, like LlamaForCausalLMAvxInferenceModel
936-
# Some model have different inference model class in deifferent execution divice
936+
# Some model have different inference model class in different execution device
937937
# LlamaForCausalLMAvxInferenceModel is used in cpu execution device with avx instruction set
938938
model_class = model_class.confirm_inference_model(predictor_args=predictor_args)
939939

0 commit comments

Comments
 (0)