Skip to content

Commit c2c41a3

Browse files
committed
Fix
1 parent e8a19d3 commit c2c41a3

File tree

89 files changed

+178
-178
lines changed

Some content is hidden

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

89 files changed

+178
-178
lines changed

paddlenlp/data/vocab.py

+2-2
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ def forward(
12101210
hidden_states = outputs[0]
12111211

12121212
# if labels is None,means we need full output, instead of tensor_parallel_output
1213-
# tensor_parallel_output is togather with ParallelCrossEntropy
1213+
# tensor_parallel_output is together with ParallelCrossEntropy
12141214
tensor_parallel_output = (
12151215
self.config.tensor_parallel_output and labels is not None and self.config.tensor_parallel_degree > 1
12161216
)

paddlenlp/generation/logits_process.py

+1-1
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

+1-1
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

+4-4
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

+7-7
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def __init__(
250250
self.quant_dtype, self.quant_weight_bit = QuantMapping[self.weight_quantize_algo]
251251
self.state = 0
252252

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

408-
# PaddlePaddle dosen't support Int4 data type, one Int8 data represents two Int4 data.
408+
# PaddlePaddle doesn't support Int4 data type, one Int8 data represents two Int4 data.
409409
if self.weight_quantize_algo in [
410410
"weight_only_int8",
411411
"weight_only_int4",
@@ -542,7 +542,7 @@ def __init__(
542542
if not self.input_is_parallel and self.sequence_parallel:
543543
raise ValueError("Sequence parallel only support input_is_parallel.")
544544

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

paddlenlp/rl/models/ppo_model_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,11 @@ def forward(
455455
vocab_size=self.config.vocab_size,
456456
tensor_parallel_degree=self.config.tensor_parallel_degree,
457457
tensor_parallel_output=self.config.tensor_parallel_output,
458-
pg_loss_coeff=self.pg_loss_coeff, # donot use this
458+
pg_loss_coeff=self.pg_loss_coeff, # do not use this
459459
clip_range_ratio=self.clip_range_ratio,
460460
clip_range_ratio_low=self.clip_range_ratio_low,
461461
clip_range_ratio_high=self.clip_range_ratio_high,
462-
entropy_coeff=self.entropy_coeff, # donot support this
462+
entropy_coeff=self.entropy_coeff, # do not support this
463463
clip_range_score=self.clip_range_score,
464464
kl_loss_coeff=self.kl_loss_coeff,
465465
loop_chunk_size=1024,

paddlenlp/rl/trainer/rl_trainer.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ def get_train_step_vars(self, vars: Optional[Dict] = None) -> Dict:
674674
if paddle.distributed.get_world_size() > 1:
675675
assert self.model is not self.model_wrapped
676676
self.train_step_vars = {
677-
# meaningless vars can pass from outter, dummy value is enough
677+
# meaningless vars can pass from outer, dummy value is enough
678678
"epoch": 0, # meaningless for step training
679679
"step": 0, # meaningless for step training
680680
"steps_in_epoch": 100000, # meaningless for step training
@@ -718,15 +718,15 @@ def full_training_step(self, **inputs) -> paddle.Tensor:
718718
# trainer.train use `tr_loss` as loss var to accumulate loss.
719719
# NOTE: `tr_loss` in trainer.train not only accumulate mean loss for
720720
# steps in one `gradient_accumulation_steps`, but also accumulate for
721-
# one logging intervel which may contains more than one accumulated steps.
721+
# one logging interval which may contains more than one accumulated steps.
722722
# However, in RLTrainer we only want to use `tr_loss` to accumulate
723723
# mean loss for steps in a `gradient_accumulation_steps` range. As for
724-
# logging intervel loss accumulation is not take into account here and
725-
# should be considered in outter.
724+
# logging interval loss accumulation is not take into account here and
725+
# should be considered in outer.
726726
if loss_var is None: # the first step of current loss type
727727
loss_var = paddle.to_tensor(0.0)
728728
train_step_vars[loss_name] = loss_var
729-
elif self.is_accumulation_step: # begin a new accumulation step intervel
729+
elif self.is_accumulation_step: # begin a new accumulation step interval
730730
for name in self.loss_names:
731731
train_step_vars[name] = paddle.to_tensor(0.0)
732732
loss_var = train_step_vars[loss_name]

paddlenlp/taskflow/knowledge_mining.py

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

0 commit comments

Comments
 (0)