mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-30 17:52:35 +06:00
Fix typos in strings and comments (#37910)
This commit is contained in:
parent
c80f65265b
commit
5b573bebb9
@ -539,7 +539,7 @@ def convert_examples_to_features(
|
|||||||
if "num_truncated_tokens" in inputs and inputs["num_truncated_tokens"] > 0:
|
if "num_truncated_tokens" in inputs and inputs["num_truncated_tokens"] > 0:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Attention! you are cropping tokens (swag task is ok). "
|
"Attention! you are cropping tokens (swag task is ok). "
|
||||||
"If you are training ARC and RACE and you are poping question + options, "
|
"If you are training ARC and RACE and you are popping question + options, "
|
||||||
"you need to try to use a bigger max seq length!"
|
"you need to try to use a bigger max seq length!"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ def main():
|
|||||||
args.tokenizer_name if args.tokenizer_name else args.model_name_or_path,
|
args.tokenizer_name if args.tokenizer_name else args.model_name_or_path,
|
||||||
do_lower_case=args.do_lower_case,
|
do_lower_case=args.do_lower_case,
|
||||||
cache_dir=args.cache_dir if args.cache_dir else None,
|
cache_dir=args.cache_dir if args.cache_dir else None,
|
||||||
use_fast=False, # SquadDataset is not compatible with Fast tokenizers which have a smarter overflow handeling
|
use_fast=False, # SquadDataset is not compatible with Fast tokenizers which have a smarter overflow handling
|
||||||
)
|
)
|
||||||
model = AutoModelForQuestionAnswering.from_pretrained(
|
model = AutoModelForQuestionAnswering.from_pretrained(
|
||||||
args.model_name_or_path,
|
args.model_name_or_path,
|
||||||
@ -795,7 +795,7 @@ def main():
|
|||||||
# Load a trained model and vocabulary that you have fine-tuned
|
# Load a trained model and vocabulary that you have fine-tuned
|
||||||
model = AutoModelForQuestionAnswering.from_pretrained(args.output_dir) # , force_download=True)
|
model = AutoModelForQuestionAnswering.from_pretrained(args.output_dir) # , force_download=True)
|
||||||
|
|
||||||
# SquadDataset is not compatible with Fast tokenizers which have a smarter overflow handeling
|
# SquadDataset is not compatible with Fast tokenizers which have a smarter overflow handling
|
||||||
# So we use use_fast=False here for now until Fast-tokenizer-compatible-examples are out
|
# So we use use_fast=False here for now until Fast-tokenizer-compatible-examples are out
|
||||||
tokenizer = AutoTokenizer.from_pretrained(args.output_dir, do_lower_case=args.do_lower_case, use_fast=False)
|
tokenizer = AutoTokenizer.from_pretrained(args.output_dir, do_lower_case=args.do_lower_case, use_fast=False)
|
||||||
model.to(args.device)
|
model.to(args.device)
|
||||||
|
@ -122,7 +122,7 @@ def main():
|
|||||||
tokenizer = AutoTokenizer.from_pretrained(
|
tokenizer = AutoTokenizer.from_pretrained(
|
||||||
model_args.tokenizer_name if model_args.tokenizer_name else model_args.model_name_or_path,
|
model_args.tokenizer_name if model_args.tokenizer_name else model_args.model_name_or_path,
|
||||||
cache_dir=model_args.cache_dir,
|
cache_dir=model_args.cache_dir,
|
||||||
use_fast=False, # SquadDataset is not compatible with Fast tokenizers which have a smarter overflow handeling
|
use_fast=False, # SquadDataset is not compatible with Fast tokenizers which have a smarter overflow handling
|
||||||
)
|
)
|
||||||
model = AutoModelForQuestionAnswering.from_pretrained(
|
model = AutoModelForQuestionAnswering.from_pretrained(
|
||||||
model_args.model_name_or_path,
|
model_args.model_name_or_path,
|
||||||
|
@ -71,7 +71,7 @@ def main():
|
|||||||
# You can also build the corpus yourself using TransfoXLCorpus methods
|
# You can also build the corpus yourself using TransfoXLCorpus methods
|
||||||
# The pre-processing involve computing word frequencies to prepare the Adaptive input and SoftMax
|
# The pre-processing involve computing word frequencies to prepare the Adaptive input and SoftMax
|
||||||
# and tokenizing the dataset
|
# and tokenizing the dataset
|
||||||
# The pre-processed corpus is a convertion (using the conversion script )
|
# The pre-processed corpus is a conversion (using the conversion script )
|
||||||
corpus = TransfoXLCorpus.from_pretrained(args.model_name)
|
corpus = TransfoXLCorpus.from_pretrained(args.model_name)
|
||||||
|
|
||||||
va_iter = corpus.get_iterator("valid", args.batch_size, args.tgt_len, device=device, ext_len=args.ext_len)
|
va_iter = corpus.get_iterator("valid", args.batch_size, args.tgt_len, device=device, ext_len=args.ext_len)
|
||||||
|
@ -40,7 +40,7 @@ def pack_examples(tok, src_examples, tgt_examples, max_tokens=1024):
|
|||||||
for src, tgt in tqdm(sorted_examples[1:]):
|
for src, tgt in tqdm(sorted_examples[1:]):
|
||||||
cand_src = new_src + " " + src
|
cand_src = new_src + " " + src
|
||||||
cand_tgt = new_tgt + " " + tgt
|
cand_tgt = new_tgt + " " + tgt
|
||||||
if is_too_big(cand_src) or is_too_big(cand_tgt): # cant fit, finalize example
|
if is_too_big(cand_src) or is_too_big(cand_tgt): # can't fit, finalize example
|
||||||
finished_src.append(new_src)
|
finished_src.append(new_src)
|
||||||
finished_tgt.append(new_tgt)
|
finished_tgt.append(new_tgt)
|
||||||
new_src, new_tgt = src, tgt
|
new_src, new_tgt = src, tgt
|
||||||
|
@ -804,7 +804,7 @@ def main():
|
|||||||
if "common_voice" in data_args.dataset_name:
|
if "common_voice" in data_args.dataset_name:
|
||||||
kwargs["language"] = config_name
|
kwargs["language"] = config_name
|
||||||
|
|
||||||
# make sure that adapter weights are saved seperately
|
# make sure that adapter weights are saved separately
|
||||||
adapter_file = WAV2VEC2_ADAPTER_SAFE_FILE.format(data_args.target_language)
|
adapter_file = WAV2VEC2_ADAPTER_SAFE_FILE.format(data_args.target_language)
|
||||||
adapter_file = os.path.join(training_args.output_dir, adapter_file)
|
adapter_file = os.path.join(training_args.output_dir, adapter_file)
|
||||||
logger.info(f"Saving adapter weights under {adapter_file}...")
|
logger.info(f"Saving adapter weights under {adapter_file}...")
|
||||||
|
@ -516,7 +516,7 @@ def convert_and_export_with_cache(
|
|||||||
"Dynamic shapes spec will be ignored by convert_and_export_with_cache for torch < 2.6.0."
|
"Dynamic shapes spec will be ignored by convert_and_export_with_cache for torch < 2.6.0."
|
||||||
)
|
)
|
||||||
if strict is not None:
|
if strict is not None:
|
||||||
logging.warning("The strict flag will be ingored by convert_and_export_with_cache for torch < 2.6.0.")
|
logging.warning("The strict flag will be ignored by convert_and_export_with_cache for torch < 2.6.0.")
|
||||||
# We have to keep this path for BC.
|
# We have to keep this path for BC.
|
||||||
#
|
#
|
||||||
# Due to issue https://github.com/pytorch/pytorch/issues/128394, we need to switch to use an internal
|
# Due to issue https://github.com/pytorch/pytorch/issues/128394, we need to switch to use an internal
|
||||||
|
@ -152,8 +152,8 @@ def bbox2distance(points, bbox, max_num_bins, reg_scale, up, eps=0.1):
|
|||||||
points (Tensor): (n, 4) [x, y, w, h], where (x, y) is the center.
|
points (Tensor): (n, 4) [x, y, w, h], where (x, y) is the center.
|
||||||
bbox (Tensor): (n, 4) bounding boxes in "xyxy" format.
|
bbox (Tensor): (n, 4) bounding boxes in "xyxy" format.
|
||||||
max_num_bins (float): Maximum bin value.
|
max_num_bins (float): Maximum bin value.
|
||||||
reg_scale (float): Controling curvarture of W(n).
|
reg_scale (float): Controlling curvarture of W(n).
|
||||||
up (Tensor): Controling upper bounds of W(n).
|
up (Tensor): Controlling upper bounds of W(n).
|
||||||
eps (float): Small value to ensure target < max_num_bins.
|
eps (float): Small value to ensure target < max_num_bins.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -28,7 +28,7 @@ logger = logging.get_logger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
# TODO: Attribute map assignment logic should be fixed in modular
|
# TODO: Attribute map assignment logic should be fixed in modular
|
||||||
# as well as super() call parsing becuase otherwise we cannot re-write args after initialization
|
# as well as super() call parsing because otherwise we cannot re-write args after initialization
|
||||||
class DFineConfig(PretrainedConfig):
|
class DFineConfig(PretrainedConfig):
|
||||||
"""
|
"""
|
||||||
This is the configuration class to store the configuration of a [`DFineModel`]. It is used to instantiate a D-FINE
|
This is the configuration class to store the configuration of a [`DFineModel`]. It is used to instantiate a D-FINE
|
||||||
|
@ -47,7 +47,7 @@ logger = logging.get_logger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
# TODO: Attribute map assignment logic should be fixed in modular
|
# TODO: Attribute map assignment logic should be fixed in modular
|
||||||
# as well as super() call parsing becuase otherwise we cannot re-write args after initialization
|
# as well as super() call parsing because otherwise we cannot re-write args after initialization
|
||||||
class DFineConfig(PretrainedConfig):
|
class DFineConfig(PretrainedConfig):
|
||||||
"""
|
"""
|
||||||
This is the configuration class to store the configuration of a [`DFineModel`]. It is used to instantiate a D-FINE
|
This is the configuration class to store the configuration of a [`DFineModel`]. It is used to instantiate a D-FINE
|
||||||
|
@ -1615,7 +1615,7 @@ class SamHQModel(SamHQPreTrainedModel):
|
|||||||
Input boxes for the points, this is used by the prompt encoder to encode the prompt. Generally yields to
|
Input boxes for the points, this is used by the prompt encoder to encode the prompt. Generally yields to
|
||||||
much better generated masks. The boxes can be obtained by passing a list of list of list to the processor,
|
much better generated masks. The boxes can be obtained by passing a list of list of list to the processor,
|
||||||
that will generate a `torch` tensor, with each dimension corresponding respectively to the image batch
|
that will generate a `torch` tensor, with each dimension corresponding respectively to the image batch
|
||||||
size, the number of boxes per image and the coordinates of the top left and botton right point of the box.
|
size, the number of boxes per image and the coordinates of the top left and bottom right point of the box.
|
||||||
In the order (`x1`, `y1`, `x2`, `y2`):
|
In the order (`x1`, `y1`, `x2`, `y2`):
|
||||||
|
|
||||||
- `x1`: the x coordinate of the top left point of the input box
|
- `x1`: the x coordinate of the top left point of the input box
|
||||||
|
@ -551,7 +551,7 @@ class SamHQModel(SamModel):
|
|||||||
Input boxes for the points, this is used by the prompt encoder to encode the prompt. Generally yields to
|
Input boxes for the points, this is used by the prompt encoder to encode the prompt. Generally yields to
|
||||||
much better generated masks. The boxes can be obtained by passing a list of list of list to the processor,
|
much better generated masks. The boxes can be obtained by passing a list of list of list to the processor,
|
||||||
that will generate a `torch` tensor, with each dimension corresponding respectively to the image batch
|
that will generate a `torch` tensor, with each dimension corresponding respectively to the image batch
|
||||||
size, the number of boxes per image and the coordinates of the top left and botton right point of the box.
|
size, the number of boxes per image and the coordinates of the top left and bottom right point of the box.
|
||||||
In the order (`x1`, `y1`, `x2`, `y2`):
|
In the order (`x1`, `y1`, `x2`, `y2`):
|
||||||
|
|
||||||
- `x1`: the x coordinate of the top left point of the input box
|
- `x1`: the x coordinate of the top left point of the input box
|
||||||
|
@ -586,10 +586,10 @@ class DFineModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
|||||||
self.model_tester.num_labels,
|
self.model_tester.num_labels,
|
||||||
)
|
)
|
||||||
self.assertEqual(outputs.logits.shape, expected_shape)
|
self.assertEqual(outputs.logits.shape, expected_shape)
|
||||||
# Confirm out_indices was propogated to backbone
|
# Confirm out_indices was propagated to backbone
|
||||||
self.assertEqual(len(model.model.backbone.intermediate_channel_sizes), 3)
|
self.assertEqual(len(model.model.backbone.intermediate_channel_sizes), 3)
|
||||||
else:
|
else:
|
||||||
# Confirm out_indices was propogated to backbone
|
# Confirm out_indices was propagated to backbone
|
||||||
self.assertEqual(len(model.backbone.intermediate_channel_sizes), 3)
|
self.assertEqual(len(model.backbone.intermediate_channel_sizes), 3)
|
||||||
|
|
||||||
self.assertTrue(outputs)
|
self.assertTrue(outputs)
|
||||||
@ -618,10 +618,10 @@ class DFineModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
|||||||
self.model_tester.num_labels,
|
self.model_tester.num_labels,
|
||||||
)
|
)
|
||||||
self.assertEqual(outputs.logits.shape, expected_shape)
|
self.assertEqual(outputs.logits.shape, expected_shape)
|
||||||
# Confirm out_indices was propogated to backbone
|
# Confirm out_indices was propagated to backbone
|
||||||
self.assertEqual(len(model.model.backbone.intermediate_channel_sizes), 3)
|
self.assertEqual(len(model.model.backbone.intermediate_channel_sizes), 3)
|
||||||
else:
|
else:
|
||||||
# Confirm out_indices was propogated to backbone
|
# Confirm out_indices was propagated to backbone
|
||||||
self.assertEqual(len(model.backbone.intermediate_channel_sizes), 3)
|
self.assertEqual(len(model.backbone.intermediate_channel_sizes), 3)
|
||||||
|
|
||||||
self.assertTrue(outputs)
|
self.assertTrue(outputs)
|
||||||
|
@ -423,7 +423,7 @@ class FSMTHeadTests(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def _assert_tensors_equal(a, b, atol=1e-12, prefix=""):
|
def _assert_tensors_equal(a, b, atol=1e-12, prefix=""):
|
||||||
"""If tensors not close, or a and b arent both tensors, raise a nice Assertion error."""
|
"""If tensors not close, or a and b aren't both tensors, raise a nice Assertion error."""
|
||||||
if a is None and b is None:
|
if a is None and b is None:
|
||||||
return True
|
return True
|
||||||
try:
|
try:
|
||||||
|
@ -149,7 +149,7 @@ class Gemma2ModelTest(GemmaModelTest, unittest.TestCase):
|
|||||||
|
|
||||||
@unittest.skip(
|
@unittest.skip(
|
||||||
reason="HybridCache can't be gathered because it is not iterable. Adding a simple iter and dumping `distributed_iterator`"
|
reason="HybridCache can't be gathered because it is not iterable. Adding a simple iter and dumping `distributed_iterator`"
|
||||||
" as in Dynamic Cache doesnt work. NOTE: @gante all cache objects would need better compatibility with multi gpu setting"
|
" as in Dynamic Cache doesn't work. NOTE: @gante all cache objects would need better compatibility with multi gpu setting"
|
||||||
)
|
)
|
||||||
def test_multi_gpu_data_parallel_forward(self):
|
def test_multi_gpu_data_parallel_forward(self):
|
||||||
pass
|
pass
|
||||||
|
@ -567,7 +567,7 @@ class Qwen2_5OmniProcessorTest(ProcessorTesterMixin, unittest.TestCase):
|
|||||||
signature.parameters.get("videos") is not None
|
signature.parameters.get("videos") is not None
|
||||||
and signature.parameters["videos"].annotation == inspect._empty
|
and signature.parameters["videos"].annotation == inspect._empty
|
||||||
):
|
):
|
||||||
self.skipTest(f"{self.processor_class} does not suport video inputs")
|
self.skipTest(f"{self.processor_class} does not support video inputs")
|
||||||
|
|
||||||
if "feature_extractor" not in self.processor_class.attributes:
|
if "feature_extractor" not in self.processor_class.attributes:
|
||||||
self.skipTest(f"feature_extractor attribute not present in {self.processor_class}")
|
self.skipTest(f"feature_extractor attribute not present in {self.processor_class}")
|
||||||
|
@ -244,13 +244,13 @@ class SamHQVisionModelTest(ModelTesterMixin, unittest.TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@unittest.skip(
|
@unittest.skip(
|
||||||
reason="This architecure seem to not compute gradients properly when using GC, check: https://github.com/huggingface/transformers/pull/27124"
|
reason="This architecture seem to not compute gradients properly when using GC, check: https://github.com/huggingface/transformers/pull/27124"
|
||||||
)
|
)
|
||||||
def test_training_gradient_checkpointing_use_reentrant(self):
|
def test_training_gradient_checkpointing_use_reentrant(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@unittest.skip(
|
@unittest.skip(
|
||||||
reason="This architecure seem to not compute gradients properly when using GC, check: https://github.com/huggingface/transformers/pull/27124"
|
reason="This architecture seem to not compute gradients properly when using GC, check: https://github.com/huggingface/transformers/pull/27124"
|
||||||
)
|
)
|
||||||
def test_training_gradient_checkpointing_use_reentrant_false(self):
|
def test_training_gradient_checkpointing_use_reentrant_false(self):
|
||||||
pass
|
pass
|
||||||
@ -682,13 +682,13 @@ class SamHQModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@unittest.skip(
|
@unittest.skip(
|
||||||
reason="This architecure seem to not compute gradients properly when using GC, check: https://github.com/huggingface/transformers/pull/27124"
|
reason="This architecture seem to not compute gradients properly when using GC, check: https://github.com/huggingface/transformers/pull/27124"
|
||||||
)
|
)
|
||||||
def test_training_gradient_checkpointing_use_reentrant(self):
|
def test_training_gradient_checkpointing_use_reentrant(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@unittest.skip(
|
@unittest.skip(
|
||||||
reason="This architecure seem to not compute gradients properly when using GC, check: https://github.com/huggingface/transformers/pull/27124"
|
reason="This architecture seem to not compute gradients properly when using GC, check: https://github.com/huggingface/transformers/pull/27124"
|
||||||
)
|
)
|
||||||
def test_training_gradient_checkpointing_use_reentrant_false(self):
|
def test_training_gradient_checkpointing_use_reentrant_false(self):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user