diff --git a/examples/question-answering/run_qa.py b/examples/question-answering/run_qa.py index 064717d80f..a590986d58 100644 --- a/examples/question-answering/run_qa.py +++ b/examples/question-answering/run_qa.py @@ -378,8 +378,8 @@ def main(): model = model.to("hpu") # Tokenizer check: this script requires a fast tokenizer. if not isinstance(tokenizer, PreTrainedTokenizerFast): - raise ValueError( - "This example script only works for models that have a fast tokenizer. Checkout the big table of models at" + raise TypeError( + "This example script only works for models that have a fast tokenizer. Check out the big table of models at" " https://huggingface.co/transformers/index.html#supported-frameworks to find the model types that meet" " this requirement" ) diff --git a/optimum/habana/transformers/generation/utils.py b/optimum/habana/transformers/generation/utils.py index a8b1858e99..ed33b99534 100755 --- a/optimum/habana/transformers/generation/utils.py +++ b/optimum/habana/transformers/generation/utils.py @@ -2998,7 +2998,7 @@ def _beam_search( f"Batch dimension of `input_ids` should be {num_beams * batch_size}, but is {batch_beam_size}." ) - # (joao) feature lost in the refactor. Probably won't implement, hurts readbility with minimal gains (there + # (joao) feature lost in the refactor. Probably won't implement, hurts readability with minimal gains (there # are newer low-memory alternatives like the offloaded cache) sequential = generation_config.low_memory if sequential: diff --git a/optimum/habana/transformers/loss/loss_rt_detr.py b/optimum/habana/transformers/loss/loss_rt_detr.py index 50cdc3a3b7..b119cd8de6 100644 --- a/optimum/habana/transformers/loss/loss_rt_detr.py +++ b/optimum/habana/transformers/loss/loss_rt_detr.py @@ -54,7 +54,7 @@ def gaudi_RTDetrHungarianMatcher_forward(self, outputs, targets): target_bbox = torch.cat([v["boxes"] for v in targets]) # Compute the classification cost. Contrary to the loss, we don't use the NLL, # but approximate it in 1 - proba[target class]. - # The 1 is a constant that doesn't change the matching, it can be ommitted. + # The 1 is a constant that doesn't change the matching, it can be omitted. if self.use_focal_loss: out_prob = F.sigmoid(outputs["logits"].flatten(0, 1)) out_prob = out_prob[:, target_ids] @@ -67,7 +67,7 @@ def gaudi_RTDetrHungarianMatcher_forward(self, outputs, targets): # Compute the L1 cost between boxes bbox_cost = torch.cdist(out_bbox, target_bbox, p=1) - # Compute the giou cost betwen boxes + # Compute the giou cost between boxes giou_cost = -generalized_box_iou(center_to_corners_format(out_bbox), center_to_corners_format(target_bbox)) # Compute the final cost matrix cost_matrix = self.bbox_cost * bbox_cost + self.class_cost * class_cost + self.giou_cost * giou_cost